Need help to get 5 digits indicator value on 5 digit broker

 

I am getting a 4 digits results on 5 digits broker when calulating any of the indicator. For example: iBand return 1.2222 on 5 digitis broker (on the chart windows it shows 1.22226).

I have tried normalizedouble(price, digits), however it still giving back 4 digits. I am using FXCM broker. Has anyone encounter this issue? or anyone has solution to get 5 digits?

I am trying to get EA to work on 4 digits and 5 digits.

Thanks in advance for your input.

padiFX

 
padiFX wrote >>

I am getting a 4 digits results on 5 digits broker when calulating any of the indicator. For example: iBand return 1.2222 on 5 digitis broker (on the chart windows it shows 1.22226).

I have tried normalizedouble(price, digits), however it still giving back 4 digits. I am using FXCM broker. Has anyone encounter this issue? or anyone has solution to get 5 digits?

I am trying to get EA to work on 4 digits and 5 digits.

Thanks in advance for your input.

padiFX


I can get the 5 digits when I convert it to String with DoubleToStr, however when I convert it back to double I got 4 digits again :(.

Any thought?

 

Hi,

padiFX wrote >>

I am getting a 4 digits results on 5 digits broker when calulating any of the indicator.

You need to make sure if it's a displaying or calculating problem. If your indies values are not normailized and or math-rounded to a lesser digit than required before they are calculated, then the calculation result should still be valid.

For example: iBand return 1.2222 on 5 digitis broker (on the chart windows it shows 1.22226).

Where did it returned 1.2222 ? The Data Window is more reliable to check indicators' values.

I am trying to get EA to work on 4 digits and 5 digits.

Again on 5 digit broker the calculation should not matter if it is not rounded to less digit-accuracy than it is needed in calculation. but if you normalize/round both values to digit 4 before you calculate it then you will lose a tenth of what accuracy you're supposed to received.

hth.

 
cameofx wrote >>

Hi,

You need to make sure if it's a displaying or calculating problem. If your indies values are not normailized and or math-rounded to a lesser digit than required before they are calculated, then the calculation result should still be valid.

Where did it returned 1.2222 ? The Data Window is more reliable to check indicators' values.

Again on 5 digit broker the calculation should not matter if it is not rounded to less digit-accuracy than it is needed in calculation. but if you normalize/round both values to digit 4 before you calculate it then you will lose a tenth of what accuracy you're supposed to received.

hth.


What can I do to make sure this is displaying or calculating problem?

The data window is displaying 1.22226 which is what I needed, however the value 1.2222 is returned when I print out the iBand value ex: Print(iBand). (This is not only apply to iBand function call, it applies to iMA, etc).

I will try rounding the calculation to 4 digits and I think this will work.

On 5 digits broker a tenth is a pip. If I can calculate with 5 digits I am able to get to a pip, instead of the 10th pip.

Thank you.

 
What can I do to make sure this is displaying or calculating problem?
Print(DoubleToStr(var,Digits)
On 5 digits broker a tenth is a pip. If I can calculate with 5 digits I am able to get to a pip, instead of the 10th pip.
Are you adjusting for the fact that a pip is not a point?
//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init() {
    if (Digits == 5 || Digits == 3) {   // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
// OrderSend(... SlippagePips * pips2points, Bid - StopLossPips * pips2dbl
 

What can I do to make sure this is displaying or calculating problem? The data window is displaying 1.22226...

You've done just that. If the data window is able to show 5 digits (the accuracy you needed) then it means its calculation can produce that accuracy. I think the difference is clear. as long as it's not truncated calculation values will retain maximum accuracy and it is stored in memory. While to monitor those values you can truncate to any accuracy you wish to see, and they won't effect the numbers stored in memory.

Check also that you don't set any of the NormalizeDouble to less than 5. the IndicatorDigits function will also truncate display to what what digit-accuracy it was specified.

As a rule, I personally apply this to all my indies :

NormalizeDouble(Buf, Digits + 4); for calculation accuracy

IndicatorDigits(Buf, Digits + 2 ); for display accuracy

NormalizeDouble(Buf, Digits); for order sending

pip vs. point is also important as WHroeder pointed out.

hth.

 
cameofx wrote >>

You've done just that. If the data window is able to show 5 digits (the accuracy you needed) then it means its calculation can produce that accuracy. I think the difference is clear. as long as it's not truncated calculation values will retain maximum accuracy and it is stored in memory. While to monitor those values you can truncate to any accuracy you wish to see, and they won't effect the numbers stored in memory.

Check also that you don't set any of the NormalizeDouble to less than 5. the IndicatorDigits function will also truncate display to what what digit-accuracy it was specified.

As a rule, I personally apply this to all my indies :

NormalizeDouble(Buf, Digits + 4); for calculation accuracy

IndicatorDigits(Buf, Digits + 2 ); for display accuracy

NormalizeDouble(Buf, Digits); for order sending

pip vs. point is also important as WHroeder pointed out.

hth.


Thank you for your input.

Reason: