You can add 3 candles time to your current candle time get your Custom Time for expiration.
datetime OrderTimeSpecified = iTime(NULL,0,0) + (3*PeriodSeconds());
-
Note that some brokers do not allow expiration time.
- There is no need to create pending orders in code.
- The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
- Don't worry about it unless you're scalping M1 or trading news.
- Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I would like to change my order time type to valid until next 3 candles from good until the end of day:
I tried this, but it didn't work:
Does anybody knows how to do it? Thanks!