Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Sorry, I don't quite understand what you are trying to achieve here.

What I can say is that you cannot filter by trade direction with AP. If you are trying to limit the account's total drawdown, you just need to set "Floating loss rises to % of balance" condition to the drawdown you consider maximum (e.g., 30) and set the action to "Close 100% of All positions' volume".
 

rasasu

Trader
Jul 11, 2020
4
0
6
33
@Enivid

Hi there, what is the difference between equity trailing stop on the main page and equity < currency units in the condition section ? I hope you can kindly explain to me.

Will the equity trail stop works if I didn’t set any value in pips or currency for SL trailing.

I hope you would be able to clarify it.

Many thanks
Rasasu
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Hi there, what is the difference between equity trailing stop on the main page and equity < currency units in the condition section ? I hope you can kindly explain to me.
Equity trailing stop acts as a trailing stop - going up as the equity grows. It is also not a condition - it is a trailing stop - it will just close the trades and that's all.

"Equity <= currency units" in the condition that will trigger actions once the equity declines to a certain level.

I would say, these two share almost no similarities other than using equity as their basic value.

Will the equity trail stop works if I didn’t set any value in pips or currency for SL trailing.

You mean the other trailing options in the Main tab? Yes, it will work. You don't need to set other trailing stops to make another trailing stop work.
 

Robertosvjr

Newbie
Jul 15, 2020
5
1
1
55
Enivid,
Congratulations on the expert Acoount Protector, it is beautiful code.
I am using it to brake the DrawDown as if I were trying to brake a car slowly without large volume closures for this and that I would be monitoring from time to time stepping on the brake if necessary but slowly and continuously.

I made the following configuration:
Input parameters
DoNotResetConditions = true
DoNotResetActions = true
remaining default

Main and Filters tab default

Conditions tab
Floating loss rises to% of the balance = 30.00
remaining disabled

Actions tab
Close 1% of Losing positions´ volume
remaining disabled

Thank you

It happens that the orders are closed in large volume, probably because the time between the Account Protector asking to close the orders and the time of the broker closing the orders, mainly during news time, are different and the Account Protector asked to close the orders again and when closing occurs, large volume closes depending on the closing response time by the broker.

How could I increase the time between braking to be smoother?
If there is no parameter for this function, could you explain what I must change in the code to be able to do it? It could be, perhaps, in the opening of 5 minute candles, for example.

If it could close less than 1% it would also be interesting, for example 0.5%, at the moment it only accepts whole values.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
How could I increase the time between braking to be smoother?

So... Do I understand it right that you just want some configurable delay before the next action is taken when conditions and actions are set not to reset on triggering? So that the positions are getting reduced in size gradually?

I can consider adding this in the next version. Meanwhile, you could try adding that yourself using something like this:

MQL4:
// Somewhere in the global scope.
int LastTriggerTime = 0;
...
// Somewhere in the beginning of Trigger_Actions method.
if (GetTickCount() - LastTriggerTime < 1000) return; // 1000 ms = 1 second.
...
// Somewhere in the end of Trigger_Actions method.
LastTriggerTime = GetTickCount();

If it could close less than 1% it would also be interesting, for example 0.5%, at the moment it only accepts whole values.
Good idea! I will add this in the next version.
 
  • 👍
Reactions: AfroButterfly

Robertosvjr

Newbie
Jul 15, 2020
5
1
1
55
So... Do I understand it right that you just want some configurable delay before the next action is taken when conditions and actions are set not to reset on triggering? So that the positions are getting reduced in size gradually?
Yes, that's it.

// Somewhere in the beginning of Trigger_Actions method.
Sorry, but I couldn't find this position. Would it be in the Account Protector.mq4 file?

If you can make the new version, I think it would be better for me.
 

Robertosvjr

Newbie
Jul 15, 2020
5
1
1
55
That would be inside AccountProtector.mqh file.
Enivid,
Your suggestion about the time is working but I would need some help still using the above configuration.
When the account is small, for example $ 100 and there are several experts opening lots of 0.01 and upon reaching the 30% DD, all 0.01 orders are closed causing a huge negative balance, however, would need to close perhaps, only the most negative order 0.01 that the DD would be below 30% and it would not be necessary to close all the others 0.01.
The same does not happen if the lots are for example 0.04, negative lots are closed at 0.01 leaving only 0.03 in the market.
Could you change the quantity of lots to be partially closed, observing the necessary DD?
For example, could close the 3 most negative 0.01 lots that would be enough for the DD 30%.
If you also want to send me the code, keeping the question of time, I will try to change it.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Enivid,
Your suggestion about the time is working but I would need some help still using the above configuration.
When the account is small, for example $ 100 and there are several experts opening lots of 0.01 and upon reaching the 30% DD, all 0.01 orders are closed causing a huge negative balance, however, would need to close perhaps, only the most negative order 0.01 that the DD would be below 30% and it would not be necessary to close all the others 0.01.
The same does not happen if the lots are for example 0.04, negative lots are closed at 0.01 leaving only 0.03 in the market.
Could you change the quantity of lots to be partially closed, observing the necessary DD?
For example, could close the 3 most negative 0.01 lots that would be enough for the DD 30%.
If you also want to send me the code, keeping the question of time, I will try to change it.
I might consider changing the code to partially close portfolio by closing a number of orders rather than partially closing separate orders, but it's not an easy thing to do and I am not sure that I will do it.
 

