Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Formatting problem

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

    Formatting problem

    Hi guys,


    I have a formatting proble. I am trying to get a double from an indicator with the two digit format.

    My code is :
    String.Format("{0:0.00}",Myindicator().Values[0]);


    I always get a result like : 2.64348248203103

    I would like to keep only two digit after the dot...

    Bernard

    #2
    Bernard, did you try truncating this with Math.Truncate?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I don't know why but i solved my problem this way :

      I created a new double value in the exporting indicator which exposed the same variable. The formatting code was then applied and it worked !


      Thanks

      Bernard

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by DustyContrer, Today, 04:02 AM
      0 responses
      3 views
      0 likes
      Last Post DustyContrer  
      Started by ETFVoyageur, Today, 02:15 AM
      0 responses
      11 views
      0 likes
      Last Post ETFVoyageur  
      Started by Board game geek, Today, 01:34 AM
      0 responses
      9 views
      0 likes
      Last Post Board game geek  
      Started by morrnel, 05-12-2024, 06:07 PM
      3 responses
      43 views
      0 likes
      Last Post wzgy0920  
      Started by FishTrade, Yesterday, 11:11 PM
      0 responses
      7 views
      0 likes
      Last Post FishTrade  
      Working...
      X