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.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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?