nammen97

Trader
Jan 14, 2024
7
0
7
27
hi there . Can you help me slove this problem ? . I cant complile file . I copy this folder ( account protect ) to MQL5/Expert then i compile file name : Account protect.mq5 but it seen error1705240550994.png1705240570488.png
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
hi there . Can you help me slove this problem ? . I cant complile file . I copy this folder ( account protect ) to MQL5/Expert then i compile file name : Account protect.mq5 but it seen errorView attachment 26840View attachment 26841
Your MT5 is missing the standard MQL5 libraries. Try re-installing or copying them over from another MT5 installation. They should be in MQL5\Include\.
 

Resems

Newbie
Jan 18, 2024
3
0
1
36
Hello, thank you for such a great expert, it is truly impressive.

I do have a question about logging ( because it clutters the logs ) and specifically how to stop logging every second.
The setup is
1 AP is used to close all profits and disable the auto trading once the daily profit has been hit - works perfectly
2 AP is used to enable the auto trading once the timer is hit - works perfectly

Both AP have do not turn off the conditions/filters/actions etc.

The "issue", not a big deal, but it consistently logs ACTION IS TAKEN: Close positions (100.00% of All).

I could change the code and check on log action if the auto trading is disable, do not log anything, not sure if it is the best approach though.

So I was wondering if there is a better solution.

Thank you.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
Hello, thank you for such a great expert, it is truly impressive.

I do have a question about logging ( because it clutters the logs ) and specifically how to stop logging every second.
The setup is
1 AP is used to close all profits and disable the auto trading once the daily profit has been hit - works perfectly
2 AP is used to enable the auto trading once the timer is hit - works perfectly

Both AP have do not turn off the conditions/filters/actions etc.

The "issue", not a big deal, but it consistently logs ACTION IS TAKEN: Close positions (100.00% of All).

I could change the code and check on log action if the auto trading is disable, do not log anything, not sure if it is the best approach though.

So I was wondering if there is a better solution.

Thank you.
That's the setup problem. The action is logged because it actually attempts to take it because the condition is triggered (the daily profit is above the given value). As a sort of a band-aid fix, you could comment out the specific logging line in the code (Account Protector.mqh):
MQL4:
Logging("ACTION IS TAKEN: Close positions (" + DoubleToString(sets.doubleClosePercentage, 2) + "% of " + EnumToString(sets.CloseWhichPositions) + ").");
But for normal solution, there isn't much I could think of here. You could try using the equity snapshot conditions rather than daily profit/loss. If you set both APs to use global equity snapshots and set the second AP (the timer one) to recapture snapshots, it could work similarly to the daily profit/loss.

I will probably change the Close action to check for the autotrading and only log the fact that it's disabled once and then start logging again when it's re-enabled. However, you should still be getting a flood of CONDITION IS MET: messages, shouldn't you? Do you only get the ACTION IS TAKEN: flood currently?
 

Resems

Newbie
Jan 18, 2024
3
0
1
36
I will probably change the Close action to check for the autotrading and only log the fact that it's disabled once and then start logging again when it's re-enabled. However, you should still be getting a flood of CONDITION IS MET: messages, shouldn't you? Do you only get the ACTION IS TAKEN: flood currently?

That's the setup problem. The action is logged because it actually attempts to take it because the condition is triggered (the daily profit is above the given value). As a sort of a band-aid fix, you could comment out the specific logging line in the code (Account Protector.mqh):
MQL4:
Logging("ACTION IS TAKEN: Close positions (" + DoubleToString(sets.doubleClosePercentage, 2) + "% of " + EnumToString(sets.CloseWhichPositions) + ").");
But for normal solution, there isn't much I could think of here. You could try using the equity snapshot conditions rather than daily profit/loss. If you set both APs to use global equity snapshots and set the second AP (the timer one) to recapture snapshots, it could work similarly to the daily profit/loss.

I will probably change the Close action to check for the autotrading and only log the fact that it's disabled once and then start logging again when it's re-enabled. However, you should still be getting a flood of CONDITION IS MET: messages, shouldn't you? Do you only get the ACTION IS TAKEN: flood currently?

There is multiple messages, because the Actions are : close all positions/disable auto trading/delete pending orders.
So every second it outputs 6 messages.

