Jeff_Al

Trader
Apr 23, 2021
3
0
6
48
Hi Enivid,

Firstly, thank you for this great EA! I am still trying to get my head around all the features. Anyway I think this might be the EA I've been searching the web endlessly for lol.

I have a couple of questions if you could kindly assist me with.

To make it simplistic, I am looking specifically to trail my complete account (incl. all open and pending orders)
Now I am not sure how to set this up with AP unless by trial and error.

The following example:

Equity is $10000
Close all and disable autotrading when 25% of equity is reached
Trail from 15% in 0.5% intervals and lock in 10% at TS start
Close all and disable autotrading if SL of entire account 20% is hit (so at $8000)
Re enable autotrading the next day if either TP, TSL or SL is hit

I hope I explained it clearly and thanks in advance for your help.
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
Close all and disable autotrading when 25% of equity is reached
This is possible. Equity => % of snapshot - set to 125.
Trail from 15% in 0.5% intervals and lock in 10% at TS start
Trailing stop is possible only in USD and it is plain, which means that it kicks in immediately and tracks down to a cent. It is also monitored only by the EA - it doesn't modify the actual SL values of the positions.
Close all and disable autotrading if SL of entire account 20% is hit (so at $8000)
This is also possible. Equity <= % of snapshot - set to 80.
Re enable autotrading the next day if either TP, TSL or SL is hit
Not entirely possible. The best you can do is to set up another AP in another chart and configure it to enable Autotrading on a specific time. It won't know if any TP/TSL/SL were hit.
 

Jeff_Al

Trader
Apr 23, 2021
3
0
6
48
Great thanks. I am clear on all except the trailing stop.

On the Main tab what values should I enter and which option should I activate?
The equity trailing stop (hidden) I have entered 11500

If I say each pip is worth 10$, then Profit value to move sl to BE I set at 150
and BE extra profit to 100

Profit value to start trailing to 150
Trailing SL value to 5

Is this correct?
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
The equity trailing stop (hidden) I have entered 11500
Equity trailing stop is account-wide and you set it to the amount of USD you want to trail. E.g., if your want your stop-loss to be $500 below your current equity, you enter 500.
If I say each pip is worth 10$, then Profit value to move sl to BE I set at 150
and BE extra profit to 100
This works separately for each position. So, if a trade reaches 150 pips of profit, its SL will be moved to BE. If you set BE extra profit to 100, the SL will be moved not to BE but to BE + 100 pips.
Profit value to start trailing to 150
Trailing SL value to 5
This will also be a TSL on per-position basis. Once a trade's profit reaches 150 pips, it will start to trail its SL at 5 pips away from the current price.

It's up to you to decide what's right for you.
 

Maurizio77

Trader
May 3, 2021
3
0
6
44
Hi Enivid, in the "Action" section I chose to close the platform, but now I can not open it, I have to wait for the new day to open it (let's say that the platform opens and then closes immediately).... I think it's a cause of protection so as not to trade right??
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
Hi Enivid, in the "Action" section I chose to close the platform, but now I can not open it, I have to wait for the new day to open it (let's say that the platform opens and then closes immediately).... I think it's a cause of protection so as not to trade right??
That's caused by the condition for "Close the platform" action triggering when you launch the platform. You can delete the text file "AP_xxxxxxxxxxxxx" (where xxxxxxxxxxxxx is your chart's ID) from /MQL4/Files/. It will reset the Account Protector.
 
  • Like
Reactions: Maurizio77

Maurizio77

Trader
May 3, 2021
3
0
6
44
That's caused by the condition for "Close the platform" action triggering when you launch the platform. You can delete the text file "AP_xxxxxxxxxxxxx" (where xxxxxxxxxxxxx is your chart's ID) from /MQL4/Files/. It will reset the Account Protector.
Thank you, is there a problem how do I get to the "File" folder? The mt5 opens and then closes very quickly ... It's impossible.... oh is there another method that I don't know?
 

