Thread: Ask!
View Single Post
  #1010 (permalink)  
Old 03-11-2008, 02:16 AM
Dave137 Dave137 is offline
Senior Member
 
Join Date: Oct 2007
Posts: 230
Dave137 is on a distinguished road
Smile

Quote:
Originally Posted by hiachiever View Post
Dave,

The problem is with this line of code.
ObjectSetText("Spread_Label", DoubleToStr(spread,0), 14, "Ariel", Yellow);

When using DoubleToStr the second option is rounding, ie how many decimal places to round to. In your case you are rounding a two or 4 decimal place number back to "Zero" decimal places.

See Below:
string DoubleToStr( double value, int digits)
Returns text string with the specified numerical value converted into a specified precision format.
Parameters:
value - Floating point value.
digits - Precision format, number of digits after decimal point (0-8).

The correct code should read:
ObjectSetText("Spread_Label", DoubleToStr(spread,Digits), 14, "Ariel", Yellow);
NOTE: Digits is an internal function that returns the number of decimal places for the current symbol.

This should now show you the Spread.

Cheers,
Hiachiever
Thanks,

Dave
Reply With Quote