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
Could you please only answer if you know what you are talking about ?
This is a topic about MT5/mql5, I will remove all irrelevant posts.
There is no stoploss price in history on MT5.
The main problem in mql5 (hedging account) is to know the Stop Loss price, when a position is closed, due to lack of positions history. You can use HistorySelectByPosition() to find your initial Stop Loss (Stop Loss of the initial order), but if you have modified that Stop Loss later, it generates new orders to do it, without the same POSITION_ID, and therefore, they will not be selected by HistorySelectByPosition() function, so it becomes very difficult to know the last Stop Loss you placed.
I don't know if it can be considered as a bug, but if not, it should be.
Regards.
The main problem in mql5 (hedging account) is to know the Stop Loss price, when a position is closed, due to lack of positions history. You can use HistorySelectByPosition() to find your initial Stop Loss (Stop Loss of the initial order)...
No you can't or I misunderstood you.
Current Stoploss is nowhere in history.
No you can't or I misunderstood you.
Stoploss is nowhere in history.
.the problem is when you modify that Stop Loss later.
You can use HistorySelectByPosition(), with your POSITION_ID, and then you can find the first order with that POSITION_ID, and check the Stop Loss of this order (HistoryOrderGetDouble(ticket, ORDER_SL). It worked for me, but
.the problem is when you modify that Stop Loss later.
Ok understood now, you are right.
You can use HistorySelectByPosition(), with your POSITION_ID, and then you can find the first order with that POSITION_ID, and check the Stop Loss of this order (HistoryOrderGetDouble(ticket, ORDER_SL). It worked for me, but
.the problem is when you modify that Stop Loss later.
then check DEAL_ENTRY, if OUT, get HystoryDealGetDouble(ticket,DEAL_PRICE).
If DEAL_PRICE equal to HistoryOrderGetDouble(ticket,ORDER_SL), then it means that the Order has been close due to stop loss.
Here's my opninion.
Ok understood now, you are right.
If DEAL_PRICE equal to HistoryOrderGetDouble(ticket,ORDER_SL), then it means that the Order has been close due to stop loss.
And then, check ORDER_POSITION_ID equal to DEAL_POSITION_ID,
then check DEAL_ENTRY, if OUT, get HystoryDealGetDouble(ticket,DEAL_PRICE).
If DEAL_PRICE equal to HistoryOrderGetDouble(ticket,ORDER_SL), then it means that the Order has been close due to stop loss.
Here's my opninion.
What about slippage?
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.