I need you to add a money management function to an existing EA for trading XAUUSD. Please see below how the EA works:
1.) The EA opens 3 trades at minimal lot sizes and closes when take profit is achieved.
2.) If the loss increases, the EA opens new trades with multiples the initial lot sizes and continues in this manner till your account is blown (if the market fails to reverse in your favor).
3.) If the market reverses in your favour, the EA makes a lot of profit (assuming you have sufficient profit to withstand the long trend against you)
4.) the EA has a trailing stop loss but very risky.
1.) Optimize the EA to maximize profit and minimize drawdown
2.) Add a money management functionality to safeguard the account from blowing
3.) Add a hedging functionality to make profits when the market is against the EA