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).
    BertrandNinjaTrader Customer Service

    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).
        BertrandNinjaTrader Customer Service

        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];
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Newtrader101, Yesterday, 07:36 AM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by SugarDefPrice, Today, 09:40 AM
            0 responses
            4 views
            0 likes
            Last Post SugarDefPrice  
            Started by lorem, 04-25-2024, 09:18 AM
            9 responses
            36 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by funk10101, 04-28-2024, 11:35 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by JuanPabloQuevedo, 10-25-2020, 05:27 PM
            3 responses
            372 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X