MT5 Buy/stop Limit is different than IB's

Discuss, post questions here about MTIBBridge the MetaTrader-Interactive Brokers trade-copier

Users who just registered, please write an email to
forum@trade-commander.de
with your username mentioned.
So we can distinguish you from bots.
Thank you
Post Reply
james.benchimol
Posts: 7
Joined: Fri Feb 15, 2019 12:58 pm

MT5 Buy/stop Limit is different than IB's

Post by james.benchimol »

I've spent quite a considerable sum moving my EA from MT4 to MT5 because I was under the impression that MT5 supported Buy/Stop Limit orders.

They do support Buy/Stop limit orders but their definition is unfortunately different. The IB interpretation is the one below.It is used on all their instruments in the same way.

Real World Example of a Stop-Limit Order
For example, assume that Apple Inc. (AAPL) is trading at $170.00 and an investor wants to buy the stock once it begins to show some serious upward momentum. The investor has put in a stop-limit order to buy with the stop price at $180.00 and the limit price at $185.00. If the price of AAPL moves above the $180.00 stop price, the order is activated and turns into a limit order. As long as the order can be filled under $185.00, which is the limit price, the trade will be filled. If the stock gaps above $185.00, the order will not be filled.


MT5 Does it differently,
They only allow the limit price to be below the value of the buy/stop. So price must first reach the buy stop, then it has to retrace back to a lower price where the limit is so it can trigger.

This does not work for me cause I'm using it to trade news and want the limit price to protect me from slippage as in the example above.

So My question to Cornelius is ? What happens in IB when A buy/stop limit is sent from MT5 to the bridge ? How does it handle the lower Limit price since IB has the proper definition of BUY/STOP limit.

For me Ideally, If I could send a normal BUY/STOP from MT5 with 2 additional parameters , the first being interpreted as a BUY/STOP/Limit and the second being the value of the limit (being above the Stop) I would code those parameters in My EA and it would solve my problem.
Or any other solution would be welcomed.

The alternative is grim, means I have to write my own bridge :(

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by board_admin »

Hello,
i think i understand the problem but the bridge copies orders as they come from MT4,MT5.
This is somekind of product strategy to keep the software most straight forward as possible
because the software is already very complex with this requirement alone.

Perhaps you can compensate or workaround this on MetaTrader level:
Just watch the price in function OnTick. When it penetrates the 180 send out a limit at 185.
So you limit the price to185.

Or do it vice versa: Place a stop limit with stop =190 and limit 185.
Perhaps this works in average case.

james.benchimol
Posts: 7
Joined: Fri Feb 15, 2019 12:58 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by james.benchimol »

"Perhaps you can compensate or workaround this on MetaTrader level:
Just watch the price in function OnTick. When it penetrates the 180 send out a limit at 185.
So you limit the price to 185."

Thanks for the recommendation, however sending a limit order at 185 when 180 is penetrated implies that you can send a limit order that is above the current price. Unfortunately that is impossible in MT4 and MT5. in metatrader a limit price must be below current price on a buy order.

"Or do it vice versa: Place a stop limit with stop =190 and limit 185.
Perhaps this works in average case."

I don't understand this second suggestion as price would have to retrace from 190 and drop to the limit value of 185 to be executed.



"i think i understand the problem but the bridge copies orders as they come from MT4,MT5."
My contention is that IB may not support a buy/stop limit order where the limit value is below the stop. But that is all you can receive from metatrader. so my question is ; does IB even support and more important execute on that configuration or do you get an error ?

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by board_admin »

sending a limit order at 185 when 180 is penetrated implies that you can send a limit order that is above the current price
Yes, sorry, if this is not possible then it is of course no workaround.
I don't understand this second suggestion as price would have to retrace from 190 and drop to the limit value of 185 to be executed
Exactly. Because of this, i said in average case. If the market is very strong a retrace is unlikely yes, but also unlikely is to get a good limit price of
a buy stop limit filled because of the strong market.

---
What is about a Market Order with a max. deviation within your limits ?
---
IB handles the STOP LIMIT like you send it. Both is possible for buy and sell: stop above / below limit.
---
For me Ideally, If I could send a normal BUY/STOP from MT5 with 2 additional parameters
The bridge can only read out orders placed for MT. There is no way to pass somehow additional parameters,
except to write something into the comment which then requires to be evaluated in the bridge.
But wont do this, because the comment is already evaluted for information written by MT to the comment.
A custom comment would break this.

---
If you have access to the .mql code, why not checking out TWSLink. It is free. You can use it to send stop limit orders.
This is the board for TWSlink:
viewforum.php?f=3

This is the product page:
https://trade-commander.com/twslink/

james.benchimol
Posts: 7
Joined: Fri Feb 15, 2019 12:58 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by james.benchimol »

Thanx Cornelius.
I Prefer to stay a commercial client rather than try to build my own code.

What is about a Market Order with a max. deviation within your limits ?

Interesting . This could work. how does this work. ? how do I send it from MT5 ?
I assume this is a market order with with a condition not to exceed a certain deviation.

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by board_admin »

Hello James,
i believe the max. deviation setting is in the menu/options/trade panel.

Please dont rely on me. Just join the mql forum:

https://www.mql5.com/en/forum

They know better how to limit MKT orders.

I tried on my MT5 ActiveTrades and i could place a buy stop limit order ABOVE market, where stop=limit price.
If limit > stop, it does not work, but stop=limit price works. Why is this not working for you ?

james.benchimol
Posts: 7
Joined: Fri Feb 15, 2019 12:58 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by james.benchimol »

If I could place a Buy stop order higher than price and a limit order at the same price as the buy stop that would solve all my problems!
But with Pepperstone MT5 it won't let me. I will download activ trader and see.
Thank you for the suggestion.

james.benchimol
Posts: 7
Joined: Fri Feb 15, 2019 12:58 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by james.benchimol »

Cornelius you are a genius!! Thank you so much. ! I can now use your commercial bridge.
On Activ trades I can dot it. That works for me.

Thank you

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by board_admin »

Hello James,
glad to read this!

board_admin
Site Admin
Posts: 244
Joined: Mon Apr 24, 2017 3:24 pm

Re: MT5 Buy/stop Limit is different than IB's

Post by board_admin »

With icmarkets it seems also to be possible to place buy limit above market, when stop price==limit price.

Post Reply