My mistake: the action is there indeed.
Here goes the full code again below.
MqlTradeRequest request; MqlTradeResult result; ZeroMemory(request); ZeroMemory(result); datetime expiration = TimeCurrent()+PeriodSeconds(PERIOD_M30); request.symbol = Symbol(); request.volume = Lots; request.stoplimit = 0; request.sl = 0; request.tp = 0; request.type_filling = ORDER_FILLING_FOK; request.type_time = ORDER_TIME_SPECIFIED; request.expiration = expiration; request.action=TRADE_ACTION_PENDING; request.type=ORDER_TYPE_BUY_STOP; request.price=myprice; request.tp=mytp; dummy = OrderSend(request, result);
My mistake: the action is there indeed.
Here goes the full code again below.
Many thanks, I did not know this!
I should use the code to verify this in the expert code, right?
Yes, it's broker/symbol dependent. It's probably your problem, please report here when you will check.
Just to complete my understanding on this: I can use the mouse to manually create a pending order, buy/sell stop.
Doing the same via EA is a different thing?
Just to complete my understanding on this: I can use the mouse to manually create a pending order, buy/sell stop.
Doing the same via EA is a different thing?
I don't think so. What I wrote is only a suggestion, please try it and report the result.
Just did tests and results were key!!
Only SYMBOL_EXPIRATION_DAY is allowed. I changed code to only use it with BUY_LIMIT and SELL_LIMIT orders and now orders are routing throught.
Infinite thanks, man!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all,
I am building an EA and it is properly sending orders, but every time it reports [invalid expiration].
I would need this EA to send orders as pending orders, since the strategy requires a start order.
The code I have is below, please advise.
MqlTradeRequest request;
MqlTradeResult result;
ZeroMemory(request);
ZeroMemory(result);
datetime expiration = TimeCurrent()+PeriodSeconds(PERIOD_M30);
request.symbol = Symbol();
request.volume = Lots;
request.stoplimit = 0;
request.sl = 0;
request.tp = 0;
request.type_filling = ORDER_FILLING_FOK;
request.type_time = ORDER_TIME_SPECIFIED;
request.expiration = expiration;
request.type=ORDER_TYPE_BUY_STOP;
request.price=myprice;
request.tp=mytp;
dummy = OrderSend(request, result);