Download MetaTrader 5

Data stores in array being changed

To add comments, please log in or register
Hao-Wei Lee
1994
Hao-Wei Lee  

spread


I output the value, Spread should be = ASK - BID

MT4 Build 1065

Keith Watford
Moderator
10570
Keith Watford  

That is correct, 21 points displayed as a double.

Use DoubleToString() in your Print.

ie  DoubleToString(ASK-BID,Digits)

Hao-Wei Lee
1994
Hao-Wei Lee  
Keith Watford:

That is correct, 21 points displayed as a double.

Use DoubleToString() in your Print.

ie  DoubleToString(ASK-BID,Digits)

I am confused,

ASK-BID should be 0.00021,

but it shows 0.000209999999998214..


I store the ASK-BID in array, and output it (0.00020999999)

Keith Watford
Moderator
10570
Keith Watford  
Hao-Wei Lee:

I am confused,

ASK-BID should be 0.00021,

but it shows 0.000209999999998214..


I store the ASK-BID in array, and output it (0.00020999999)


I have already given you the answer.

Keith Watford:

ie  DoubleToString(ASK-BID,Digits)

Print( DoubleToString(ASK-BID,Digits));
whroeder1
16286
whroeder1  
Hao-Wei Lee: but it shows 0.000209999999998214..
Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented exactly. (like 1/10.) Double-precision floating-point format - Wikipedia, the free encyclopedia See also The == operand. - MQL4 forum
To add comments, please log in or register