SellLimit Order being filled at worse price

 

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!

 
Sell at 100 and get filled at 101 is a better price. You are right if the same was with a Buy.
 

apologies i meant sell at 99! Thanks for the correction


Enrique Dangeroux #:
Sell at 100 and get filled at 101 is a better price. You are right if the same was with a Buy.
 
anupmistry123 #:

apologies i meant sell at 99! Thanks for the correction


If in fact a limit order is slipping negative, change broker. 

 

Thanks will consider it. Currently I am using a demo data feed from the broker, so it is surprising there is slippage. But I suppose they are reflecting real life situations.


Enrique Dangeroux #:

If in fact a limit order is slipping negative, change broker. 

 
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.