Formatted output of numbers
Author: gpwr9k95
Creation Date: 3/27/2018 9:47 PM
profile picture

gpwr9k95

#1
I am using printdebug to print various outputs of my trading system on a screen. Is there a way to print formatted numbers with a given number of digits before and after "."? I found the string.format function, but I don't see examples of using it with numbers.
profile picture

superticker

#2
This Microsoft .NET framework question about the String.Format() method should really be posted to StackOverflow https://stackoverflow.com/, but to answer your question, checkout these two links below:

https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
This one has some simple examples, which include numbers.

https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
This one does the heavy lifting. More than you ever wanted to know about handling different numerical types over different geographical locations.

Questions about Microsoft's examples probably should be directed to StackOverflow.

Quick Wealth-Lab example:
CODE:
Please log in to see this code.
will print $0.23=EPS(mrq); for the earns-per-share and print 0.23>qtrEst for positive quarter estimates and -0.23<qtrEst for negative estimates.
profile picture

gpwr9k95

#3
Thank you. That helped.
profile picture

Eugene

#4
QUOTE:
Is there a way to print formatted numbers with a given number of digits before and after "."?

While superticker's answer is correct, gpwr9k95's task can be solved even easier than using String.Format. Check out Bars.FormatValue in the QuickRef (F11 key in Wealth-Lab). Although it's not as flexible as string.Format is, it automatically adjusts to the number of Decimal Places you have specified in Wealth-Lab's Preferences > Advanced Options.
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).