Change Lots

 

Hi all...

What I've to do to change lots?

int LotCalc(double Risk)

{

int vLots=0;

if (UsePct >0 && Risk>0) vLots=MathFloor(AccountBalance()*(UsePct/100)/((Risk/MarketInfo (Symbol(), MODE_POINT))*10));

if (UsePct >0 && Risk==0) vLots = MathFloor(AccountBalance()*(UsePct/100)/1000);

if (vLots>MaxLots) vLots=MaxLots;

if (vLots<1) vLots=1;

return(vLots);

}

I already changed for 0.1 but the EA dont trade..

But if I change for 2 lots it trade normally..

Any help I appreciate..

Tks

 

that looks overly complicated, heres what i use

double lots = NormalizeDouble(AccountFreeMargin()/(500/0.1),1);

this uses 0.1 lot for every 500 in your account, adjust them as you see fit. hope this helps.

 
trevman:
that looks overly complicated, heres what i use
double lots = NormalizeDouble(AccountFreeMargin()/(500/0.1),1);
this uses 0.1 lot for every 500 in your account, adjust them as you see fit. hope this helps.

hi trevman...

Thanks for your help but dont result..

Do you've other way? Anyone?

 

I think your problem is here:

if (vLots<1) vLots=1;

 
zuhainis:
I think your problem is here: if (vLots<1) vLots=1;

hi zuhainis...

Thanks for your reply

I already changed

if (vLots<1) vLots=1;[/PHP]

to

[PHP]if (vLots<0.1) vLots=0.1;

but dont trade

error message: EURUSD,H1: invalid lots number for OrderSend function

What i've to do now?

 

Change lots

My guess is that you are returning an int instead of a double (the lots parameter is a double). Anything less than 1.0 will be truncated and end up as zero (trust me, I have done it and looked for hours until I found the problem).

I hope this helps, good luck.

Scott