Download MetaTrader 5

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

To add comments, please log in or register
Any questions regarding MQL5 Cloud Network? FAQ will help you!
Daniel Cormier
123
Daniel Cormier 2014.07.06 15:18 

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 

qjol
3243
qjol 2014.07.07 00:49  
   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

To add comments, please log in or register