Hong Ling Mu:
Hi, I just want to ask for your useful idea.
If flag becomes true, I just want to count 30sec,
After 30sec, then I want to delete object.
I tried to use Sleep(30000), but this sleep time stop other program in EA, so I don't want to use it.
Do you have any good idea ?
Hi,
you can use the OnTimer() function
https://docs.mql4.com/eventfunctions/eventsettimer
Event Handling Functions - Functions - Language Basics - MQL4 Reference
- docs.mql4.com
Event Handling Functions - Functions - Language Basics - MQL4 Reference
Hong Ling Mu: If flag becomes true, I just want to count 30sec,
After 30sec, then I want to delete object.
When you set the flag, remember the time. On a new tick, compute the duration.
Yohana Parmi #:
Hi,
you can use the OnTimer() function
https://docs.mql4.com/eventfunctions/eventsettimer
Thank you!
I will study OnTimer function.
If you are not using the timer for other things then you can do this:
bool flag; if (some event occure && !flag) { flag=true; EventSetTimer(30); } void OnTimer() { ObjectDelete( 0, "OBJECTA" ); EventKillTimer(); }
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, I just want to ask for your useful idea.
If flag becomes true, I just want to count 30sec,
After 30sec, then I want to delete object.
I tried to use Sleep(30000), but this sleep time stop other program in EA, so I don't want to use it.
Do you have any good idea ?