Download MetaTrader 5

Double type is not accurate enough ! How can I do ?

To add comments, please log in or register
Benjamin
35
Benjamin 2014.09.22 21:20 

Hi everybody !

 

As my title said, double type just record 4 number after the comma. Quite a problem when you trade on EURCHF with 5 number after the comma.... I tried to transform my double variable with DoubleToStrMorePrecision but it didn't work ? Did some research on the forum too...

It would be very cool if someone could give the solution !

 

Thanks a lot ! 

Keith Watford
Moderator
9636
Keith Watford 2014.09.22 23:27  
afterrage:

Hi everybody !

 

As my title said, double type just record 4 number after the comma. Quite a problem when you trade on EURCHF with 5 number after the comma.... I tried to transform my double variable with DoubleToStrMorePrecision but it didn't work ? Did some research on the forum too...

It would be very cool if someone could give the solution !

 

Thanks a lot ! 

There are no commas in numbers, you mean decimal point?

How are you viewing the double?

Try

 Print(DoubleToStr(Bid,Digits));

Strange, I am unable to use SRC. Tried in a new post as well. It inserts ok, but does not appear when posted 

georget11
24
georget11 2014.09.22 23:32  
afterrage:

Hi everybody !

 

As my title said, double type just record 4 number after the comma. Quite a problem when you trade on EURCHF with 5 number after the comma.... I tried to transform my double variable with DoubleToStrMorePrecision but it didn't work ? Did some research on the forum too...

It would be very cool if someone could give the solution !

 

Thanks a lot ! 


 Something  wrong, DOUBLE can hold   52 bits in Fraction, it's a really  Huge Number.

Please double check.

whroeder1
14750
whroeder1 2014.09.23 14:57  
georget11:  Something  wrong, DOUBLE can hold   52 bits in Fraction, it's a really  Huge Number.
53 bits is approximately 15 digits.
afterrage: It would be very cool if someone could give the solution !
  1. You need to post a problem and your broken code. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  2. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  3. double t = 10/81.;
    Print(DoubleToString(t,15)); // tests USDCHF,H1: 0.123456790123457
    
Benjamin
35
Benjamin 2014.09.23 15:47  

Thanks a lot guy ! Have problem to use "print" in my indicator to show the "real" value and not just X.XXXX, got another question, i'll create another topic

 

Okay np WHRoeder 

To add comments, please log in or register