Prohibit two orders in a same candle

 

Hello,

I try to write some code for a EA that allows me to not take a position on a candle if an order has already been executed on this candle.

Example (UT = 1 hour):

12:00 => Ea launches a purchase order
12:43 => The stop loss is hit
12:51 => Ea launches a new purchase order. It is this order that I would ban because it is the second on a single candle.

Someone has an idea?

In advance, thank you.
Taad

 

add global variable,


when new candle the global variable reset to zero

when global variable is zero a position can be opened and global variable set to one

when global variable is one a new position will be probhited

 

good idea !

thanks.

 

Hello,

Please look at the Notes in the end of https://www.mql5.com/en/forum/124521/page7.

Regards,

Airat