Stop Loss and Take Profit - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources
If the trade is closed via Stop Loss, the trade volume is doubled; if the trade is closed via Take Profit, the minimum trade volume is used. OnTradeTransaction is used to determine whether a trade is executed after Stop Loss or Take Profit is activated.
Added excellent enumeration ENUM_DEAL_REASON build 1625 :
Can be viewed in OnTradeTransaction.
In other words, this is a very simple and reliable way to determine whether a trade is Take Profit or Stop Loss.
Currently (version 1626), this Expert Advisor can only be checked in live testing - by starting it on a chart or in debug mode (F5 in MetaEditor) with real data. I used the following bypass strategy:
In OnTradeTransaction we determine whether TakeProfit or StopLoss is triggered:
Attachment download
📎 stop_loss_take_profit.mq5 (20.64 KB)
Source: MQL5 #18755
Stop Loss and Take Profit - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resource Usage and Screening Suggestions
This content can be used as a data entry for foreign exchange EA, indicators, trading systems or quantitative strategies. When reading, it is recommended to make a judgment based on the platform version, trading type, time period, risk control method and historical discussion background. Do not use it directly based on the title or a single point of view.
If the content involves MT4/MT5, ForexFactory, MQL source code, TradingView indicators or strategy discussions, you can give priority to the parameter logic, backtest environment, market stage, execution cost and failure conditions, and then decide whether to continue downloading, reviewing or secondary development.
Risk warning
For any EA, indicator or automatic trading strategy, it is recommended to first conduct historical backtesting, simulation account verification and small capital testing. Grid, Martin, high frequency, recovery and examination strategies especially require setting the account risk upper limit, single variety risk upper limit and manual deactivation conditions.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •