Download MetaTrader 5

Incrementing Lot Size per AccountBalance() - page 2

To add comments, please log in or register
They are already making profit from their signals. Publish your signal and join them!
whroeder1 2015.06.29 18:48  

I simply would like something like this...

if(AccountBalance()>=1000 && AccountBalance()<2000) Lots=0.1;
if(AccountBalance()>=2000 && AccountBalance()<3000) Lots=0.2;

Any way to do this instead of typing them all out??

Lots = int(AccountBalance() / 1000) / 10.0;

However if you're not using a proper SL, then even 0.1 lots means your account is at risk (EURUSD 1.2345) $12,345.00 (buy)

JD4 2015.06.29 19:35  
Please excuse this if this is completely incorrect, however, is it possible to do something like this:
It is possible, I am sure.  The thing to remember, for a lot of the problems that people are trying to solve, there is usually more than one way to get the desired result.  The trick is finding out which of all of these possible solutions is the best one to use.  By best possible, in this case at least, I would consider how many lines it takes to solve the problem, because usually more code means more processing time.  And more processing time means the longer it takes to actually do anything as far as the purpose of the EA.
To add comments, please log in or register