Account Protector

Thanks for the thorough reply 🙂

I wasn't clear at the start - I intend to be trading manually, no other EAs, I'm just looking for something to control my impulses and prevent my over-trading etc from destroying my otherwise good results.

Is this suitable for that, or I have misunderstood initially?
Unfortunately, it's not too good for controlling manual trading. There is the 'Close platform' action, but nothing prevents you from opening it again.
 
Hi friends, I'd like to test a new setup. I operate prop firm and input the drawdown value into the EA. However, I need to log in every day and reset the stop loss. I make long trades and would like to know if it's possible to input a fixed value into the EA. For example, I open a portfolio in my account of 5,000 and it rises to 5,300. If my account returns to 5,200, the EA closes all trades. Is this possible?
 
Hi friends, I'd like to test a new setup. I operate prop firm and input the drawdown value into the EA. However, I need to log in every day and reset the stop loss. I make long trades and would like to know if it's possible to input a fixed value into the EA. For example, I open a portfolio in my account of 5,000 and it rises to 5,300. If my account returns to 5,200, the EA closes all trades. Is this possible?
If I understand you correctly, you can achieve that by using the equity trailing stop feature. If you set it to 100, it will be trailing continuously exactly $100 below you maximum equity.
 
I have a suggestion to add to the EA. I am a grid trader, and I layer more as price retraces, meaning I have many orders in my account. For example, my total grid adds up to 1 lot. For example, I want to close 50% of my entries, which would be 0.50 lots, depending on the condition that I want to set below:
1) price reaches a certain price level without having to put the SL. So I just need to put in a price level at 3150 in the platform and mark it as true, 0.50 lots of the closer entries to the open price will be closed.
2) a fixed number of points achieved from the lowest entry point. Example, I would set 500 points as my target to close 50% of my buy layers which are between 3000 - 3003 and when price reaches 3005, 0.50 lots nearer to the open price would be closed.
Is it possible to add these functions? I believe it would benefit grid traders a lot. Thanks!!
 
1) price reaches a certain price level without having to put the SL. So I just need to put in a price level at 3150 in the platform and mark it as true, 0.50 lots of the closer entries to the open price will be closed.
You can already do this with the Account Protector.
2) a fixed number of points achieved from the lowest entry point. Example, I would set 500 points as my target to close 50% of my buy layers which are between 3000 - 3003 and when price reaches 3005, 0.50 lots nearer to the open price would be closed.
This can also already be done (mostly). You cannot set the price boundaries to pick which positions will be closed, you can only select between distant or closest and most profitable or most losing.
 
You can already do this with the Account Protector.

This can also already be done (mostly). You cannot set the price boundaries to pick which positions will be closed, you can only select between distant or closest and most profitable or most losing.
1) Ok, I have found the setting to it.

2) As I have tried before, let's say I put 0.02 per entry, totaling to 1 lot, closing 50% closes partial of each of the 0.02 which is 0.01. It means that I will still have 0.01 entries all the way up to 3003. What I want is to do is to clear 50% of all the higher or lower entry points and leave my sharpest entries untouched. Is it possible? My understanding from your reply is that it is not possible unless there is a setting that I do not know of. ? I just want to confirm.

Hope this clears up my understanding of how I want to use this EA efficiently based on my trading style. Hopefully, this could be somewhat of an idea as an additional function in the EA. I believe it benefits grid traders a lot once this function is added to the EA.
 
2) As I have tried before, let's say I put 0.02 per entry, totaling to 1 lot, closing 50% closes partial of each of the 0.02 which is 0.01. It means that I will still have 0.01 entries all the way up to 3003. What I want is to do is to clear 50% of all the higher or lower entry points and leave my sharpest entries untouched. Is it possible? My understanding from your reply is that it is not possible unless there is a setting that I do not know of. ? I just want to confirm.
If you set UseTotalVolume input parameter to true, and use sorting Most distant trades first. And, of course, set 50% for Close on the Actions tab.
 
Account Protector is triggered right away when I enable Algo Trading even if I have not opened a trade for the last 2 days. I want to trigger when I have lost 2000 in a single day whether equity or balance. How can I achieve this and why it happens?
 

Attachments

  • Capture d’écran, le 2025-09-18 à 16.53.50.png
    Capture d’écran, le 2025-09-18 à 16.53.50.png
    526.3 KB · Views: 2
Account Protector is triggered right away when I enable Algo Trading even if I have not opened a trade for the last 2 days. I want to trigger when I have lost 2000 in a single day whether equity or balance. How can I achieve this and why it happens?
It would help to see the screenshot of the History tab for this account.
 
I'm using Version 5.00 build 5200 1 Aug 2025
Post automatically merged:

Strangely, I cannot reproduce this (tried on two brokers - RoboForex and Pepperstone). Which build of MT5 are you using?
I'm using Version 5.00 build 5200 1 Aug 2025
 
