Hi,
trying to build up an array with trade results for further calculation. My understanding is that I have to filter by Algo/Asset the trades in the loop. This is the code:

Code:
#define MaxRolling 50
var rer(int ii){
// rolling expectancy ratio: ((AvgWin / AvgLoss) * WinRate) – (1 – WinRate)

	bool debug = TRUE;
	var resultAA[MaxRolling];
	int i=0; for (i=0; i<MaxRolling; i++) resultAA[i] = 0; // Init the Array

	string myAsset = Asset;
	string myAlgo = Algo;
	i=0;
	for(closed_trades) {
		if( TradeIsPhantom &&  myAsset==TradeAsset && myAlgo==TradeAlgo) {
			resultAA[i] = TradeProfit/TradeUnits/PIP;
			if(debug) {
				print(TO_ANY, "n Asset: %s - ALGO: %s - #Trades: %d - PIP: %.2f", Asset, Algo, i, resultAA[i]);	
			}
			i++;	
			if (i >= ii) {break_trades;}
		}
}
	return .0;
}



nothing happens. Trade results ar printed if the last condition in the IF statement is removed. I do not understand what I am missing.

Thank you