Take profit High Spread

 

Hello Guys,


I attached an image where an order is placed with Price: 94460, Stop loss: 93960 and Take: 94560. 

But the transaction was closed with only 10 pts, at 94470.


What I can do in my code to prevent this?

Best Regards,



Logs:

2020.10.06 23:47:32.962 2020.10.05 11:17:16   instant buy 1 WIN$D at 94460 sl: 93960 tp: 94560 (94455 / 94460 / 94455)

2020.10.06 23:47:32.962 2020.10.05 11:17:16   deal #39 buy 1 WIN$D at 94460 done (based on order #39)

2020.10.06 23:47:32.962 2020.10.05 11:17:16   deal performed [#39 buy 1 WIN$D at 94460]

2020.10.06 23:47:32.962 2020.10.05 11:17:16   order performed buy 1 at 94460 [#39 buy 1 WIN$D at 94460]

2020.10.06 23:47:32.964 2020.10.05 11:17:16   CTrade::OrderSend: instant buy 1.00 WIN$D at 94460 sl: 93960 tp: 94560 [done at 94460]

2020.10.06 23:47:32.964 2020.10.05 11:17:16   100. OnTradeTransaction

2020.10.06 23:47:32.964 2020.10.05 11:17:16   MqlTradeTransaction: TRADE_TRANSACTION_DEAL_ADD deal #39 DEAL_TYPE_BUY WIN$D 1.00 lot   

2020.10.06 23:47:32.964 2020.10.05 11:17:16   101. OnTradeTransaction

2020.10.06 23:47:32.964 2020.10.05 11:17:16   MqlTradeTransaction: TRADE_TRANSACTION_ORDER_DELETE order #39 ORDER_TYPE_BUY ORDER_STATE_FILLED   

2020.10.06 23:47:32.964 2020.10.05 11:17:16   102. OnTradeTransaction

2020.10.06 23:47:32.964 2020.10.05 11:17:16   MqlTradeTransaction: TRADE_TRANSACTION_HISTORY_ADD order #39 ORDER_TYPE_BUY WIN$D ORDER_STATE_FILLED   

2020.10.06 23:47:32.964 2020.10.05 11:17:16   103. OnTradeTransaction

2020.10.06 23:47:32.964 2020.10.05 11:17:16   MqlTradeTransaction: TRADE_TRANSACTION_REQUEST

2020.10.06 23:47:32.964 2020.10.05 11:17:16   MqlTradeResult: order #39 retcode=TRADE_RETCODE_DONE 

2020.10.06 23:47:32.975 2020.10.05 11:17:44   take profit triggered #39 buy 1 WIN$D 94460 sl: 93960 tp: 94560 [#40 sell 1 WIN$D at 94560]

2020.10.06 23:47:32.975 2020.10.05 11:17:44   deal #40 sell 1 WIN$D at 94470 done (based on order #40)

2020.10.06 23:47:32.975 2020.10.05 11:17:44   deal performed [#40 sell 1 WIN$D at 94470]

2020.10.06 23:47:32.975 2020.10.05 11:17:44   order performed sell 1 at 94470 [#40 sell 1 WIN$D at 94560]



Files:
Reason: