Hi I I have this EA and I was wondering how to make it wait 1 minute after it gives me an alert before it does its job again.
currently it is echoing the alert nonstop until it meets its goal. what code do I use ?
Just set a flag (and a delay) and check it before alerting again. It's basic coding!
If however you are not a coder then place a Job request in the Freelance section and hire someone to do it for you!
Hi I I have this EA and I was wondering how to make it wait 1 minute after it gives me an alert before it does its job again.
currently it is echoing the alert nonstop until it meets its goal. what code do I use ?
I would define a (global or static) datetime variable nxtAlert and set it to:
Alert(...)
nextAlert = TimeCurrent() + 60;
...
}
RefreshRates();
RefreshRates();
I don't think "Sleep" is ideal here as one wants an EA to continue responding to ticks and carry out other tasks. The OP just does not want the "Alert" to continue being triggered during that time.
Hence, why he should just use a flag (Boolean Variable), to know when the Alert has first been triggered and thus let some time go by before resting the flag again.
Carl's suggestion is much more applicable to this case!
The simplest and correct answer was provided, you don't need to use sleep or a boolean :
Forum on trading, automated trading systems and testing trading strategies
Carl Schreiber, 2016.11.04 20:25
I would define a (global or static) datetime variable nxtAlert and set it to:
Alert(...)
nextAlert = TimeCurrent() + 60;
...
}
I don't think "Sleep" is ideal here as one wants an EA to continue responding to ticks and carry out other tasks. The OP just does not want the "Alert" to continue being triggered during that time.
Hence, why he should just use a flag (Boolean Variable), to know when the Alert has first been triggered and thus let some time go by before resting the flag again.
Carl's suggestion is much more applicable to this case!
Maybe. But if we see all code, maybe Sleep() can be used too.
Do we have another troll here?
Thanks to you all the
Sleep(60*1000);
RefreshRates();
Seemed to have done the job.
Thanks to you all the
Sleep(60*1000);
RefreshRates();
Seemed to have done the job.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi I I have this EA and I was wondering how to make it wait 1 minute after it gives me an alert before it does its job again.
currently it is echoing the alert nonstop until it meets its goal. what code do I use ?