How can I set up a condition to activate/deactivate MoneyManagment?
-
Hello
Please, I need help because I don't know what I am doing wrong with one condition. I want to choose in some way if my EA have to trade with a risk % of the Equity account or using fixed lots.
I have tried to add a condition using a boolean variable for Money Management activation or not:
MoneyManagement bool (True = %Equity, False = Lots)
If MoneyManagement == True -> Buy/Sell with MM
If MoneyManagment == False -> Buy/Sell with LotsSo, my EA looks like this

But the EA does not open any trade on the backtesting:

If I delete the MoneyManagement condition the EA Works as it should be with MM or Lots:


Could anybody help me to get what I want on my EA?
Thanks
-
Hi josecortesllobat,
I'm not an expert, but these are the problems I see.
-
"MoneyManagement" should be a constant, not a variable. That's the only way you will be able to choose it manually.
-
Once you manually choose if it is true or false, the order of blocks should be different:
- Blocks 1, 2 and 3 remain unchanged.
- Then blocks 13 and 14 remain as per your screenshot.
- What is changed is that block 15 should be then connected below block 13 through the yellow connection, not the usual orange one.
- Hold block 9 as per your screenshot.
This way your EA will first check if moneymanagent is true. If so the trade will be open. If it is false, the new path will be chosen. Your current structure is trying to check both conditions (true and false Moneymanagement) simultaneously and things in MT4 cannot be true and false at the same time.

Hope it helps.
-
-
Hi isp00rt
Great job!!!
It Works as I expected



Thanks a lot for your help. I thought that the yellow connection was for the opposite signal of the condition not for checking if the consition is not true. You help makes me understand better the logic of the connections.

-
You're welcome.
