Money managment incresing lots

 

Hi!

I look for code on money and lots managment for expert advisor.

and how to implement them to my expert advisor?

Thanks.

Best regards.

Boogie.

 

extern int RiskFactor = 2.0; //Percent

extern double Lots = 0.1; //Manual Lots if Risk Factor=0

double lot_size() {

double lots;

double LotSize = MarketInfo(Symbol(), MODE_LOTSIZE);

double MinLot = MarketInfo(Symbol(), MODE_MINLOT);

double LotStep = MarketInfo(Symbol(), MODE_LOTSTEP);

if (RiskFactor==0) return (Lots);

lots = (AccountFreeMargin()* AccountLeverage() / LotSize) * RiskFactor/100.0;

if (lots < MinLot) lots = MinLot;

lots /= LotStep;

lots = NormalizeDouble(lots, 0);

lots *= LotStep;

return(lots);

}

Reason: