Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Plot Values

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

    Accessing Plot Values

    Is it possible for indicators and strategies written in NinjaScript code to access the plots of a locked or third party indicator as values so that my indicator or strategy can use those values?

    For example, indicator A is placed in the chart. It is locked code, but my indicator B wants to get values that are plotted by indicator A so that indicator B can do its own calculations with the plotted values from indicator A.

    Thanks for the information.

    #2
    TriageTrading, even if the code is source protected you could still access the exposed, public plot values of those indicators (for the wizard access you want to ensure the NS indicator wizard generated wrappers are kept intact in the code).

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      TriageTrading, even if the code is source protected you could still access the exposed, public plot values of those indicators (for the wizard access you want to ensure the NS indicator wizard generated wrappers are kept intact in the code).
      Is there some sample or link I can look at for how this is done? Thanks again!

      Comment


        #4
        You can check for example how the MACD Avg Plot would be accessed in NinjaScript, the same structure would apply to your custom indicator and plot(s).

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          You can check for example how the MACD Avg Plot would be accessed in NinjaScript, the same structure would apply to your custom indicator and plot(s).
          So for the MACD case, I would do this to access the value of a plot that is not my own indicator?

          Myvar1 = MACD.Plots[0]; // the first plot of MACD
          Myvar2 = MACD.Plots[1]; // the second plot of MACD
          Myvar3 = MACD.Plots[2]; // the third plot of MACD

          and so forth?

          What if in my code I do not know until run-time of the NinjaScript the name of the indicator I want to access the plot from? For example, is there a generic way to retrieve the second indicator on a chart?

          Is there a generic way to reference indicator 1, 2, 3, etc. in chart? Such as: Indicator[2].plots[1] or some syntax?

          Comment


            #6
            Unfortunately you can't programmatically access what indicator are currently loaded on the chart.

            Just look at how the DataBox would show the indicator plots namewise, this will give you the option to access them in other code as well - the second plot of the MACD is the Avg named one thus this works - double myVar = MACD(10, 20, 5).Avg[0];

            Comment


              #7
              Please check this awesome indicator. He can read data from any indicator in the chart: https://ninjatraderecosystem.com/use...ad/charttocsv/.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              58 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              39 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              19 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              21 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              51 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X