Money managment function

 

What do u think about that kind of money managment?

double MoneyManagment(double BidPrice, double StopLvl)

{

double capital = AccountFreeMargin()*0.03;//three % of capital to use

double lotsize = 0.1;

double pip;//one pip price - that u have to calculate and set manualy

if(Symbol() == "EURUSD")

{

pip = 3.23;

}

else if(Symbol() =="GBPUSD")

{

pip = 3.22;

}

else if(Symbol() == "USDCHF")

{

pip = 2.46;

}

else if(Symbol() == "USDJPY")

{

pip = 2.77;

}

else

{

pip = 2.92;//average pip price

}

if((MathAbs(BidPrice - StopLvl)/Point) == 0)

{

return (0.1);

}

for(int i = 1; i<30;i++)

{

if(MathAbs(BidPrice - StopLvl)/Point*(pip*i) <= capital)

{

lotsize = 0.1*i;

}

}

if(lotsize <= 0.5)

{

return (lotsize);

}

else if(lotsize > 0.5 && lotsize < 1)

{

return (0.5);

}

else if(lotsize >= 1 && lotsize < 2)

{

return (1.0);

}

else if(lotsize >= 2 && lotsize < 3)

{

return (2.0);

}

else if(lotsize >= 3 && lotsize < 4)

{

return (3.0);

}

else if(lotsize >= 4 && lotsize < 5)

{

return (4.0);

}

else if(lotsize >= 5 && lotsize < 6)

{

return (5.0);

}

else if(lotsize >= 5 && lotsize < 6)

{

return (6.0);

}

else if(lotsize >= 6 && lotsize < 7)

{

return (6.0);

}

else if(lotsize >= 7 && lotsize < 8)

{

return (7.0);

}

else if(lotsize >= 8 )

{

return (8.0);

}

else

{

return (0.1);

}

}

 

i not understand

average pip price

pip price - that u have to calculate and set manualy

--

 

that is price that u have to pay for one pip when u play 0.1 lot size

like when u play 1 lot on eur usd 1 pip cost u average 10$

 

thanks

sorry i not understand StopLvl = order stop ?

and you BidPrice = order openprice ?

can you explain you MM mit trading example (EA....)

--

 

It's like that:

U start trade on lvl 1.2000 and set SL as u want - let's say our SL will be 1.2050 So SL pips are 50. And the function couts how much u have to pay for 50 pips with play of 0.1 lot and 1:100 laverage. And if that amout of cash (50 pips *0.1 lot) is less than 3% of your free margin then it multipy that cash by 2 (0.1*2) and check is that less than 3% of capital , and again and again. When it's more than 3% it returns you the number of lot with that size of SL. Is that clear to you now? Or mabye some more explenation needed?

 

OK oK but

Could You show me an example with Your calculation for a pair please ? 1 lot-10$, 0.1lot-1$? Why 3.23?

 

But how do You calculate manually these numbers?

if(Symbol() == "EURUSD")

{

pip = 3.23;

}

else if(Symbol() =="GBPUSD")

{

pip = 3.22;

}
 

Please explain the manual calc

Kalenzo

Please explain the manual calc.

 

Wow!

What a mess. Ever heard of loops and controls? I guess I'll have to write my own.

Of course I'll share.