Sell at 100 and get filled at 101 is a better price. You are right if the same was with a Buy.
I also contacted my broker and they say it is because SellLimit orders are stored locally (not on the exchange) and then executed at market price when price hits the SL or TP.
The solution is to only have Buy and Sell orders and code in the logic to replace the SellLimit function. This means the orders will sit on the exchange and hopefully avoid slippage.
The solution is to only have Buy and Sell orders and code in the logic to replace the SellLimit function. This means the orders will sit on the exchange and hopefully avoid slippage.
![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
Hi all
Hope you are well. I've tried researching this question but have come up blank.
I am creating an EA that sets Sell Limit orders in good time before the trade happens. However, in the demo account, the trade is being executed at a "worse" order price. E.g. If my order says to sell at 100, it is selling at 101.
I am using the cTrade.SellLimit function, as follows with example:
cTrade.SellLimit(quantity, order_price=100, symbol=_Symbol, sl=110, tp=90, type_time=ORDER_TIME_GTC)
My high level trade parameters are:
cTrade.SetDeviationInPoints(0);
cTrade .SetTypeFilling(ORDER_FILLING_RETURN);
cTrade .LogLevel(1);
cTrade.SetAsyncMode(false);
Hope you can help!