Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access indicator values

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

    Access indicator values

    Hello,

    is it possible to get access by code to all the indicator values of a bar chart like it is shown in the data box. For example I would like to know all the values ten bars ago.

    Regards,

    Thomas

    #2
    Originally posted by FTrader View Post
    Hello,

    is it possible to get access by code to all the indicator values of a bar chart like it is shown in the data box. For example I would like to know all the values ten bars ago.

    Regards,

    Thomas
    Here is a reference sample how to access indicator values correctly:

    Comment


      #3
      Hello Thomas,

      Thank you for your post.

      You can access several different values from # bars ago. For example the Open, High, Low and Close of 10 bars ago could be accessed with the following methods:
      • Open[10]
      • High[10]
      • Low[10]
      • Close[10]

      For information on Data types that can be called in NinjaScript please visit the following link: http://www.ninjatrader.com/support/h...properties.htm

      For information on referencing the correct bar please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=4769

      Please let me know if I may be of further assistance.

      Comment


        #4
        Greetings, I guess the answer does not fully solve the problem. Let's say I need to export not only High and Low of a specific bar, but also corresponding values of all indicators (which are of course unknown when writing the script) in the chart. So, first I need to know which indicators are present in the chart. E.g. I add EMA and MACD indicators, how do I find it out in the NinjaScript, in another indicator? When I have a reference to them, I suppose I can easily access their values using their IDataSeries[BarsAgo]. Thank you.

        Comment


          #5
          Originally posted by mantak007 View Post
          Greetings, I guess the answer does not fully solve the problem. Let's say I need to export not only High and Low of a specific bar, but also corresponding values of all indicators (which are of course unknown when writing the script) in the chart. So, first I need to know which indicators are present in the chart. E.g. I add EMA and MACD indicators, how do I find it out in the NinjaScript, in another indicator? When I have a reference to them, I suppose I can easily access their values using their IDataSeries[BarsAgo]. Thank you.
          After I make the usual caveat about ChartControl being unsupported, and so risky to use, as NT can change it anytime that they wish with no notice (that is what unsupported portends), the indicators on a chart are merely another collection of objects, so you can query them.

          Here is some code to do so, and output their names. You are most certainly going to have to massage the code to get what you seek, but evidently each indicator on the chart can be individually accessed.

          Code:
                      if (CurrentBar == 0) 
                          for (int index = 0; index < ChartControl.Indicators.Length; index++) 
                              Print ("ChartControl.Indicators " + "[" + index.ToString() +"] is " + ChartControl.Indicators[index].Name);
          Open the Output Window and you will see the what the return is.

          Comment


            #6
            That's it, great, thanks a lot.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            636 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            366 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            107 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            568 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            571 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X