Jose Francisco Casado Fernandez: Yes, it's what I was saying. I did it so, and it worked, but if you modify the initial Stop Loss, it generates a new order WITHOUT the same POSITION_ID. I don't know why. I think, it is a bug. Regards,.
No need to lookslippage,because the orderhas beenclose,andclose priceis onHystoryDealGetDouble(ticket,DEAL_PRICE). If theorder has not beeninclose,andyoumake an ordertoclose,then you should considerhow muchslip,so that noerrorrequotes.
If I understand you correctly, that's not exact. On a real market, an order can be closed by SL (or TP) at a different price that the position SL (or TP).
No need to lookslippage,because the orderhas beenclose,andclose priceis onHystoryDealGetDouble(ticket,DEAL_PRICE). If theorder has not beeninclose,andyoumake an ordertoclose,then you should considerhow muchslip,so that noerrorrequotes.
I'm not sure I follow.
HistoryOrderGetDouble(ticket,ORDER_SL) is the stop loss
When the SL is triggered, you can get slippage.
HistoryDealGetDouble(ticket, DEAL_PRICE) will show the actual price, which may or may not have encountered slippage.
If there was slippage, a simple comparison of ORDER_SL == DEAL_PRICE will fail, no?
Jose Francisco Casado Fernandez: Yes, it's what I was saying. I did it so, and it worked, but if you modify the initial Stop Loss, it generates a new order WITHOUT the same POSITION_ID. I don't know why. I think, it is a bug. Regards,.
An order to modify SL/TP is not saved in the history at all. So not sure what you mean here ?
And the order which actually results from the SL/TP triggered doesn't contain the SL/TP.
Alain Verleyen: If I understand you correctly, that's not exact. On a real market, an order can be closed by SL (or TP) at a different price that the position SL (or TP).
Yes Alain, what if Bid > close_price+spread or Ask < close_price-spread
What about slippage?
Yes, it's what I was saying. I did it so, and it worked, but if you modify the initial Stop Loss, it generates a new order WITHOUT the same POSITION_ID. I don't know why. I think, it is a bug. Regards,.
No need to look slippage, because the order has been close, and close price is on HystoryDealGetDouble(ticket, DEAL_PRICE).
If the order has not been in close, and you make an order to close, then you should consider how much slip, so that no error requotes.
No need to look slippage, because the order has been close, and close price is on HystoryDealGetDouble(ticket, DEAL_PRICE).
If the order has not been in close, and you make an order to close, then you should consider how much slip, so that no error requotes.
I'm not sure I follow.
HistoryOrderGetDouble(ticket,ORDER_SL) is the stop loss
When the SL is triggered, you can get slippage.
HistoryDealGetDouble(ticket, DEAL_PRICE) will show the actual price, which may or may not have encountered slippage.
If there was slippage, a simple comparison of ORDER_SL == DEAL_PRICE will fail, no?
Yes, it's what I was saying. I did it so, and it worked, but if you modify the initial Stop Loss, it generates a new order WITHOUT the same POSITION_ID. I don't know why. I think, it is a bug. Regards,.
An order to modify SL/TP is not saved in the history at all. So not sure what you mean here ?
And the order which actually results from the SL/TP triggered doesn't contain the SL/TP.
<= for Buys and >= for Sells.
I'm not sure I follow.
HistoryOrderGetDouble(ticket,ORDER_SL) is the stop loss
When the SL is triggered, you can get slippage.
HistoryDealGetDouble(ticket, DEAL_PRICE) will show the actual price, which may or may not have encountered slippage.
If there was slippage, a simple comparison of ORDER_SL == DEAL_PRICE will fail, no?
If I understand you correctly, that's not exact. On a real market, an order can be closed by SL (or TP) at a different price that the position SL (or TP).
Yes Alain, what if Bid > close_price+spread or Ask < close_price-spread
spread != deviation (slippage)
It is a shame it is not possible to retrieve the deviation parameter.
Probably a reasonable compromise is (presuming the EA placed the order) to check whether DEAL_PRICE was within a window of ORDER_SL ± deviation
Yes Alain, what if Bid > close_price+spread or Ask < close_price-spread