Expire order in n bars *** SOLVED ***
-
Hi, I currently try to find an easy way to expire an order (best on the BUY or SELL block defined) after n bars (eg. after 50 bars) regardless of if it is in profit or loss.
Has someone a quick solution? By custom MQL code I might calculate the current chart timeframe to minutes and multiply by my bar expiry value.For example for an M15 chart I might calculate 5015 minutes. For an H1 chart it would be 5060 minutes and so on.
Is there an easier way I don't see right now?
-
@trader-philipps Okay, I shouldn't answer my questions by myself, but writing the issue down gave me the hint. For everyone who is interested, I solved the issue with the period() function that gives back an integer value in minutes for the current chart timeframe. In fxdreema it looks like that now.

ciOrderExpirationBars is an integer constant were the user can set the number of bars in the EA's parameters.
-
Hi!
I think this candle ID function gets the "candle age" of each trade

-
@trader-philipps Does the expiration mode account for closed market time? Just curious
-
@roar It depends on specifying yes or no here..

But to be honest I don't know what the broker does with it as the expiration is send with the ordersend of the order.