• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Values of DynamicSRLines

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

    Values of DynamicSRLines

    https://ninjatraderecosystem.com/use...amicsrlines-2/

    How do I extract the values of DynamicSRLines for my strategy?
    How do I get the values of L1, L2, L3 of Resistance and Support?

    I tried DynamicSRLines.SL1[0]
    which isn't working.

    Thank you!

    #2
    Hello johnnybegoode,

    Thanks for your post.

    You can check the indicator's source code to see if it exposes information through plots or creates public properties that can be accessed from other scripts.

    This indicator does not add any plots, so it would have to be modified in order for a strategy to access it. Our documentation on AddPlot describes how plots can be added and how values can be set. If you right click on the Indicators folder in the NinjaScript Editor and select New Indicator, you could add a plot there and a Series<double> will be added that matches the plot name. You can then follow the syntax created by the New Indicator Wizard to add plots to this indicator, and those plots can then be accessed by the strategy.

    AddPlot() - https://ninjatrader.com/support/help...t8/addplot.htm

    The indicator draws lines with Draw.Line, and the information that is used to create the line would then be used to set a plot value.

    Please let us know if you have any questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Could you show me one example like how to AddPlot for SL1,
      so I could figure out the rest of them?
      Thank you!

      Comment


        #4
        Hello johnnybegoode,

        AddPlot can be called in OnStateChange under State.SetDefaults.

        Code:
        protected override void OnStateChange()
        {
          if (State == State.SetDefaults)
          {
            Name = "Examples Indicator";
        
            // Add three plots and associated Series<double> objects
            AddPlot(Brushes.Blue, "PlotA");     // Defines the plot for Values[0]
            AddPlot(Brushes.Red, "PlotB");     // Defines the plot for Values[1]
            AddPlot(Brushes.Green, "PlotC");   // Defines the plot for Values[2]
          }
        }
        Please reference the Draw.Line documentation for more information on what each parameter is used for. This will direct you further to what would be assigned as the plot value.

        https://ninjatrader.com/support/help...?draw_line.htm

        For example, we see the line:

        Draw.Line (this, "supLine"+level, false, 0, p-((ZoneTickSize*TickSize)/2), MaxLookBackBars, p-((ZoneTickSize*TickSize)/2), ColorBelow, DashStyleHelper.Solid, 1);

        The line is being drawn at p-((ZoneTickSize*TickSize)/2)

        Each plot would need to be assigned this value. Since as a loop is used, you can use "level" when you are referencing the Values Series.

        Values[level-1][0] = p-((ZoneTickSize*TickSize)/2);

        If this is too difficult, I would recommend first building a simple test indicator that assigns Close[0] to Values[0][0] following the AddPlot documentation. A consultant could also be considered to make these modifications for you.

        Let me know if I can be of further assistance.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ChazJ, Today, 02:54 PM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Boonfly8, Today, 02:04 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by Branpo, Today, 01:25 PM
        5 responses
        11 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by aslane, Today, 12:47 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by HavasuTrader, Today, 12:30 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Working...
        X