If your order was closed by StopLoss or TakeProfit the order comment will be updated by your broker to start with "sl:..." or "tp:...". If your order was closed because your minimum margin level was reached (margin call) the order comment will be updated by your broker to start with "so:..." which means "stop-out". If the order comment of a closed order is unchanged or empty the order was closed manually, most probably by yourself. So you have to check OrderComment().
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
There are several reasons why an order was closed:
Unknown = -1,
Expiration = 0,
Market = 1,
TakeProfit = 2,
StopLoss = 3,
Risk = 4
In MQL 4, how does one determine why an order was closed?
How does one determine if an order was closed by Market, Stoploss or TakeProfit?