Code:
2024.01.18 21:44:26.247    Account Protector (XAUUSD,H1)    CONDITION IS MET: Daily profit/loss greater or equal to 1000.00 USD
2024.01.18 21:44:26.248    Account Protector (XAUUSD,H1)    Account Equity = 104093.37 USD, Account Free Margin = 104093.37 USD, Account Balance = 104093.37 USD
2024.01.18 21:44:26.248    Account Protector (XAUUSD,H1)    Floating profit (filtered) = 0.00 USD
2024.01.18 21:44:26.248    Account Protector (XAUUSD,H1)    Number of open positions (filtered) = 0, Number of pending orders (filtered) = 0, Current spread = 0.18
2024.01.18 21:44:26.248    Account Protector (XAUUSD,H1)    Current trading instrument Bid/Ask = 2023.14/2023.32
2024.01.18 21:44:26.271    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Close positions (100.00% of All).
2024.01.18 21:44:26.271    Account Protector (XAUUSD,H1)    AutoTrading disabled!
2024.01.18 21:44:26.271    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Delete all pending orders.
2024.01.18 21:44:26.271    Account Protector (XAUUSD,H1)    AutoTrading disabled!
2024.01.18 21:44:26.272    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Disable autotrading.
2024.01.18 21:44:26.969    Account Protector (XAUUSD,H1)    CONDITION IS MET: Daily profit/loss greater or equal to 1000.00 USD
2024.01.18 21:44:26.969    Account Protector (XAUUSD,H1)    Account Equity = 104093.37 USD, Account Free Margin = 104093.37 USD, Account Balance = 104093.37 USD
2024.01.18 21:44:26.969    Account Protector (XAUUSD,H1)    Floating profit (filtered) = 0.00 USD
2024.01.18 21:44:26.970    Account Protector (XAUUSD,H1)    Number of open positions (filtered) = 0, Number of pending orders (filtered) = 0, Current spread = 0.16
2024.01.18 21:44:26.970    Account Protector (XAUUSD,H1)    Current trading instrument Bid/Ask = 2023.14/2023.30
2024.01.18 21:44:27.003    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Close positions (100.00% of All).
2024.01.18 21:44:27.004    Account Protector (XAUUSD,H1)    AutoTrading disabled!
2024.01.18 21:44:27.004    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Delete all pending orders.
2024.01.18 21:44:27.004    Account Protector (XAUUSD,H1)    AutoTrading disabled!
2024.01.18 21:44:27.004    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Disable autotrading.
2024.01.18 22:00:22.233    Account Protector (XAUUSD,H1)    CONDITION IS MET: Daily profit/loss greater or equal to 1000.00 USD
2024.01.18 22:00:22.233    Account Protector (XAUUSD,H1)    Account Equity = 104093.37 USD, Account Free Margin = 104093.37 USD, Account Balance = 104093.37 USD
2024.01.18 22:00:22.233    Account Protector (XAUUSD,H1)    Floating profit (filtered) = 0.00 USD
2024.01.18 22:00:22.233    Account Protector (XAUUSD,H1)    Number of open positions (filtered) = 0, Number of pending orders (filtered) = 0, Current spread = 0.39
2024.01.18 22:00:22.234    Account Protector (XAUUSD,H1)    Current trading instrument Bid/Ask = 2022.88/2023.27
2024.01.18 22:00:22.263    Account Protector (XAUUSD,H1)    ACTION IS TAKEN: Close positions (100.00% of All).

This is a sample of the outputs.

I do understand why the AP is doing that.

I have currently two ideas,

make a flag EnableLogging=true/false
Or
Have the check that auto trading is enabled on all actions Except Enable Auto Trading ( which makes more sense to my case ).

Yea snapshots would be an idea, I will look into it as well, thank you !
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
Have the check that auto trading is enabled on all actions Except Enable Auto Trading ( which makes more sense to my case ).
The issue with the flood is not the actions, but the condition. I will consider adding some more specific bypass to avoid the condition from triggering in such particular cases as yours. I will also add a parameter to turn off logging completely. However, this won't be released soon.
 

Resems

Newbie
Jan 18, 2024
3
0
1
36
The issue with the flood is not the actions, but the condition. I will consider adding some more specific bypass to avoid the condition from triggering in such particular cases as yours. I will also add a parameter to turn off logging completely. However, this won't be released soon.
Yes, agree. I will keep an eye on the releases, thank you regardless. It is quite a life saver for now.
 

lwl99

Trader
Mar 18, 2022
6
1
12
25
Hi, is there a setfile available for prop firm daily drawdown with a snapshot from equity or balance whichever is higher at the start of day?
 

Joe Benz

Newbie
Jan 24, 2024
1
0
1
43
Germany
Hi,

I discovered the Account Protector and Position Sizer last week . This tools are really great and very helpful for improve my trading. Thanks a lot for providing them..for free!
I use the Position Sizer for control the lot size and amount of open positions. I used the Account Protector for max lost of the day.
Would it be possible to run both EAs, the Positions Sizer for execute trades (1m/5m chart) e.g. NASDAQ (first chart) and use the Account Protector for cancel all orders, if max loss is reached on another 1H Chart of NASDAQ (2. chart)?
That would be really amazing.

Greets to all traders
Jan
 

JPR

Newbie
Feb 3, 2024
2
0
1
23
Hi Guys, I'm trying to compile the mq4 file in metaeditor however I don't know how to compile it and save it. All I get is a mqh file. Is there perhaps anyone that could help out? :)
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
Hi Guys, I'm trying to compile the mq4 file in metaeditor however I don't know how to compile it and save it. All I get is a mqh file. Is there perhaps anyone that could help out? :)
If you don't know how to compile, you don't need to do it. Just follow the installation steps by copying the Account Protector folder from the archive to MQL4\Experts\ of your data folder. Then restart MT4. It should appear under Experts in the Navigator of your MT4.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
Tried to compile the MT4 Version, can't o pen, with 101 errors and 9 warnings
Usually that means one of the two things:
1. Either you are compiling the wrong file (not Account Protector.mq4).
2. Or you didn't copy the entire folder from the downloaded archive.

Please let me know if the problem persists after you check those two issues.
 

r3p4n

Newbie
Feb 26, 2024
3
0
1
54
First of all, I want to congratulate you for an amazing piece of software!

I am a bit puzzled with the following scenario. If I want to have the following conditions running at the same time:
- Daily profit >= currency units: 100.00
- Daily loss >= currency units: -100.00
So whichever is met first, it will run my Actions.

Can I do it with one copy of the EA, or do I need to attach it to 2 charts? One for the profit and one for the loss?
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,913
1,428
144
Odesa
www.earnforex.com
First of all, I want to congratulate you for an amazing piece of software!

I am a bit puzzled with the following scenario. If I want to have the following conditions running at the same time:
- Daily profit >= currency units: 100.00
- Daily loss >= currency units: -100.00
So whichever is met first, it will run my Actions.

Can I do it with one copy of the EA, or do I need to attach it to 2 charts? One for the profit and one for the loss?
You can do that with one instance of the EA. Your second condition should be Daily profit/loss <= currency units (-100).