Hey, love the EA! Been using it for a few months and its been flawless. In the last few days, my MT5 instances keep spamming this log:
"2025.10.22 21:46:37.552 Account Protector (BTCUSD,M1) Account Protector: PositionClose Buy failed. Error #4756"

I remove and reset the EA and then it seems fine. Then I check a few hours later or a day later and it does it again.

Does anyone know what this might be and how to prevent it please? Thanks in advance!
 
Hey, love the EA! Been using it for a few months and its been flawless. In the last few days, my MT5 instances keep spamming this log:
"2025.10.22 21:46:37.552 Account Protector (BTCUSD,M1) Account Protector: PositionClose Buy failed. Error #4756"

I remove and reset the EA and then it seems fine. Then I check a few hours later or a day later and it does it again.

Does anyone know what this might be and how to prevent it please? Thanks in advance!
Do you have a buy position opened when this happens?
What does it say in the Journal tab log?
Are there any messages about the Account Protector's condition triggering prior to those error messages?
 
Do you have a buy position opened when this happens?
What does it say in the Journal tab log?
Are there any messages about the Account Protector's condition triggering prior to those error messages?
No there are no positions open when this happens. But I never see it at the time the error occurs, it's just every now and then when I check the VPS I notice that this is spamming in the experts tab every second. Here is a screenshot of right now:

Screenshot 2025-10-24 at 09.53.42.png

The journal tab also spams with this: 2025.10.24 09:55:20.109 Trades '52549729': failed request sell 0 at 111134.68000 [Invalid request]
Screenshot:
Screenshot 2025-10-24 at 09.55.59.png

Interestingly the experts tab says buy failed, and the journal tab says failed request sell.
I can't see any messages before I get the spam because the spam is so much you can't scroll higher on the expert or journal tab. I went into the MT5 terminal folder and checked todays log file, here is the logs prior to the spam:
Screenshot 2025-10-24 at 10.01.15.png
That's all of the information I can find. Any reason why this might be happening or how to prevent it?
Thanks for getting back to me, really appreciate it!
 
No there are no positions open when this happens. But I never see it at the time the error occurs, it's just every now and then when I check the VPS I notice that this is spamming in the experts tab every second. Here is a screenshot of right now:

View attachment 34811

The journal tab also spams with this: 2025.10.24 09:55:20.109 Trades '52549729': failed request sell 0 at 111134.68000 [Invalid request]
Screenshot:
View attachment 34812

Interestingly the experts tab says buy failed, and the journal tab says failed request sell.
I can't see any messages before I get the spam because the spam is so much you can't scroll higher on the expert or journal tab. I went into the MT5 terminal folder and checked todays log file, here is the logs prior to the spam:
View attachment 34813
That's all of the information I can find. Any reason why this might be happening or how to prevent it?
Thanks for getting back to me, really appreciate it!
Is your MT5 account netting or hedging?
It doesn't seem like the attached screenshot from 20251024.log corresponds to the screenshots you provided above.
You can view logs for any date and time by right-clicking inside the Experts tab and selecting Viewer. You can then request logs for any period using the dates in the top-right corner of the window.
Also, by default, the Account Protector logs its action and status to the file 'ap_log.txt' in your \MQL5\Files\ folder. You can look up the relevant notifications there.
 
Is your MT5 account netting or hedging?
It doesn't seem like the attached screenshot from 20251024.log corresponds to the screenshots you provided above.
You can view logs for any date and time by right-clicking inside the Experts tab and selecting Viewer. You can then request logs for any period using the dates in the top-right corner of the window.
Also, by default, the Account Protector logs its action and status to the file 'ap_log.txt' in your \MQL5\Files\ folder. You can look up the relevant notifications there.
I am guessing it's a hedging account, I've not heard of netting before. Is there a way I can check to let you know?
The screenshots are all from the same account, so not sure why they don't correspond or what to look out for sorry!
It's currently spamming again right now. Here is the viewer from the Experts tab from when the AP EA had the conditions meet, to closing positions, to then getting stuck in this error which is now spamming for pages down:
Screenshot 2025-10-24 at 17.50.29.png

And here is the journal viewer for the same period:Screenshot 2025-10-24 at 17.56.43.png

And here is the same time stamp for the terminal log file:
Screenshot 2025-10-24 at 17.59.24.png

The AP log file just shows that error spam, I can't see any other lines in the file. I was trying to attach it to show you but it's currenlty at 456MB lol, so I can't copy it here.

Not sure what's causing it or how to avoid it happening, so I really don't know what to do next to stop the spam. Any more thoughts with all the screenshots/files above? Thanks for getting back to me so quickly! Let me know if there is any other information I can share with you or if you want to jump on a zoom call to chat and I can show you the terminal as it's happening.
 
I am guessing it's a hedging account, I've not heard of netting before. Is there a way I can check to let you know?
You can tell whether it's netting or hedging by looking at the terminal's window caption:
1761327991457.png

It looks like you are running another EA in your account (fxmon_7.5). And it looks like it is also closing some trades. Could it be that it closes them just before the AP starts closing them?