proportionate money managment for Metatrader EA's
PHP Code:
double LotSize()
{
int Lotsaccretion = 250; // account accretion
int LotsMarginForOne = 100; // margin for one trade
int LotsMax = 1000; // max. number of lots
int k=LotsMarginForOne;
for (double i=2; i<=LotsMax; i++)
{
k=k+i*Lotsaccretion ;
if (k>AccountFreeMargin())
{
Lots=(i-1)/10; break;
}
}
if (Lots<0.1) Lots=0.1;
return(Lots);
}
--