Hoschie: If buyCondition is true, then wait excactly 60 or defined seconds and check the buycondition again after the seconds are over.
static datetime timer; static bool buyCondition; bool wasCondition = buyCondition; buyCondition = ...; if(buyCondition && !wasCondition) timer = TimeCurrent(); if(TimeCurrent() - timer >= 60) CheckAgain();
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 want to ask, how I can implement a function for starting a timer after a certain condition like
If buyCondition is true, then wait excactly 60 or defined seconds and check the buycondition again after the seconds are over.
I used in my code function like TimeSeconds(TimeCurrent()) which provides me the exact seconds, but how can I compare it with the current time.
For instance, if the seconds, where the buyCondition is true is 15 seconds, and normally I have to add this to the current time and compare this with
TimeCurrent(). How can I do this in Mql4?
Thanks for your help.
Kind regards,
Hoschie