Extra decimal place, how to detect it so I can code round it ? - page 2

 
RaptorUK wrote >>

OK, but what about the other pairs and other instruments that are 2 digits on one platform and 3 on the other, and then the ones that are 3 digits on one platform and 4 on the other ?

This will work for Forex with regular or fractional-pips.

if(Digits == 2 || Digits ==3)
  {
   Value = NormalizeDouble(YourValue,2);
  }
else
  {
   Value = NormalizeDouble(YourValue,4);
  }

I've never seen a currency pair that's either 3 OR 4 digits. If you're doing something else then you might have to build a rule around a case statement that lists all of the possible instruments (pairs, or whatever) and normalizes to a specific number of digits for each pair.

 
tovan:

This will work for Forex with regular or fractional-pips.

I've never seen a currency pair that's either 3 OR 4 digits. If you're doing something else then you might have to build a rule around a case statement that lists all of the possible instruments (pairs, or whatever) and normalizes to a specific number of digits for each pair.

I figured out how to detect if a particular installation of MT4 is 4 digits or 5 digits . . . very simple really, don't know why I didn't figure it out sooner . . .


if (MarketInfo("GBPUSD", MODE_TICKVALUE) < 10) mt4digits = Digits - 1 ;


Tickvalue for GBPUSD is 10 on a 4 digit system and 1 on a 5 digit system . . . simple.

 
n8937g:

Some brokers use 4 and 5 digits both... Fxpro eurusd 5........gbpaud 4

Sorry you are missing the whole point . . . FxPro also do 3 digits for some pairs, e.g. GBPJPY and 2 digits for others., e.g. CHFJPY . . . but in all these cases the last digit is NOT a pip, it is s tenth of a pip. Perhaps you should do a little research before you comment.