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 ATMtrader0001, Today, 02:53 PM
        0 responses
        2 views
        0 likes
        Last Post ATMtrader0001  
        Started by tomd, Today, 02:38 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Jim  
        Started by Petrv333, Today, 02:03 PM
        1 response
        11 views
        0 likes
        Last Post NInjaTrader_MaxH  
        Started by stafe, Today, 12:34 PM
        2 responses
        23 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by asmmbillah, Today, 11:18 AM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X