Posted By: filip
Group trades by parameters - 10/01/19 19:15
Hello everyone, I am developing mean-reversion script on 4 FX pairs (strategy is always one currency long and one currency short). The script relies on 2 parameters and I would like to group trades by these parameters so that I can calculate information ratio for each of the parameter combinations. I am doing this using evaluate() and I found interesting behaviour:
Produces the correct total number of trades (multiple times). However, I would also except that this gives the same (only once):
The number produced is the total number of long trades only. Is this behaviour intended? How could I achieve the grouping of all trades?
Thanks a lot.
Code
for(all_algos) { int algocount = 0; for(all_trades) { algocount++; } print(TO_REPORT, "\n%d", algocount); }
Produces the correct total number of trades (multiple times). However, I would also except that this gives the same (only once):
Code
int algocount = 0; for(all_algos) { for(all_trades) { if(TradeAlgo == Algo) { algocount++; } } } print(TO_REPORT, "\n%d", algocount);
The number produced is the total number of long trades only. Is this behaviour intended? How could I achieve the grouping of all trades?
Thanks a lot.