- OnCalculate. The function is called in the indicators when the Calculate event occurs for processing price data changes.

Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
- www.mql5.com
Trade Server Return Codes - Codes of Errors and Warnings - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
//global datetime wait; if (TimeCurrent() < wait) return; //check initially and every 20 seconds wait=TimeCurrent()+20;
Is there a reason not to be doing this task with the OnTimer() event function with EventSetTimer(20) set in OnInit()?
Forum on trading, automated trading systems and testing trading strategies
Performance implications of multiple chart object updating indicators on a chart
Alain Verleyen, 2023.05.28 17:34
Of course not. OnTimer() works perfectly with indicators, except when invoked with iCustom().
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
I would like to repeat a task every 20 seconds is that how to do it?