Download MetaTrader 5

Experts: Close by Equity Percent

To add comments, please log in or register
Sign up to publish an article and receive 200 USD
Automated-Trading 2015.02.13 16:03 

Close by Equity Percent:

The Expert Advisor closes all positions if equity exceeds specified percent from balance.

Author: adam malik kasang

Luc Levesque
Luc Levesque 2015.04.04 11:53  

Thank you for sharing!

Could you make one that would close in % profit by symbol?

lenanapeak 2015.07.27 12:12  
Luc Levesque:

Thank you for sharing!

Could you make one that would close in % profit by symbol?


Close by Equity Percent:

Author: adam malik kasang

Hi Adam

Thanks for sharing your EA. I've given it a test and it appears to only close out profits and ignores losses.

So in essence you are cutting your winners and letting losers run! I was looking for something that would do the opposite instead.

I took the liberty of looking at your code (am not a programmer - my knowledge is basic) and edited the following lines to achieve this

as follows:

extern double equity_percent_from_balances=0.8;   (i.e. setting default close all at 20% - tip: 5% close all would be set at 0.95,etc)


Note the < sign and the extra parenthesis to help reverse the original logic.

Finally I attached the EA to a currency pair chart that I would not normally trade. I did this because I noticed that if

attached to a pair that one trades, then it draws arrows on the chart when executed which leaves a messy chart.

Anyway thank you once again for the code, you've helped me achieve something I have been trying to get done for a long time.


samarshi 2016.03.08 00:06  

Hi Adam,

Thanks for sharing your EA.

Can you please change this for Dollar amount instead for Equity percent ie if the total profits of all symbols exceeds so many dollars, all the positions be closed.

With the Equity % change, a minor change in the percentage will cause the dollar amount change very different. 

I don't know any thing about programming and no knowledge of computers, so please let me know what can you do for me? 

 Thank you in advance.


To add comments, please log in or register