Download MetaTrader 5
To add comments, please log in or register
No PC at hand? Communicate with friends using your mobile phone!
hals 2015.03.28 16:08 


I'm trying to make a break between each position. I want the EA to open position exactly after 10 minutes of the previous position closing . This can be easily  accomplished through Sleep() function but the problem is it doesn't work in strategy tester so i can never test this strategy automatically . So is there's any way to wait 10 minutes before opening  another position ? 

**Note : I use OrdersTotal() to check the number of opened positions , if it's 0 then it means the position is closed so I want to wait  10 minutes after having OrdersTotal() == 0 then I open another position

honest_knave 2015.03.28 16:34  
Take the time your last order closed (loop through OrderHistory to find it or store it at the time of closing), add 600 (seconds) then check that TimeCurrent() is greater than that time before opening a new order.
rocketman99 2015.03.29 03:58  
honest_knave 2015.03.29 08:08  

OnTimer() doesn't work in strategy tester.

See here 

To add comments, please log in or register