Please find the attached EA.
I modified the original version of EquityManagerV2 by Don Perry and Gene Katsuro.
This will (should) automatically close all trades when your balance shows a gain of X percent.
I'm not a coder, feedback is appreciated, please make any corrections as necessary.
Just open another chart and attach the EA.
There was a bug in calculating percent! It must be difference between equity and balance, before dividing it by balance and multiplying with 100.
Would it be possible to change the above EA to close only the open orders and leave the pending orders?
Thanks in advance
Simple Basket Close EA (utility)
This utility EA simply closes all existing positions & pending orders
when floating p/l has reached specific percentage of your account (Balance, Freemargin or Equity, selectable).
I have not tested well if it works correctly, but I think it will.
Maybe you should test this on demo account.
how to use :
Just apply this on any chart.
Set Account Mode and TP & SL level you want.
*Function is off at default setting.
So turn it on when you use it.
Latest version is available here in this thread. So I deleted old version.
I also posted another utility EA here.
This utility EA places Stoploss & TakeProfit automatically if there are positions without them.
Maybe this is a tool for lazy manual traders.
If you are interested, have a look.
Here is an another Equity Manager.
Most Martingale or Grid systems only close positions with profit and leave losing positions.
Account balance keep increasing regardless of real profit / loss and it's meaningless to observe it.
This Equity Manager observes only Equity and close all existing positions and pending orders when it reaches specified profit or loss.
Profit and loss can be defined by an amount of money (for example $1000) or percentage.
Once everything is closed, initial equity will be reset to current equity and keep continue.
how to use:
Attach this on any chart.
Input initial (current) equity before you start systems.
Choose target method (money or percentage) and input profit / loss closing level.
Then, run systems.
*This utility has an "Emergency Stop" funcition also.
It's like an "abort" button.
If you turn it on, this utility close everything and keep closing even if the system is trying to open new orders.
This works for a system that uses pending orders, but it will generate many spread losses for a system that uses instant entry.
So you must be careful when you use this function.
Great EA. Is it possible for the initial equity to automatically change as the profit increases. That way the equity stop will trail profits.
I Figured It Out
I figured it out. I'll just decrease my equity target and everything will reset.
Trailing Equity may be a good idea to add.
I may update in the future.
For the present, you can trail manually by moving up Equity Stop.
If you change it to zero when current equity is floating with profit, equity stop become breakeven.
If you change it to minus value, equity stop moves above initial equity (some profit will be locked up).
Here is updated version of 2 Equity Managers.
Simple Basket Close v2:
Trailing P/L is added.
Emergency stop is added.
Clock is added.
Trailing P/L starts trailing when specified P/L (percentage) is reached.
You can specify trail start level and trailing width.
Account Balance (Freemargin, Equity) 10000 / Trail Start 5% / Trail Width 2%
When current P/L exceeds 5%(500), EA starts trailing by 2%(200) width.
*when you use Freemargin or Equity, trail width is not fixed, because Freemargin and Equity itself are changing.
Equity Manager for Martingale Lover v2:
Trailing Equity is added.
Trailing Equity starts trailing when specified Equity (an amount of money or percentage) is reached.
Initial Equity 10000 / Trail Start 500 / Trail Width 200
When current Equity exceeds 10500, EA starts trailing by 200 width (start from 10300).
Problem and Solution:
1) Trailing P/L & Trailing Equity
Of course these trailing functions don't use physical stop, so there is a problem.
These EAs observe momentary maximum P/L or Equity and start trailing when it exceeds specified value.
If you quit MT4 or reset EA (for example when you change settings), EA forget maximum P/L or Equity and current stop level.
So, you have to run MT4 24/7 to make it work fully automatically.
But you will need shut down PC sometimes.
One solution for this is to input stop level manually before you quit.
(But It must be reset manually to as it was after EA has reset everything by TP or SL.)
2) update Initial Equity
For Equity Manager for ML, EA forget Initial Equity that has been reset (I mean after TP or SL) also.
If Equity Manager has not reset everything yet, it causes no problem.
But after Equity Manager has reset everything, Initial Equity must be updated manually before you quit, or EA will forget it.
Once it is updated, EA doesn't forget it (its setting remains).
1) If you input trail start level less than zero, EA starts trailing immediately.
2) As I wrote at previous post, you can move stop level to breakeven or lock up some profit manually.
3) You can turn off trailing if you don't need it. (so I will delete old versions later.)
I'me new here.Can anyone show me how to attach the EA to forward test it?I just can't get the smiley face.if the EA got involve indicators,must the chart also display the indicator required?I'm interested to learn how to write EA as well,can provide some information any website I can learn?Thanks so much in advance.I do hope to be able to contribute an EA in the near future.