How to check if an order has been closed for stop loss - page 4

 
honest_knave:
What about positive slippage?
Positive slippage on a SL ? 
 
honest_knave:

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

Here I am lost. This topic is about identifying if an SL/TP was triggered on server side.

How is that related with spread or deviation ? 

 
Alain Verleyen:
Sorry but I don't understand what you mean ?
Yes Alain, Jose right, I think more reasonable if stop_loss <= DEAL_PRICE (for buy) and stop_loss >=  DEAL_PRICE (for sell)
 
Alain Verleyen:

Here I am lost. This topic is about identifying if an SL/TP was triggered on server side.

How is that related with spread or deviation ? 

Well, I'm lost on the spread side of things.

But, my understanding is that once a SL is hit it becomes a market order and filled at the best possible price. That is subject to slippage, no? 

 
Roberto Jacobs:
Yes Alain, Jose right, I think more reasonable if DEAL_PRICE <= close_price (for buy) and DEAL_PRICE >= close_price (for sell)
What is DEAL_PRICE and what is close_price ?
 
Alain Verleyen:
What is DEAL_PRICE and what is close_price ?
I mean DEAL_PRICE is HistoryDealGetDouble(ticket,DEAL_PRICE) and close_price is HistoryOrderGetDouble(ticket,ORDER_SL)
 
honest_knave:

Well, I'm lost on the spread side of things.

But, my understanding is that once a SL is hit it becomes a market order and filled at the best possible price. That is subject to slippage, no? 

Although I have undermined my own argument for an "acceptable range", because best possible price may well be outside the deviation parameter inside the EA.

Nevertheless, it could be positive slippage. 

 
honest_knave:

Well, I'm lost on the spread side of things.

But, my understanding is that once a SL is hit it becomes a market order and filled at the best possible price. That is subject to slippage, no? 

Yes but my question was about spread/deviation, not slippage.

So yes theoretically it becomes a market order, but certainly not filled at best possible price. But that's not the problem discussed here. 

The problem with MT5 is the current stoploss is not available in history. As stated by Jose, the initial stoploss is available, but it you change it later, there is no way to know.

So once you position is close, there is no way to know from history what was the stoploss, you can of course know the close price, but with what will you compare it to check if a stoploss was triggered ?

 
Roberto Jacobs:
I mean DEAL_PRICE is HistoryDealGetDouble(ticket,DEAL_PRICE) and close_price is HistoryOrderGetDouble(ticket,ORDER_SL)
It's not working, see my post above.
 
Alain Verleyen:
It's not working, see my post above.
Thank you Alain, must make more research for this issue.