Trend Me Leave Me - MetaTrader 5 Expert - MT4/MT5 Resources

Author of the idea : screenwriter , author of the MQL5 code : Balabashka Kon .
The Expert Advisor is valid for one position (can be used on netting accounts). The direction of the new opening signal is calculated based on the direction of the last position closing (buy or sell) and the method of closing the position (via stop loss or take profit).
General principles:
The closing type is determined using ENUM_DEAL_REASON in OnTradeTransaction(): First access the transaction and its type in OnTradeTransaction():
, and then check the DEAL_REASON attribute.
If the breakeven parameter is not equal to zero, the position will be moved to breakeven if possible.
After determining the direction in OnTradeTransaction(), check further conditions:
Default parameters, 2017.01.08 to 2018.02.05 EURUSD,M30

Attachment download
📎 trend_me_leave_me.mq5 (42.05 KB)
Source: MQL5 #19951
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •