Coding Help: Money Management / Variable Lots According to Current Balance

 

Hello,

 This is my first post to the community and I need some help.

 I have built an EA which I will be running only on EUR/USD but possibly exploring other pairs in the future.

Based on the results, I am confident that for every 25 Euro in my account balance, I can trade 0.01 lot. Can anybody help me with the code to achieve this when trades open. EA is programmed to only take 1 trade at a time. Please note my SL is fixed, so I am only looking for coding of lots and not a set TP or SL.

Many Thanks & Best Regards,

Dan 

 
   double MM = AccountBalance() / 25.0;
   double Lots = (int) MM * 0.01;


but you have to check SYMBOL_VOLUME_MIN and SYMBOL_VOLUME_STEP to adapt the code