Loop to compare size of 20 previous candles
-
Hello,
This is my first loop ever done in FXdreema.
Could you please have a look on it and check if it is correct or I need to write custom code to make it work?
I would like to compare last closed candle total size(of CandleID=1) with twenty previous candles (CandleID1=2,3,4....)and use a loop for it. If size is grater, it increases count value (+1) and CandleID1 (+1), if not it is checking next candle and doing nothing with count and so on until CandleID1=21. Then if count is grater than 10, the condition is true and if other conditions are met EA sets pending buy order.Unfortunately when I added size condition, no single order was set during backtesting.
https://fxdreema.com/shared/AlHGfVg4
Thanks in advance for your advices!
-
you have to add a reset of variables before loop:

problem with not opening trades is not in the loop, it is in other conditions before AND block, trades are not opened:

here are trades opened:

but this is not good, because each loop cycle where condition is true will open a trade ...
you have to create few logic changes:
