# lot calculating with trend

173

hi, I am trying to calculate my lot size and it does not appear to work as I would like

I try to make it seek the last bars to see what direction they went and increment my lot size using this calculation. So Basicly I setup the barcount to 1 before this sequence and I increment it as it does not find 2 bars that are going the same way. but it does not work when I put it on an account I tought it worked but when it re-calculates it it stops working. anyone willing to help on this?

while (done != true)
{
previousbar = barcount+1;
openprice1 = iOpen(Symbol(),Period(),barcount);
closeprice1 = iClose(Symbol(),Period(),barcount);
if ((closeprice1 - openprice1) > 0) nexttype1 = 1;
if ((closeprice1 - openprice1) < 0) nexttype1 = 0;
openprice1 = iOpen(Symbol(),Period(),previousbar);
closeprice1 = iClose(Symbol(),Period(),previousbar);
if ((closeprice2 - openprice2) > 0) nexttype2 = 1;
if ((closeprice2 - openprice2) < 0) nexttype2 = 0;
if (nexttype1 != nexttype2) barcount+1;
if (nexttype1 == nexttype2)
{
multiplier = barcount;
done = true;
}
}
lot = (lot*multiplier);
if (lot < minlot) lot = minlot;
if (lot > Max_Start_Lot) lot = Max_Start_Lot;
Moderator
10645

liquidd:

hi, I am trying to calculate my lot size and it does not appear to work as I would like

I try to make it seek the last bars to see what direction they went and increment my lot size using this calculation. So Basicly I setup the barcount to 1 before this sequence and I increment it as it does not find 2 bars that are going the same way. but it does not work when I put it on an account I tought it worked but when it re-calculates it it stops working. anyone willing to help on this?

Where do you increment barcount?
173

GumRai:

Where do you increment barcount?

if (nexttype1 != nexttype2) barcount+1;
Moderator
10645

What does barcount+1; do?

Does that compile?

Do you mean barcount++; ?

173

GumRai:

What does barcount+1; do?

Does that compile?

Do you mean barcount++; ?

I think it does the same thing and yes it compiles