samjesse:
Hi
mql5 EA
Will this code do well in checking if a new bar arrives?
Thanks
No, it won't.
Andrey Barinov:
No, it won't.
Why? is it because SERIES_LASTBAR_DATE gives error sometimes? is so, what about this?
By Malden https://www.mql5.com/en/forum/5762/page2
static datetime prevTime=0; datetime lastTime[1]; OnTick(){ if (CopyTime(_Symbol,_Period,0,1,lastTime)==1 && prevTime!=lastTime[0]) { prevTime=lastTime[0]; // ...new bar arrived, do stuff } }
![How to detect a new bar How to detect a new bar](https://c.mql5.com/36/20/how-to-detect-a-new-bar.jpg)
How to detect a new bar
- 2017.01.26
- www.mql5.com
Hi All, I'm a complete newbie to MQL5 but I've done a fair bit of coding for other platforms...
![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
Hi
mql5 EA
Will this code do well in checking if a new bar arrives?
Thanks