Increasing lots with EA


I've been using a peice of code that Trevman posted a while back to increase your lots as your balance grows and it works well! However, I'm hoping to find a way to add something to it that would keep it from decreasing the number of lots as the account balance goes down. For example, something that would look at the code Trevman posted and also looking at the number of lots on the previous order and use the larger of the two. I'm only a beginner trying to learn here, so any help will be greatly appreciated!

Here's the code I have now:

double Lots = NormalizeDouble(AccountFreeMargin()/(500/0.1),1);

Thanks again for the help! =)


Here it is!

I figured out how to do this a while back and thought that I had posted it, but I guess maybe I didn't. In case anyone else out there was looking for the same thing that I was, here it is!

double Lots2 = OrderLots();

double Lots = NormalizeDouble(AccountBalance()/(1000/0.1),1);

if (Lots<Lots2) Lots = Lots2;


if (Lots>100) Lots = 100;


Using this will increase your leverage as your balance goes up, but won't ever lower your leverage when you have a bad trade, which I think is a much better way to increase your lots. if you want to adjust the leverage, only change the part that is now set at 1000. If you want it more volital, use a smaller number, or a larger number for less volital results. right now it is set for 10:1 leverage on a standerd account, so if you are using a mini account, you'll want to just put in 100 instead of 1000 for the same 10:1 leverage.

Happy trading!