assuming that your code is in a way that for every tick that comes from server, the start() function is invoked. At the time you opened order, just put
wait_some_time = TimeCurrent();
int wait_some_time=0;
int start()
{
//do stuff here, like trailing stops or other things
....
...
if(TimeCurrent() - Wait_some_time<30)
return(0);
/// do stuff here
....
...
}
Depending on your code, perhaps you need to use slightly different approach. According to sleep functionality, a sleep of 30 seconds, means that your EA during this time is not receiving ticks from the server, which might not be desirable.
assuming that your code is in a way that for every tick that comes from server, the start() function is invoked. At the time you opened order, just put
wait_some_time = TimeCurrent();
int wait_some_time=0;
int start()
{
//do stuff here, like trailing stops or other things
....
...
if(TimeCurrent() - Wait_some_time<30)
return(0);
/// do stuff here
....
...
}
Depending on your code, perhaps you need to use slightly different approach. According to sleep functionality, a sleep of 30 seconds, means that your EA during this time is not receiving ticks from the server, which might not be desirable.
Thank you - I will check it soon. Regards PUNCHER
wait_some_time is in seconds or miliseconds?
abstract_mind wrote >>
assuming that your code is in a way that for every tick that comes from server, the start() function is invoked. At the time you opened order, just put
wait_some_time = TimeCurrent();
int wait_some_time=0;
int start()
{
//do stuff here, like trailing stops or other things
....
...
if(TimeCurrent() - Wait_some_time<30)
return(0);
/// do stuff here
....
...
}
Depending on your code, perhaps you need to use slightly different approach. According to sleep functionality, a sleep of 30 seconds, means that your EA during this time is not receiving ticks from the server, which might not be desirable.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there any other way to wait 30 seconds? Can I use any other code to wait 30 seconds after modification opened orders?
----------------------------------- START IDEA -----------------------------------
I would like to modify opened order when current price of selected opened order is:
1/. BUY order:
if BID >= OrderOpenPrice()+30*Point then StopLoss = BID - 7*Point, TakeProfit = BID+1000*Point
2/. SELL order:
if ASK <= OrderOpenPrice()-30*Point then StopLoss = ASK +7*Point, TakeProfit = ASK-1000*Point
The opened order should be chcecked and modified every 30 seconds...
------------------------------------- STOP IDEA -----------------------------------
If have you any idea how to write proper code of modification of opened orders for above conditions please answer. Thank you.