still in LotSize mgt subset of Money Management
Just want to know how to set the money management like this?
If the balance between $1-$10.000 = 0.1lot
If the balance between $10.001-$15.000 = 0.2lot
If the balance between $15.001-$20.000 = 0.3lot
etc.
How to code this money management?
u have to find mathematically, what is the multiplication factor and use that for your LotSize calculation
eg.
(again, there are many ways, my explanation suppose to make things easy, if it is not , I am sorry)
the key is to understand also the function of MathFloor() ==> which return integer from double and also NormalizeDouble
void LotSizeCalculation()
{
double NativeBalance = 10000;
//because you define your multfactor to be NOT Linear, so, we have to figure it out, quite a bit on the calculation
LotSize = NormalizeDouble( MathFloor( (0.1 x 2 x AccountBalance() ) / ( (NativeBalance +1) * 0.1) ) * 0.1 , 1); //u want only 1 digit decimal
if (LotSize < 0.1 && AccountBalance() > 0) LotSize = 0.1;
//checking
// if accountbalance = 9999, LotSize = 0.2 x 9999/1000.1 = 1.999 ==> after MathFloor = 1 , then x 0.1 jadi 0.1 then after NormalizeDouble, LotSize = 0.1
// if accountbalance = 10000, LotSize = 0.2 x 10000/1000.1 = 1.999 ==> after MathFloor = 1 , then jadi 0.1 then after NormalizeDouble, LotSize = 0.1
// if accountbalance = 10001, LotSize = 0.2 x 10001/1000.1 = 2 ==> after MathFloor = 2 , then jadi 0.2 then after NormalizeDouble, LotSize = 0.2
// if accountbalance = 15000, LotSize = 0.2 x 15000/1000.1 = 2.999 ==> after MathFloor = 2 , then jadi 0.2 then after NormalizeDouble, LotSize = 0.2
//** by right we want if accountbalance = 15001, LotSize = 0.2 x 15001/1000.1 = 3 ==> after MathFloor = 3 , then jadi 0.3 then after NormalizeDouble, LotSize = 0.3
// but the above still give if accountbalance = 15001, LotSize = 0.2 x 15001/1000.1 = 2.999 ==> so, the formula is still wrong - kena betul sikit lagi kat NativeBalance + 1 vs accountbalance formula
// seterusnya check sendiri - i have to go for a while
}
best eh..?