Change line 476 from a double to an integer:
int SizeOfDollop=1000;
Then copy this over the top of the existing void CalculateLotAsAmountPerCashDollops():
Code: Select all
void CalculateLotAsAmountPerCashDollops()
{
double lotstep = MarketInfo(Symbol(), MODE_LOTSTEP);
int decimal = 0;
if (CloseEnough(lotstep, 0.1) )
decimal = 1;
if (CloseEnough(lotstep, 0.01) )
decimal = 2;
double maxlot = MarketInfo(Symbol(), MODE_MAXLOT);
double minlot = MarketInfo(Symbol(), MODE_MINLOT);
double DoshDollop = AccountInfoDouble(ACCOUNT_BALANCE);
if (UseEquity)
DoshDollop = AccountInfoDouble(ACCOUNT_EQUITY);
//For testing:
//DoshDollop = 2796;
//Calculate the no of dollops in DoshDollop
int NoOfDollops = (int) DoshDollop / SizeOfDollop;
//Initial lot size
Lot = NormalizeDouble(NoOfDollops * LotsPerDollopOfCash, decimal);
//Min/max size check
if (Lot > maxlot)
Lot = maxlot;
if (Lot < minlot)
Lot = minlot;
//For testing
//Alert(DoubleToStr(Lot, decimal));
}//void CalculateLotAsAmountPerCashDollops()SizeOfDollop = TradeSizeOfDollop[tfIndex];
It needs to be:
SizeOfDollop = (int) TradeSizeOfDollop[tfIndex];