abmfcs

Trader
May 6, 2021
9
2
9
37
Hello Enivid. Thank you very much for creating such an amazing EA and offering it to everyone for free. This is probably the most valuable tool for any robot trader.

I have two questions:
1. I am simply looking to put a stop on drawdown regardless of the base equity. For example, as soon as DD reaches $1000, I want the EA to close all trades and disable auto trading. I am assuming this can be achieved through "floating loss rises to currency units" condition but kindly confirm.

2. Second and most important: Is there a mechanism built in the EA to ensure that all positions are closed FOR SURE once a trigger is hit? My trading EA can open upto 200 positions on multiple charts and I want to make sure that all of them are closed as soon as the trigger is hit. I was trying a similar EA on a demo account and it left few positions open that resulted in losses beyond the tolerance. If this functionality is not there, may be you can consider adding it? (for example adding a loop to keep closing all trades until the count is 0).

Really appreciate your help on this.

Regards.
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
1. I am simply looking to put a stop on drawdown regardless of the base equity. For example, as soon as DD reaches $1000, I want the EA to close all trades and disable auto trading. I am assuming this can be achieved through "floating loss rises to currency units" condition but kindly confirm.
Exactly!
2. Second and most important: Is there a mechanism built in the EA to ensure that all positions are closed FOR SURE once a trigger is hit? My trading EA can open upto 200 positions on multiple charts and I want to make sure that all of them are closed as soon as the trigger is hit. I was trying a similar EA on a demo account and it left few positions open that resulted in losses beyond the tolerance. If this functionality is not there, may be you can consider adding it? (for example adding a loop to keep closing all trades until the count is 0).
Account Protector makes sure to close all orders. However, there are certain situations when it can leave some orders open:
1. It failed to close some orders due to some temporary reason, but couldn't retry closing because "Disable Autotrading" action was set and triggered.
2. It closed all trades, saw that there are zero open trades, and called that a day. But then your other EAs opened new trades. AP won't be closing those new trades once it saw that there are zero trades.
 

abmfcs

Trader
May 6, 2021
9
2
9
37
Exactly!

Account Protector makes sure to close all orders. However, there are certain situations when it can leave some orders open:
1. It failed to close some orders due to some temporary reason, but couldn't retry closing because "Disable Autotrading" action was set and triggered.
2. It closed all trades, saw that there are zero open trades, and called that a day. But then your other EAs opened new trades. AP won't be closing those new trades once it saw that there are zero trades.

Thank you Enivid. Really appreciate you taking the time to respond.

Do you think there may be a way to address this issue? I could think of a few ways, kindly share your thoughts in terms of which setup is likely to achieve our objective:

1. Open two instances of MT4 with the same account. On first, setup all the charts with the trading EA as well as AP. On the other setup only one chart with AP with the same stop value as the other. Both instances of AP are set to stop auto-trading as well. If we can have two EAs working to close the order we have better shot at closing all the orders.

2. Essentially the same as above, but the second instance will not disable auto-trading. This may let the second AP continue running until all trades are closed while the first AP stops the trading EA from opening new trades. This options seems most likely to succeed. What do you think of this as you know the code and are in better position to tell whether the second AP will detect any residual trades and continue attempting to close them as the auto-trading is still enabled for the second one.

3. A less ideal option would be to close the largest trades first as the DD / P&L would be most sensitive to these. Is there a way to make this happen?

Sorry for bugging you with multiple questions and couldn't appreciate your help enough. I am actually attempting to pass FTMO trial and they have strict rules on max DD. If any of the large trades are left open in the end, that would fail the test by exceeding the DD limit.

