Download MetaTrader 5
To add comments, please log in or register
Deposit to your account in any convenient way. There are 4 of them here!
emeric de Monteville
560
emeric de Monteville 2014.02.10 12:04 

hi

My expert advisor is based on H4 1 bar ago and run on 10 differents pairs.

Sometimes 2 pairs open at the same time and i would like to know if it is possible to open a pair and 30 sec after it opened the second, 30 sec later the second it open the third ...

If you know the code i will be very pleased

thanks

qjol
3243
qjol 2014.02.10 12:12  

there is a few ways to do it

1) use Sleep()

2) use time

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.10 12:14  
riicoFX:

hi

My expert advisor is based on H4 1 bar ago and run on 10 differents pairs.

Sometimes 2 pairs open at the same time and i would like to know if it is possible to open a pair and 30 sec after it opened the second, 30 sec later the second it open the third ...

Can you explain what you mean by "open a pair" ?
emeric de Monteville
560
emeric de Monteville 2014.02.10 12:17  

thanks.

open a pair is for exemple open first EUR/USD and 30 sec later open EUR/CHF but my expert advisor give the order in the same time .

Maybe i must place the second in pending order...

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.02.10 12:24  
riicoFX:

thanks.

open a pair is for exemple open first EUR/USD and 30 sec later open EUR/CHF but my expert advisor give the order in the same time .

Maybe i must place the second in pending order...

Ah you mean open an Order . . . you can select the EURuSD order and check it's OrderOpenTime() if 30 secs has elapsed then place your EURCHF Order.
emeric de Monteville
560
emeric de Monteville 2014.02.10 12:34  
RaptorUK:
Ah you mean open an Order . . . you can select the EURuSD order and check it's OrderOpenTime() if 30 secs has elapsed then place your EURCHF Order.


ok thanks a lot i try to code it :)
whroeder1
13602
whroeder1 2014.02.10 13:58  
riicoFX: Sometimes 2 pairs open at the same time and i would like to know if it is possible to open a pair and 30 sec after it ...
RaptorUK: Ah you mean open an Order . . . you can select the EURuSD order and check it's OrderOpenTime() if 30 secs has elapsed then place your EURCHF Order.

If the EA is running on multiple charts, it's possible that each EA will check, see no open orders and you'll still open two orders.

To prevent this you will need a mutex (lock the mutex, check for open orders, optionally open an order, unlock the mutex)

/
To add comments, please log in or register