static datetime timeday=0; if (timeday!=iTime(_Symbol,PERIOD_D1,0)) { Print("This code should be printed once per day"); timeday=iTime(_Symbol,PERIOD_D1,0); }
mr_blond97:
I have a cycle with Print(). This string should be printed once per day only. There is the code:
I have a cycle with Print(). This string should be printed once per day only. There is the code:
It has 2 issues:
1) When chart gets alot of ticks, it do more then one Print().
2) When disconnect happens or just there is a end of trading session on current instrument, time in terminal freezes and this cycle run without ending untill it gets tics and time becomes unfreezed.
So how do I run this code once per day even if there is disconnect happens?
1) it doesn't make sense, it is a timer, it is not bound to OnTick()...
2) Use TimeLocal() (your computer's time) if you don't need to rely on server time...
;)
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
It has 2 issues:
1) When chart gets alot of ticks, it do more then one Print().
2) When disconnect happens or just there is a end of trading session on current instrument, time in terminal freezes and this cycle run without ending untill it gets tics and time becomes unfreezed.
So how do I run this code once per day even if there is disconnect happens?