Trigger on only new bar
chris.dotan: This code works but problem is because works imediatelly when add indicator on Chart. So how can I use this code on the next new bar ? If I have chart 1 hour I need to start with next hour and then always use with next new bar?
Read the following. Pay careful attention to the comments in the code.
Detecting the start of a new bar or candle
Fernando Carreiro, 2022.04.24 00:46
Detecting the start of a new bar or candle, in the OnTick() event handler of an expert advisor.
This code works but problem is because works imediatelly when add indicator on Chart.
So how can I use this code on the next new bar ?
If I have chart 1 hour I need to start with next hour and then always use with next new bar?