4 & 5 points calculation issue

 

Hello,

in the above image

Exponential Moving average = 1.13688       > (EMA)

HeikenAshi Close = 1.13687                       > (HAClose)

in my EA I have program condition if HAClose is less than EMA than do some work. I want to do this work on 4 digit basis like:

EMA = 1.1368

HAClose = 1.1368

now in this case HAClose in not less than EMA now HAClose == EMA.

If I NormalizeDouble() on 4 digits it round of 4th digit in my case I don't want to be rounded. I need to trim 5th digit or don't want to consider what ever it is.

I want to calculate my calculations on 4 digits. HOW TO ACHIEVE THIS?

 
kumaillakhani:

If I NormalizeDouble() on 4 digits it round of 4th digit in my case I don't want to be rounded. I need to trim 5th digit or don't want to consider what ever it is.

I want to calculate my calculations on 4 digits. HOW TO ACHIEVE THIS?

how do you want the value to be?
DoubleToString()

DoubleToString - Conversion Functions - MQL4 Reference
DoubleToString - Conversion Functions - MQL4 Reference
  • docs.mql4.com
value is in the range between 0 and 16, a string presentation of a number with the specified number of digits after the point will be obtained. If the value is in the range between -1 and -16, a string representation of...
 
If I NormalizeDouble() on 4 digits it round of 4th digit in my case I don't want to be rounded. I need to trim 5th digit or don't want to consider what ever it is.

https://www.mql5.com/en/forum/268708#comment_8204877

 
Mohamad Zulhairi Baba:

how do you want the value to be?
DoubleToString()

I need double because I need to do calculation on it.

 
kumaillakhani:

If I NormalizeDouble() on 4 digits it round of 4th digit in my case I don't want to be rounded. I need to trim 5th digit or don't want to consider what ever it is.

I want to calculate my calculations on 4 digits. HOW TO ACHIEVE THIS?

Did you tried to convert to string, rip off the 5th digit and convert it again to double?

Reason: