Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DynamicSR Previous Support/Resistance

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

    DynamicSR Previous Support/Resistance

    Hi All,

    I'm wanting to add DynamicSR to a strategy I'm working. Part of that logic is to have the close price above/below the current support and resistance. But I also want to know when the current support/resistance is above/below the previous support/resistance, or X support/resistance levels ago.

    Is there a way to check what previous support/resistance levels are in DynamicSR in order to use for comparison?

    Thank you,
    Ray

    #2
    Hello raysinred,

    The easiest way to check if the data will be useable would be to review the chart and the plots it makes, if you can view the plots on past bars there is a good chance that you can also access that data in a script. You can also use Prints in a script and Print the values of the plot using the BarsAgo that you wanted to check if that corresponds to the plots you see on the chart and is correct for your use.

    Comment


      #3
      HI Jesse,

      Thank you for the response. I'm not sure I completely understand what you are saying. Yes, I can see the previous highs/lows in the chart plot using this indicator. I'm trying to figure out how to access that stored data. For example, with the Swing indicator, you can use the following to find the previous low(s).


      int BarsAgo1 = Swing(SwingStrength).SwingLowBar(0, 1, 300);​ // First previous Low

      int BarsAgo2 = Swing(SwingStrength).SwingLowBar(0, 2, 300);​ // Second previous Low​

      etc...

      Is there something similar with DynamicSR that you can use to access the previous highs and lows within a strategy?

      Thank you,
      Ray

      Comment


        #4
        Hello raysinred,

        I took a look at the upload to the user app share and it appears that item doesn't use plots so it cannot be used for signals.

        Comment


          #5
          Hi Jesse,

          I'm a novice with Ninjascript, so I don't understand how the indicator can plot the continuous support and resistance lines but you cannot access that data. Is there a way to modify the DynamicSR indicator code so that you can access the previous stored high and low data?

          Thanks,
          Ray

          Comment


            #6
            Hello Ray,

            Yes, this would be possible.

            Add a plot with AddPlot(), then set the Value[0] of the plot to the value used for the rendered shape.

            Below is a link to a support article on adding plots.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Thank you for the recommendation. In looking at the version of DynamicSR I have, it already has the following under (State == State.SetDefaults)

              AddPlot(new Stroke(Brushes.Blue, 3), PlotStyle.Line, "Resistance");
              AddPlot(new Stroke(Brushes.Magenta, 3), PlotStyle.Line, "Support");

              Is this what you were referring to?

              Thanks,
              Ray​

              Comment


                #8
                Hello raysinred,

                If the item you are using has plots added to it you should be able to reference those in NinjaScript. You can use the strategy builder to form a condition that uses the indicator and then press view code to get the generated code for using the indicator.

                Comment


                  #9
                  Hi Jesse,

                  Yes, I was able to do that. But it only gives me the support or resistance level for the current bar. I'm looking for previous levels. How do I access previous levels for support and resistance that are plotted?

                  Thank you,
                  Ray

                  Comment


                    #10
                    Hello raysinred,

                    A plot by default will let you access previous bar values you would need to use 1 or more bars ago to do that. If the indicator for some reason does not have past values that would relate to how its designed.

                    Comment


                      #11
                      Jesse,

                      I don't see how that is feasible for a strategy. The bars ago can change for every level and I would have to know beforehand.

                      For the Swing indicator, you can search back across a set range of bars to do this.

                      int BarsAgo1 = Swing(SwingStrength).SwingLowBar(0, 1, 300);​ // First previous Low

                      This searches the last 300 bars for the 1st previous level. I don't have to guess the exact bars ago which is not a feasible option. Why can't we do the same thing with the DynamicSR indicator? Can I modify the DynamicSR indicator to allow this search option for previous levels?

                      Thanks,
                      Ray

                      Comment


                        #12
                        Hello raysinred,

                        It sounds like the indicator you are using was not designed to be used as a signal. The Swing indicator that comes with NinjaTrader also was not designed to be a signal because its plots get updated as it processes. The convenience methods you had shown are a custom set of methods to loop over its data and find instances, that is not something all indicators have and is just for the swing. It sounds like you would need to design your own custom methods if that indicator works in a similar way and has variable periods between changes.

                        Comment


                          #13
                          Hi Jesse,

                          Ok, so I might have an idea how to do that. I can start by just using the current and previous level. A couple questions.

                          I can use the the current level to check if it is different than the previous one an that might get me what I'm looking for. Can I store the previous level as a variable? If I can store it, should I do that in the Indicator, or could I do that in the Strategy?

                          Thanks,
                          Ray

                          Comment


                            #14
                            Hello raysinred,

                            You could do that, it would require using a class level variable to store the value and then use that in comparisons.

                            Comment


                              #15
                              Ok, and I'm assuming I do that in the Strategy?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Yesterday, 05:17 AM
                              0 responses
                              62 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              134 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              75 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              45 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              50 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X