Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

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

author EAcpu | 3 reads | 0 comments |

Trend Me Leave Me - expert for MetaTrader 5

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

Trend Me Leave Me - expert for MetaTrader 5


Attachment download

📎 trend_me_leave_me.mq5 (42.05 KB)

Source: MQL5 #19951

Verification code Refresh