Normalizing lot size without rounding figures

 

Hello,

My problem is that I want to calculate lot size depending on the account balance like that:

Lots2=(AccountBalance() * 0.001);
Lots=NormalizeDouble((Lots2),1);

But I wouldn't like to round the figure to the higher value so if my AccountBalance() is for example 10360 it's:

10360 * 0.001 = 10.36 lot size, after rounding it's 10.4

I don't want to have my numbers rounded, maybe there is some function to just leave only first number after dot?
So the lot size would be 10.3 not 10.4

If you know the solution please help me up, I will gladly appreciate it.

Thanks.

 
Camza:

Hello,

My problem is that I want to calculate lot size depending on the account balance like that:

But I wouldn't like to round the figure to the higher value so if my AccountBalance() is for example 10360 it's:

10360 * 0.001 = 10.36 lot size, after rounding it's 10.4

I don't want to have my numbers rounded, maybe there is some function to just leave only first number after dot?
So the lot size would be 10.3 not 10.4

If you know the solution please help me up, I will gladly appreciate it.

Thanks.

Subtract half of MODE_LOTSTEP before Normalizing . . .  it's just simple mathematics.
 
Camza:

10360 * 0.001 = 10.36 lot size, after rounding it's 10.4

I don't want to have my numbers rounded
#define TENTH 0.1
Lots=MathFloor(Lots2 / TENTH)* TENTH;