Rejected orders when price passes buystop entry level

 
Hello, I'm running an EA that places buystop/sellstop pending orders on USDJPY.  Sometimes the candle moves too fast and market price passes the stop order level prior to MT5 placing it, resulting in rejection.  Are there any settings in MT5 that would help to allow for entry at market in this scenario rather than rejection?
 
DarthTradicus:
Hello, I'm running an EA that places buystop/sellstop pending orders on USDJPY.  Sometimes the candle moves too fast and market price passes the stop order level prior to MT5 placing it, resulting in rejection.  Are there any settings in MT5 that would help to allow for entry at market in this scenario rather than rejection?

try stop-limit orders instead.

But these may not work any better if price jumps 3 digits in single tick (for example).

if you do not have the source code, then, no, there is no settings on the platform to improve this issue. all possible improvements must be done in the eas coding.
 
Michael Charles Schefe #:

try stop-limit orders instead.

But these may not work any better if price jumps 3 digits in single tick (for example).

if you do not have the source code, then, no, there is no settings on the platform to improve this issue. all possible improvements must be done in the eas coding.

I'll be happily impressed if anyone has a U.S. FX broker-dealer that allows stop-limit orders. To the best of my knowledge, they don't exist. Per the OP's Profile, the OP is in the U.S.

I do have to wonder, however, what kind of EA gets burned on stops so quickly... and whether the stop is sent with the initial entry order, or later as an order modification. 

 
thanks for the replies.  I was looking through Tools/Options/Trade and found the deviation setting.  Would adjusting this help in my scenario at all or does it only apply to market and instant execution orders and not pending stop orders?
 
Ryan L Johnson #:
I do have to wonder, however, what kind of EA gets burned on stops so quickly... and whether the stop is sent with the initial entry order, or later as an order modification. 
The EA relies on an external signal that executes on the signal bar close so there is some slight latency.  Also currently I am running on demo which is locked on spread pricing- when I switch to live commission, I think a lot of these issues will resolve themselves.  But I'm trying to cover all my bases in the meantime-
 

It depends on your FX broker-dealer's order execution type. There are market execution FX broker-dealers, and then there are instant execution FX broker-dealers.

Forum on trading, automated trading systems and testing trading strategies

May I set a deviation of 0 when requesting a market trade with my EA?

Alain Verleyen, 2018.05.08 14:29

Execute such code to check with trade execution mode is used :

  ENUM_SYMBOL_TRADE_EXECUTION executionMode=(ENUM_SYMBOL_TRADE_EXECUTION)SymbolInfoInteger(_Symbol,SYMBOL_TRADE_EXEMODE);
  printf("Trade execution mode for %s is %s",_Symbol,EnumToString(executionMode));
If it returns SYMBOL_TRADE_EXECUTION_INSTANT (or SYMBOL_TRADE_EXECUTION_REQUEST) then you can use "deviation" with OrderSend. Otherwise you can't.

Because OrderSend() is a generic function, used with all kind of trading environment.

Regarding pending orders, no, there is no deviation parameter for pending orders.

The workaround would be to offset an open position using an equal, opposite, and instant Buy/Sell order─if you have an instant execution FX broker-dealer, and because the U.S. is a FIFO jurisdiction (no Hedge).

 
DarthTradicus #:
The EA relies on an external signal...

Ah ha. Without laying eyes on, I bet that your remote signal delay is at issue.

DarthTradicus #:
[W]hen I switch to live commission, I think a lot of these issues will resolve themselves.

That would be nice, but I make it a habit not to rely on anything fixing itself.

DarthTradicus #:
But I'm trying to cover all my bases in the meantime-

Definitely.

 
cool, thanks for the help guys.  I think what I'll do, in addition to when I switch to commission is look into coding a more dynamic entry placement for faster moving candles... I got some ideas.  thanks again.
 
DarthTradicus #:
thanks for the replies.  I was looking through Tools/Options/Trade and found the deviation setting.  Would adjusting this help in my scenario at all or does it only apply to market and instant execution orders and not pending stop orders?
i am guessing only, but maybe your ea does not include the minimum distance from current price to open a pending order. ask the author. This should be programmed into the ea. if it isnt then your trades will get burned; rejected as you said, otherwise, this should never happen with a pending order, unless as said previously, that the price jumps 3 digit prices in single tick.