Rounding/Trunc a number with decimal places?
Author: marron
Creation Date: 3/5/2009 12:52 PM
profile picture

marron

#1
How can I round/trunc number/decimal in WL5.1?

Something like, "DrawText( PricePane, " " + (High[bar]/Close[bar]), 50, 50, Color.Black, Color.White );" .

It draws 10-14 digit decimal number. Thanks.
profile picture

Eugene

#2
QuickRef for FormatChartValue and FormatValue.

Additionally, MSDN or Google for .NET string formatting functions.
profile picture

marron

#3
Thank Eugene for always being helpful. I searched for "Rounding/trunc" but nothing list .. .
profile picture

Eugene

#4
Although the built-in functions are enough for this purpose, Custom Numeric Format Strings can also be helpful.

As our WL5 Wiki FAQ suggests, think .NET and the required function will be found in System.Math:
An equivalent WealthScript function can't be found
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).