Experts: Close by Equity Percent

 

Close by Equity Percent:

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

Author: adam malik kasang

 

Thank you for sharing!

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

 
Luc Levesque:

Thank you for sharing!

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

Automated-Trading:

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)

if(AccountEquity()<(AccountBalance()*equity_percent_from_balances)) 

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.


lenanapeak

 

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.

 samarshi

rarshi@yahoo.com 

 

1.2 = 20%, does this mean if $100 balance, it's closing trades at $120 or $20 balance?

Reason: