Arieman:
What happens when I call the Sleep function in the OnCalculate method in my Indicator?
Nothing! The Sleep function is ignored in indicators.
Indicators can not stop — no sleep, no trading.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Good day,
What happens when I call the Sleep function in the OnCalculate method in my Indicator?
The reason I'm asking is due to an issue I'm picking up in multiple Symbol trading m(on a single PC) with my EA which seems to make erroneous trades (luckily not too often) that are not according to its prescribed rules, but when I run the EA with the same input variables in the back tester, it works fine.
I have a feeling this has to do with the lack of threading/multi-core capability of MT5 causing some glitch, and want to test my assumption with a "Sleep(ChartID()%10000)" [to randomize the processing time between charts] in the OnCalculate() function.
So, when Sleep is called, does it 'pause' the execution of the next OnCalculate on price change, or does OnCalculate override the Sleep to perform the next iteration on price change?
Thank you