• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Decimals

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Printing Decimals

    Why does Print() not support printing decimal variables in the same manner as any other numeric type?

    Print(double_variable) works. Print(decimal_variable) fails to compile, saying Print() has invalid arguments [cannot convert decimal to bool].

    I know Print(decimal_variable.ToString()) will work, but it is a workaround, not what one would expect.

    This seems inconsistent. If this is a bug, please fix. If it is not a bug, why the difference?

    Thanks.

    #2
    Hello Jeronymite,

    Thank you for your note.

    As you mentioned you should convert the decimal variable to a string to print its value. See Print,
    https://ninjatrader.com/support/help...-us/?print.htm

    I will submit a feature request to allow printing of decimal variables, not requiring the ToString conversion.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Printing Decimals

      Many thanks, Alan. I appreciate the support!

      It certainly makes sense for all numeric types (including decimals) to be treated as known types in Print().

      Comment


        #4
        Hello,

        In NT8 you do not need to specify tostring for decimal types to be printed.

        So the following would work in NT8,

        Code:
        decimal x = 59.5m;
        Print(x);
        I will submit a SFT for NT7 however less hopeful the change will be adapted.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by chnh1, Yesterday, 11:51 PM
        0 responses
        3 views
        0 likes
        Last Post chnh1
        by chnh1
         
        Started by Jasper99, Yesterday, 10:29 PM
        0 responses
        7 views
        0 likes
        Last Post Jasper99  
        Started by Jasper99, Yesterday, 09:50 PM
        0 responses
        2 views
        0 likes
        Last Post Jasper99  
        Started by StevenNelson, Yesterday, 05:57 PM
        0 responses
        5 views
        0 likes
        Last Post StevenNelson  
        Started by srbdoc, Yesterday, 03:59 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_EricB  
        Working...
        X