Edit Your Comment
Random sleep
Sep 04, 2014 zamanından beri üye
25 iletiler
Jun 01, 2016 at 06:25
Sep 04, 2014 zamanından beri üye
25 iletiler
Hello,
I try to code a random sleep time before opening each trade to avoid opening 2 trades simultaneously when my EA is on multiples charts.
If(OrdersTotal()==0 && condition for buy) {
((Randon sleep here)) //open the trade wich has lowest sleep first, then OrdersTotal()==1, avoid 2nd trade to open.
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"Trend",1000,0,Green);
}
Could someone help ma please?
Thank you
I try to code a random sleep time before opening each trade to avoid opening 2 trades simultaneously when my EA is on multiples charts.
If(OrdersTotal()==0 && condition for buy) {
((Randon sleep here)) //open the trade wich has lowest sleep first, then OrdersTotal()==1, avoid 2nd trade to open.
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"Trend",1000,0,Green);
}
Could someone help ma please?
Thank you
luclevesque17@

forex_trader_25447
Dec 21, 2010 zamanından beri üye
127 iletiler
Jun 01, 2016 at 08:47
Dec 21, 2010 zamanından beri üye
127 iletiler
You can use "GlobalVariable" : https://docs.mql4.com/globals
When some EA send order, this variable accept the time of execution.
Each EA can make anything, only after N seconds (and again set this variable).
It is also useful to check IsTradeContextBusy() before execution,
it is possible some EA is already working.
When some EA send order, this variable accept the time of execution.
Each EA can make anything, only after N seconds (and again set this variable).
It is also useful to check IsTradeContextBusy() before execution,
it is possible some EA is already working.
Sep 04, 2014 zamanından beri üye
25 iletiler
Jun 03, 2016 at 08:14
Sep 04, 2014 zamanından beri üye
25 iletiler
Thank you Yvan. I will try with IsTradeContextBusy()
luclevesque17@

*Ticari kullanım ve istenmeyen e-postalara müsamaha gösterilmez ve hesabın feshedilmesine neden olabilir.
İpucu: Bir resim/youtube urlsi yayınlamak, onu otomatik olarak gönderinize gömer!
İpucu: Bu tartışmaya katılan bir kullanıcı adını otomatik olarak tamamlamak için @ işaretini yazın.