If you prefer not to run your code on every tick, you can schedule it to run during the launch of a new bar or after any specific time period. This can be a useful feature for those who want more control over when their script runs.
Source code viewer
- static datetime PrevBars=0;
- datetime time_0 = iTime(Symbol(), PERIOD_M1, 0);
- if(time_0 == PrevBars)
- PrevBars = time_0;
- // Code after this will only run once per the given period.Programming Language: MQL5