EarnForex / Account-Protector

Automate emergency position closing and autotrading termination using a multi-setting expert advisor.
https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/
Apache License 2.0
83 stars 57 forks source link

Feature request: Add option to run Action if ALL applied Conditions are met #11

Open Tentt opened 1 month ago

Tentt commented 1 month ago

Add option to run Action if ALL applied Conditions are met

For example:

Condition1: Floating Profit raised 10% Condition2: Open trades less than 10 Action: Close 100% of open trades

Now: All positions will be closed once opened, because Condition2 met

Then: Wait for 10% profit if open trades number is less than 10 If open trades number more than 10 - do nothing (wait human manual intervention)

Tentt commented 1 month ago

@EarnForex Hello! What do you think? Is it possible?

EarnForex commented 1 month ago

It's an interesting suggestion, but it's not that simple to implement in the current AP. I will see if it can be done.

Tentt commented 1 month ago

My vision (could be wrong):

To Main add Option "Wait all Conditions"

Declare 2 variables: 1st for count applied Conditions == 0 2nd for count activated Conditions == 0

For UI where you checking if Condition enabled to show checkbox after each "true" add 1st Variable +1 Update Event listeners: after each "true" add 2nd Variable +1

In action logic add IF Option enabled check if 1stVariable == 2ndVariable Then do Actions Else - continue regular process