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.
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #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,


    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().
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      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 timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X