does this fonction exist?

 

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

 

there is a few ways to do it

1) use Sleep()

2) use time

 
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" ?
 

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...

 
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.
 
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 :)
 
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)

Reason: