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

How to display values of my Series<> in data box

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

    How to display values of my Series<> in data box

    I have created a series for holding some values among my variables as follows:

    private Series<int> TPO_BLdiff_Series;

    and added the following code in the OnStateChange() method:

    if (State == State.DataLoaded)
    {
    // "this" refers to the NinjaScript object itself. This syncs the Series object to historical data bars
    // MaximumBarsLookBack determines how many values the Series<double> will have access to

    TPO_BLdiff_Series = new Series<int>(this, MaximumBarsLookBack.Infinite);
    }

    For the OnBarUpdate() method, I have calculated values and added them to my series as follows:

    //my code for calculating and storing values

    if(VAt.IsValidDataPoint(0) && POC.IsValidDataPoint(0) && VAb.IsValidDataPoint(0))
    {
    TPO_BLdiff_Series[0] = Convert.ToInt32(100*(POC[0]-VAb[0]));
    }

    Now the hurdle I have been unable to overcome is how to display the values of my series in the data box. I don't know how to code the xml of the Properties region to achieve this so that if I hover my mouse cursor above a bar on the chart, I can see the value of TPO_BLdiff_Series for that bar in the data box. I have reached the limits of my programming know-how and would highly appreciate if someone could kindly help me to accomplish my desired task. Many thanks in advance.

    #2
    Hello mbesha,
    Thanks for your post.

    You need to assign your series to 'Value'. Try this.

    Code:
    if(VAt.IsValidDataPoint(0) && POC.IsValidDataPoint(0) && VAb.IsValidDataPoint(0))
    {
    	TPO_BLdiff_Series[0] = Convert.ToInt32(100*(POC[0]-VAb[0]));
    	Value[0] = TPO_BLdiff_Series[0];
    }
    Help Guide - Value
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Thanks JoshG. Does this hold true if I already have other Values[] in the indicator? As it stands, there are already Series<> objects ranging from Values[1] to Values[6] that are plotted on the chart.

      Comment


        #4
        Yes, you would need to assign a Value[] to any series to have it appear in the data box. You can assign as many Values as you like to appear in the data box starting at an index of zero.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rtwave, Today, 01:49 PM
        0 responses
        6 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Started by papaoutai, Today, 08:56 AM
        0 responses
        22 views
        0 likes
        Last Post papaoutai  
        Started by jdspwe, Today, 05:22 AM
        0 responses
        13 views
        0 likes
        Last Post jdspwe
        by jdspwe
         
        Started by JeremuFemstu, Today, 04:49 AM
        0 responses
        16 views
        0 likes
        Last Post JeremuFemstu  
        Started by pjsmith, Today, 04:11 AM
        1 response
        21 views
        0 likes
        Last Post Green Lobster CBD  
        Working...
        X