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 Pattontje, Yesterday, 02:10 PM
        2 responses
        15 views
        0 likes
        Last Post Pattontje  
        Started by flybuzz, 04-21-2024, 04:07 PM
        17 responses
        229 views
        0 likes
        Last Post TradingLoss  
        Started by agclub, 04-21-2024, 08:57 PM
        3 responses
        17 views
        0 likes
        Last Post TradingLoss  
        Started by TradingLoss, 04-21-2024, 04:32 PM
        4 responses
        44 views
        2 likes
        Last Post TradingLoss  
        Started by cre8able, 04-17-2024, 04:16 PM
        6 responses
        57 views
        0 likes
        Last Post cre8able  
        Working...
        X