Again appreciate your suggestions on this.
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
2. Essentially the same as above, but the second instance will not disable auto-trading. This may let the second AP continue running until all trades are closed while the first AP stops the trading EA from opening new trades. This options seems most likely to succeed. What do you think of this as you know the code and are in better position to tell whether the second AP will detect any residual trades and continue attempting to close them as the auto-trading is still enabled for the second one.
In theory, this should work. However, I have never tried to run two APs from two MT4 instances.
3. A less ideal option would be to close the largest trades first as the DD / P&L would be most sensitive to these. Is there a way to make this happen?
That would slow down the closing process as it would require going through all the orders, sorting them, and then going through them again. With 200 orders, this delay will be significant.
 

abmfcs

Trader
May 6, 2021
9
2
9
37
In theory, this should work. However, I have never tried to run two APs from two MT4 instances.

That would slow down the closing process as it would require going through all the orders, sorting them, and then going through them again. With 200 orders, this delay will be significant.
Thanks Enivid. For the two AP option, is the EA coded in such a way that if auto-trading stays enabled, it will continue to try and close any residual trades until it reaches a count of zero?
 

abmfcs

Trader
May 6, 2021
9
2
9
37
In theory, this should work. However, I have never tried to run two APs from two MT4 instances.

That would slow down the closing process as it would require going through all the orders, sorting them, and then going through them again. With 200 orders, this delay will be significant.
Also, does the slippage input value have anything to do with whether the EA is able to close all the trades or not?
 

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
Thanks Enivid. For the two AP option, is the EA coded in such a way that if auto-trading stays enabled, it will continue to try and close any residual trades until it reaches a count of zero?
Yes, it will try to close all orders until there is not a single one left.
Also, does the slippage input value have anything to do with whether the EA is able to close all the trades or not?
It affects the speed of closing because a request to close will be cancelled if the slippage exceeds the given deviation parameter. But if you use the two APs scheme, it won't prevent all the orders from closing eventually.
 

abmfcs

Trader
May 6, 2021
9
2
9
37
Yes, it will try to close all orders until there is not a single one left.

It affects the speed of closing because a request to close will be cancelled if the slippage exceeds the given deviation parameter. But if you use the two APs scheme, it won't prevent all the orders from closing eventually.
Thanks Enivid.

So I decided to give the setup a try. Posting here so other traders may benefit from it. This setup seems to be achieving the desired outcome (at least in demo), i.e., close all open trades for sure as soon as DD hits the target value.

1. Setup my trading robot along with account protector EA in first instance of MT4. I have 16 charts open in this instance of MT4 (14 trading, 1 for AP, 1 for myfxbook uploader EA). AP is set to close all trades and DISABLE auto-trading.

2. Setup another instance of MT4 with the same account. On this one I have 3 equity protection EAs on 3 separate charts including 1 with AP and two other similar EAs. All of these EA are set to close all open trades / pending orders but keep auto-trading ENABLED.

I have around 13 of these accounts running (26 MT4 instances) just to try out how the stopping works. Since yesterday, I have had around 10 - 12 cases where the DD level was reached and all trades were closed successfully. I will continue testing for the rest of the week after which I will move to testing my actual trading strategy on FTMO demos.

I must say that my VPS is really struggling but that is justified as I am currently running 30 MT4 instances with half of them running 14-16 charts and ~100 trades each most of the time.

@Enivid - thanks again for creating such awesome EA and then making it available publicly at no cost.
 
  • Like
Reactions: Enivid

cdhamo

Newbie
Feb 25, 2021
12
0
2
42
Hi Enivid.

Can you please recommend an example setting/value that I can place to reduce the chances of losing my gained profit, due to retracement? I've attached an example of sell trades executed, then a candle reversing in the opposite direction.

Many thanks.
 

Attachments

Enivid

Administrator
Staff member
Nov 30, 2008
15,904
791
144
Odessa
www.earnforex.com
Hi Enivid.

Can you please recommend an example setting/value that I can place to reduce the chances of losing my gained profit, due to retracement? I've attached an example of sell trades executed, then a candle reversing in the opposite direction.

Many thanks.
You need to use a trailing stop there if you want to protect some of the profit from unexpected retracements. You should determine the number of pips optimal for your situation.