Help understanding Candle ID when creating MA Crossover EA
-
Hi, When creating a MA Crossover EA I am finding that if I leave the candle ID as zero on the condition for the crossover then when I test I am finding the EA doesn't Buy/Sell on every crossover. It does however work when I put the candle ID as 1. I understand that candle ID 1 refers to the next candle after the crossover which is fine but I don't understand why I get mixed results when I want the EA to execute the trade on the present candle when the crossover happens. If I move the 'once per bar' below the condition then sometimes it executes the trade twice on consecutive candles. I think I am misunderstanding something fundamental.
shared/1cWf69f8b
-
@richreed2426 The fact is that the zero candle does not exist, because it is the current one and it is forming at this moment
The indicators always work with the candle closed, ie ID 1, because the current one does not yet have a defined value
It is a mistake to work on candle ID 0 -
Thanks - this makes sense.