• 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 rickyblah12, Today, 08:17 PM
        0 responses
        4 views
        0 likes
        Last Post rickyblah12  
        Started by mrlucky1x, Today, 08:07 PM
        0 responses
        2 views
        0 likes
        Last Post mrlucky1x  
        Started by uday12, Today, 07:21 PM
        0 responses
        3 views
        0 likes
        Last Post uday12
        by uday12
         
        Started by voltlon, Today, 05:18 PM
        0 responses
        6 views
        0 likes
        Last Post voltlon
        by voltlon
         
        Started by Bobisam, Today, 04:57 PM
        0 responses
        8 views
        0 likes
        Last Post Bobisam
        by Bobisam
         
        Working...
        X