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
I am wondering how to figure out the close price and time, when a position was closed by its corresponding stop loss.
MT5-Result
Like the above but instead of loop on all history only on HistorySelectByPosition
SELECT_BY_TICKET.
SELECT_BY_TICKET.
but loop on all history
but loop on all history
Because this example is for SELECT_BY_POS.
Because this example is for SELECT_BY_POS.
The OP wanted an sl from position.
Forum on trading, automated trading systems and testing trading strategies
How to figure out the close price when position ran into stop loss?
Doerk Hilger, 2018.07.10 08:50
Script for this situation (screenshot)
Thanks guys for your input. The "ran into SL" was only a sample, I needed the profit of a position no matter how it was closed. The solution is now like this and kind of universal for either positions or deals, written for my own needs. One can use it and modify it.
The function returns any numeric information of a closed trade, such as the time, price, profit, swap and commission, no matter how many deals were involved. One may either pass the position ticket or deal ticket,