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

Databox display

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

    Databox display

    I have an integer that acts like an Id based on information from the bar. Everything works as expected with the exception that the value in the data box is displayed with a decimal (the value is always an integer) which is not fatal but is annoying. Is it possible to format this calculated value as an integer in the same manner as the Volume indicator (i.e. as a whole number with no decimal point)?
    Last edited by ScottB; 06-20-2022, 08:49 AM. Reason: Edited to add a tag

    #2
    Hi Scott, thanks for writing in. The Plots are always a Series<double> object, so the decimal place is not avoidable in the databox. Double values in C# will always have a decimal point.

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Chris, Thank you for getting back to me so quickly. That was my suspicion but I figured it didn't hurt to ask. Even after all these years of using NinjaTrader, I learn new things about it all the time.

      Comment


        #4
        Hi Scott, on second thought, as you said the VOL indicator has no issue displaying integer values. Could you post the script you are working on so I can have a look?
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          It is a simple calculation of the number of minutes between two date time values - the current bar's time and a historical time. I use it to align events over a large number of systems. So if you can display literally any integer in the data box that would be all I need.

          Comment


            #6
            Hi Scott, try casting the value you are using e.g.

            IntPlotExample[0] = (int)SomeValue;

            I tried a simple test:

            IntPlotExample[0] = CurrentBar;

            Where CurrentBar is already an integer, and I do not get any decimal in the databox.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Chris, how do you have IntPlotExample[ defined? If set my plot values to an int series, I get a message saying cannot convert to NinjaTrader.NinjaScript.Series<double> which makes sense but I am not sure how I get from Values[0] (a double) to Id[0] (an int). I am getting hung up on the plot variable definition (not the AddPlot itself, just the variable declaration)

              Comment


                #8
                Hi Scott, that name is a little misleading because Plots will always be Series<double> objects under the hood. I attached my example here if you would like to take a look. Im assuming the calculation you are doing in your script is coming out as a double value.

                Kind regards,
                -ChrisL
                Attached Files
                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kevinenergy, 02-17-2023, 12:42 PM
                116 responses
                2,757 views
                1 like
                Last Post kevinenergy  
                Started by franatas, 12-04-2023, 03:43 AM
                7 responses
                106 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by jpapa, Today, 07:22 AM
                0 responses
                3 views
                0 likes
                Last Post jpapa
                by jpapa
                 
                Started by Jltarrau, Today, 05:57 AM
                3 responses
                8 views
                0 likes
                Last Post Jltarrau  
                Started by f.saeidi, Today, 05:56 AM
                2 responses
                8 views
                0 likes
                Last Post NinjaTrader_Erick  
                Working...
                X