Cross over and then compare 20 candles- help

 

I am working on customer indicator where whenever 2 moving averages cross each other it will then check engulfing pattern in next 15 candles.

When 2 ma cross, i assigned value of i (which is main loop) to new integer j .. means int j = i; and then run a nested loop.....for (int counter = j; counter < j+15; counter ++)...so on...problem is: it ignores this nested loop and keep on checking engulfing pattern even after 15 candles.

Please advise.

Thanks.

Aryan

Reason: