Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Donchian Channel

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

    Donchian Channel

    In Strategy Builder if I want to compare the high or close of the last bar (1) to say the highest high or close of the prior 5 bars (2 through 6) is it possible? I think I can use the Donchian Channel for the highest high but can it also be used in comparing closes?
    Thank you.

    #2
    Hello Trader17,

    Thanks for your additional question.

    It would be possible to use the MAX and MIN indicators to return the highest high and the lowest low from a requested period of time based off of the desired input series. For example, you could use High as Input for MAX for the the "Highest high" in a requested period of time. You could use Close as the input series as well.

    The indicator would be set up similarly where you would be looking at a bars ago reference to retrieve a value, and the period would be how far back to look from that point. So a bars ago index of 2 and a period of 5 would be the indicator value given from the bar before last, going back 5 bars.

    In case you have not seen the Strategy Builder 301 tutorial, I highly recommend viewing it to learn the ins and outs of the Strategy Builder.

    Strategy Builder 301 - https://www.youtube.com/watch?v=HCyt90GAs9k

    I will also include documentation links for MAX and MIN if you wish to reference further how these methods work.

    Max - https://ninjatrader.com/support/help...aximum_max.htm

    Min - https://ninjatrader.com/support/help...inimum_min.htm

    If you have any additional questions, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      So the indicator value is the bars to look for and the displacement is the offset? So displacement 2 means start back from bar 2?

      Comment


        #4
        Hello Trader17,

        I am not entirely clear on what you mean by "So the indicator value is the bars to look for." An indicator will return a value depending on its bars Ago reference and the amount of data it should look at which would be the period. The bars Ago would refer to complete indicator calculations based on the input data.

        Code:
        double value = MAX(High, 20)[0];
        Highest value starting at Bars Ago 0 (the current bar), going back 20 bars. (BarsAgo 0 to BarsAgo 20)

        Code:
        double value = MAX(High, 20)[1];
        Highest value starting at Bars Ago 1, going back 20 bars (BarsAgo 1 to BarsAgo 21)

        Displacement refers to how that plot should be visually offset, into the future.

        I've included documentation on Displacement for your reference - https://ninjatrader.com/support/help...splacement.htm

        If there is something you would like clarified on indicator plots, please let me know.
        JimNinjaTrader Customer Service

        Comment


          #5
          Thank you. I was referring to the indicator MIN and MAX. So if I want to suppose see the MAX or highest in bars 3-7 then is there an input for that in the indicator? Similar to highest of 5 bars starting from bar 3.

          Comment


            #6
            Yes, the number of bars you want to use in the calculation would be the Period and the point you want to look back from would be the barAgo value.

            Max(High, Period)[barsAgo]
            Max(High, 7)[3]
            Max(High, 5)[3]

            Keep in mind, a barsAgo index starts at the current bar going backwards. Using CurrentBar in a barsAgo reference can reference the first bar that is drawn in the data series.

            CurrentBar - https://ninjatrader.com/support/help...currentbar.htm

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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by r68cervera, Today, 05:29 AM
            0 responses
            2 views
            0 likes
            Last Post r68cervera  
            Started by geddyisodin, Today, 05:20 AM
            0 responses
            3 views
            0 likes
            Last Post geddyisodin  
            Started by JonesJoker, 04-22-2024, 12:23 PM
            6 responses
            33 views
            0 likes
            Last Post JonesJoker  
            Started by GussJ, 03-04-2020, 03:11 PM
            12 responses
            3,239 views
            0 likes
            Last Post Leafcutter  
            Started by AveryFlynn, Today, 04:57 AM
            0 responses
            6 views
            0 likes
            Last Post AveryFlynn  
            Working...
            X