Then, you will have to wait for this feature to be added in the future release of the Account Protector.i just compiled it and tested multiple times .. no change
Then, you will have to wait for this feature to be added in the future release of the Account Protector.i just compiled it and tested multiple times .. no change
Can you provide the code to change for mt4 also? ThanksYou can add the following two lines after the current line 3810 in AccountProtector.mqh:
Make sure to test on demo first.MQL5:DirectSorting = true; ArraySort(PositionsByProfit);
Try inserting this code between the current lines 3761 and 3762 in Account Protector.mqh:Can you provide the code to change for mt4 also? Thanks
ArraySort(PositionsByProfit, WHOLE_ARRAY, 0, MODE_ASCEND);
Thank youTry inserting this code between the current lines 3761 and 3762 in Account Protector.mqh:
MQL4:ArraySort(PositionsByProfit, WHOLE_ARRAY, 0, MODE_ASCEND);
You can use the balance change condition, but you'd need to reset it manually once it gets triggered.I love this EA and it's so close to exactly what I need however I am either missing something (very possible) or perhaps I am looking for a new condition to be added. What I am trying to do is close all open (market and pending) orders and disable auto trading if either of the following is true:
a) daily profit (realized and unrealized) reaches $20 (just throwing a number out), or
b) daily loss (only realized loss...this is the part i'm stuck on) reaches $20
for a) condition daily profit/loss >= $20 I believe would fit the bill
for b) i can't figure out how to do this, because i only want it to be based off of realized loss. from what I can tell, everything seems to be based off equity. How can I accomplish b)?
This is the part of the manual that tells me I can't use daily to accomplish b), because it is based on floating : "The Account Protector uses server time to determine the start of the day for these conditions and includes the floating profit/loss in its calculations:" - Maybe another condition can be added for daily profit/loss that does not include floating p/l in it's calculations?
That's the issue, there's nothing available that is based on balance that also isn't taking into account floating pnl. I need it to only work based on realized loss.You can use the balance change condition, but you'd need to reset it manually once it gets triggered.
Just an update on my request. I can't actually get the daily profit/loss to work at all on the mt4 version. So this might be a bug. I tried on mt5 version and it's working as expected. I also made a custom version with the 2 lines above edited as follows:That's the issue, there's nothing available that is based on balance that also isn't taking into account floating pnl. I need it to only work based on realized loss.
I tried to comment these 2 lines out (I'm not a programmer at all. I only have experience with powershell scripting, I definitely don't know mql code) but now when I enable the condition, it triggers right away no matter what. So that didn't work. If anyone could suggest a code edit, I can compile a diff version of this that I could just run on another chart. I was really hopeful commenting out these 2 lines would do the trick but it didn't.
View attachment 23908
I don't quite understand how that would work. Could you please explain in details?-Set a TP/SL on all purchases when they are in total profit, but TP/SL is then set against the current price so that all redeem at the same time when the price changes.
OK. I will consider adding such a timer.- the ability to set a timer on Action.
When the condition is triggered, a timer is started and if the condition is still thru after(and during) X seconds, only then does the action trigger. If the condition is not met, the timer is reset to be triggered again at the next opportunity.
How exactly did you check it? What condition did you use and what was the situation with the trades?Just an update on my request. I can't actually get the daily profit/loss to work at all on the mt4 version. So this might be a bug.
buy1 was made on price 1, buy2 was made on price 2, buy3 was made on price 3. the price fluctuates and when the sum of all three buys shows a total profit, then a S/L ore trailing S/L is set at the same level on all 3 buys so they are sold at the same time if/when triggered, the profit is locked in. so the three buys are treated as one.I don't quite understand how that would work. Could you please explain in details?
OK. I will consider adding such a timer.
For some reason, it thinks that 'Enable' is some kind of a function. It looks like it's some kind of a quirk of macOS. You could try renaming the 'Enable' enum here (in Account Protector.mq5) and in Defines.mqh. For example, to 'EnableEnum' or something like that. Not sure if that will help but it's easy to try.I seem to be getting an error when compiling the EA, are you able to help me? The 3 errors I get when trying to compile the EA are:
View attachment 23995
I'm running mt5 on Mac btw so don't know if that makes any difference.
So that looks like an equity stop-loss but with some more or less arbitrary bundling of orders. I will see what can be done, but at a first glance it looks very complex to handle.buy1 was made on price 1, buy2 was made on price 2, buy3 was made on price 3. the price fluctuates and when the sum of all three buys shows a total profit, then a S/L ore trailing S/L is set at the same level on all 3 buys so they are sold at the same time if/when triggered, the profit is locked in. so the three buys are treated as one.
the same on sell, so that you handle buy and sell separately.
If another buy/sell is made when the S/L is set, it is handled as a new purchase in a new "order-bundle" that is filled with new trades until they are at a profit. (does this exist in any EA?)
I seem to be getting an error when compiling the EA, are you able to help me? The 3 errors I get when trying to compile the EA are:
View attachment 23995
I'm running mt5 on Mac btw so don't know if that makes any difference.
I seem to be getting an error when compiling the EA, are you able to help me? The 3 errors I get when trying to compile the EA are:
View attachment 23995
I'm running mt5 on Mac btw so don't know if that makes any difference.
Make sure you copied all the files from the archive to your MetaTrader 5 Experts folder because "Enable" is defined in the "Defines.mqh" file which is bundled with Account Protector.I'm getting the same errors, but running windows not mac.
I tried changing Enable to EnableEnum but that did not work
View attachment 24115
Thanks for the reply, sadly I do have all the files;Make sure you copied all the files from the archive to your MetaTrader 5 Experts folder because "Enable" is defined in the "Defines.mqh" file which is bundled with Account Protector.
And if you try to open Defines.mqh in MetaEditor and press Compile there, what does it say? It won't compile an .ex5 out of it, but it will check it for errors.Thanks for the reply, sadly I do have all the files;
View attachment 24123
I've seen one suggestion to compile with no optimisation, but that sadly did not work either