RAQ

Build an EA That Runs Different Exit Strategies Depending on the Profit Level

 

Q: Can I build an EA that runs different exit strategies depending on the profit level?

A: Yes. Attached is a simple Exit-Only MT4 Expert Advisor that runs a different stop depending on the amount of profit.  This EA does not oen trades.  It’s just used to manage trades that have beeen opened manually or by another EA.

  • At a profit of $50, the stop is move to break even
  • At a profit of  $75 – $100, the Chandelier exit is run
  • At a profit of greater than $100, the ATR exit is run

The fnGetOrderInfo function is used to get the total profit:

The InfoType paramter is set to INFO_PROFIT to get the profit of the trade with a matching Magic Number:

The Exit functions are from the Profit Exit Plug-in. You can easily add more Logic Elements to run different stops at differernt profit levels.

One tricky part for this particular EA, is to use the Power tab to configure the Move-to-Breakeven (In Logic2) to execute one time only. We do this by setting the “Maximum allowed TRUE count” to “Once per run”:

Click here to download the VTS system and the MQL for the MultiExit MT4 Expert Advisor.

 

 

To get notified about the latest questions and answers, follow us!