zerocold:
I try since Friday to creat an EA that can open orders of 5 mintues expiration cause I will link it later to a Binary options plateform. I almost used all solution on this forum
creat a datetime variable in order to use for closing the order:
Most brokers (?all copies of MT4) have minimum expiry times longer than 5 minutes. The information in the old thread https://www.mql5.com/en/forum/101886 still seems to be correct.
Expiry times are for pending orders only. It should cancel a pending order if it has not been triggered. It will not close an open OP_BUY or OP_SELL
- Use SRC to post code
- Expiration can only be used with pending orders. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- Some brokers do not allow expiration at all
147
Expirations are denied by broker
You can create a countdown script. It is the script that is supposed to close the pending position in 5 minutes, not the broker. A script that updates the time by tick on the chart.

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
Hello,
I try since Friday to creat an EA that can open orders of 5 mintues expiration cause I will link it later to a Binary options plateform. I almost used all solution on this forum
creat a datetime variable in order to use for closing the order:
Exemple 1:
datetime et = Time[0]+(5*60);
int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, et, clrGreen);
Exemple 2:
datetime et = TimeCurrent()+(5*60);
int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, et, clrGreen);
Second Option directly put the expiration on the fonction:
int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, TimeCurrent()+300, clrGreen);
NOOOOOOOthing work when I check with a backtest !!!!
I want that EA to open an order & to close it after 5 minutes, that's the only condition I wanna use !!!
Can you Help me please!!!
thnks