• 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

How to get digits of current chart/underlying?

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

    How to get digits of current chart/underlying?

    Is there any builtin function/constant (like TickSize), which says what is the precision (digits after dot) for the given chart?

    I am custom method created for that (like `if (TickSize== 0.1) digits=2;`...) , but i am interested if there exists anything simpler...

    #2
    Hello TazoTodua,
    Thanks for your post.

    What precision for the chart are you referring to? The price?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      yes, for example, for EURUSD price is about: 1.12345 (so, precision is 5), for AAPL, i.e. 123.12 (so, precision is 2)

      is there anything for that? in MetaTrader there is `Digits` constant, in addition to TickSize constant (or whatever is there).

      Comment


        #4
        TazoTodua,

        It looks like the only way to change the price 'precision' on the chart is by changing the TickSize of the instrument manually.

        I do see that there is already a feature request to create an NinjaScript method to set the tick size for the y-axis of a chart panel, so I went ahead and added a vote on your behalf. The internal tracking number for this feature request is SFT-621. Please reference this internal tracking number if you ever have questions regarding this feature request.

        Let me know if there is anything else I can do to assist.

        Josh G.NinjaTrader Customer Service

        Comment


          #5
          NinjaTrader_JoshG no, you really misunderstand what i asked, i absolutely not related with ticksize or changing it or axis-es... I just asked, if i can get how many decimals does current chart have, where is the indicator applied?
          Is there any Method or Pre-defined variable for that?

          Comment


            #6
            TazoTodua,

            I just asked, if i can get how many decimals does current chart have, where is the indicator applied?
            Is there any Method or Pre-defined variable for that?
            No, there is not a method or predefined variable for that.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              You can try something like:
              int size = TickSize.ToString().Length;
              Print("TickSize = " + TickSize + " Tick decimals = " + (size-2));
              eDanny
              NinjaTrader Ecosystem Vendor - Integrity Traders

              Comment


                #8
                eDanny thanks! but I doubt it might have glitches? for example, when symbol ticksize is 1 (or more). I think, we should still wrap that in method with all probably values

                Comment


                  #9
                  Try it and print to the output window. Change charts to instruments of all varying tick sizes and see if it fails. If it doesn't, use it. There is no reason to put it in a method because it only needs to calculate once, on startup.
                  eDanny
                  NinjaTrader Ecosystem Vendor - Integrity Traders

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Audiofail, Today, 05:40 AM
                  6 responses
                  18 views
                  0 likes
                  Last Post willwin
                  by willwin
                   
                  Started by jerblaster23, Today, 03:42 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by brian meade, Today, 01:39 PM
                  2 responses
                  10 views
                  0 likes
                  Last Post brian meade  
                  Started by Johnny Santiago, Today, 12:20 PM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by NinjaTrader_Brandon, Today, 10:24 AM
                  0 responses
                  69 views
                  0 likes
                  Last Post NinjaTrader_Brandon  
                  Working...
                  X