Robertosvjr

Newbie
Jul 15, 2020
5
1
1
55
I might consider changing the code to partially close portfolio by closing a number of orders rather than partially closing separate orders, but it's not an easy thing to do and I am not sure that I will do it.
An idea,
Example:
In a $ 20 account and a 30% DD set, if it has a negative profit of $ 8, we know that to reach 30%, we need to close $ 2, make a loop closing the negative orders until reach this value. It wouldn't have to be the most negative orders, perhaps.
 

ayylmao23

Newbie
Jul 22, 2020
9
0
1
55
Enivid,

We've possibly experienced an issue with the account protector. Could you or someone clarify if this is supposed to happen or not?

The condition "Floating loss rises to % of balance" is set to 10% and the action is "close 10% of losing positions' volume".
We see that the action gets taken when triggered the first time OK but anytime after that, the condition isnt triggered at all. We can clearly see that the floating loss is greater than 10% & no action is being taken.

Whats going on here?
 

hounddog

Trader
Jul 23, 2020
14
0
17
33
Hi,
I have been using the Account Protector and so far it seems to be a god send!
As for settings I am using 15% floating loss and 15% close losing positions. I also have the =<equity setting in use as a second fail safe.
From what I have noticed, it triggers fine on the first 15% of floating loss, and the number tally up. However, I am struggling to figure out when it calculates trigger the next lot of closing 15% of losing positions and I can’t seem to tally the DD with any thing.
Before it decides to trigger again for the second time it seems like it’s way above the 15% allowed.
Can you tell me what the equation is for it to know when to close the second lot of 15%?

Just trying to get my head around it, because I know it works the way it should, but I struggle to understand why it’s not kicked in on the DD that I was expecting it to.
Thanks

Lewis
 

hounddog

Trader
Jul 23, 2020
14
0
17
33
Hi,

yes I have floating loss rises to 15%. It triggers fine when it hits the first 15% floating loss, but if the loss continues to fall, it will go way pass 15% before it triggers again.
I have the do not reset settings set as true.
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Enivid,

We've possibly experienced an issue with the account protector. Could you or someone clarify if this is supposed to happen or not?

The condition "Floating loss rises to % of balance" is set to 10% and the action is "close 10% of losing positions' volume".
We see that the action gets taken when triggered the first time OK but anytime after that, the condition isnt triggered at all. We can clearly see that the floating loss is greater than 10% & no action is being taken.

Whats going on here?

What platform are you using? If it's MT5, is it in hedging or netting mode? Could you attach log file here or pm it to me? By default it should be called "log.txt".
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Hi,

yes I have floating loss rises to 15%. It triggers fine when it hits the first 15% floating loss, but if the loss continues to fall, it will go way pass 15% before it triggers again.
I have the do not reset settings set as true.
What platform are you using? If it's MT5, is it in hedging or netting mode? Could you attach log file here or pm it to me? By default it should be called "log.txt".
 

hounddog

Trader
Jul 23, 2020
14
0
17
33
What platform are you using? If it's MT5, is it in hedging or netting mode? Could you attach log file here or pm it to me? By default it should be called "log.txt".
I’m not sure the log will help at all at the moment.
but here is what Iam currently seeing in my demo in MT4. I use MT5 for my live. It I believe it is In hedging mode.
So here is where it closed off 15% when the floating loss rose to 15%.
But now the DD has gone higher then 15% of the balance and it has not closed off a further 15% of losing trades.
 

Attachments

  • 9D083E43-3098-460F-8409-72C215120252.png
    9D083E43-3098-460F-8409-72C215120252.png
    213 KB · Views: 3
  • A15EFAE3-3232-47E2-8963-C67E52607BFF.png
    A15EFAE3-3232-47E2-8963-C67E52607BFF.png
    214.2 KB · Views: 3