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

Trailing_Profit - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 6 reads | 0 comments |

The author of the ideaVitaly , the author of the MQL5 codeBalabashka Kon .

The Expert Advisor manages all open positions in the terminal (all symbols and all magic numbers). If the total profit does not reach the " minimum profit ", the EA waits.

If the total profit reaches " Minimum Profit " , the EA sets the profit retracement percentage and enables tracking.

The " Profit Percent " parameter is specified as a percentage. For example, " Minimum Profit " = 1000 and " Profit Percent " 20. The total profit of all open positions has reached 1000. If the profit falls to 800 (1000 - 20%), the position will be closed. If profits continue to grow, for example reaching 2000, the allowed drawdown will be equal to 400 (2000 - 20%). That is, all positions will be closed with a total profit of 1600. There is no fixed drawdown limit as I don't think using absolute values ​​is useful.

In theory, it is possible to set percentage = 0. It will act as a total take profit. You can set percentage = 100 and it will act as breakeven (don't forget that because some orders are closing, other orders may lose money).

attention! Expert Advisor with 3 second interval:

 Blank check ()
  { //--- Allow to work on a static datetime every three seconds Previous time = 0 ;
Date time current time = time current (); if (current time - previous time < 3 ) return ;
  Previous time = current time; //---



Attachment download

📎 trailing_profit.mq5 (12.41 KB)

Source: MQL5 #18709

Verification code Refresh