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 > All Time High

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

    Donchian Channel > All Time High

    I am looking to build an indicator such as the Donchian Channel but instead of using a given period I would like to be able to see a plot of the all time high. Does Kinetick offer this type of data? How would I go about doing this? Thank you.

    #2
    cfree,

    The all time high can be calculated from an indicator as long as you have historical data availability. You can set "Bars to load" to "infinite" and check for a high as far back as you want. Unfortunately I am not aware of any data providers that offer all time high as some sort of data you can query.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      How far back does Kinetick pull data from? 10 years, 20 years, 30 years?

      Comment


        #4
        cfree,

        10 years for most instruments on daily data. As such you could get the highs from 10 years of data on a daily data series.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          So for instance, what would I input for period on the donchian indicator considering that the date of the ipo of a stock is unknown? I don't want to manually see where every stock began trading to adjust my period for each stock I load? Also, if I pull this into a strategy, I don't want to put a mock number, say 1,000,000 days, and have the program be screwy. (maybe it won't, haven't tried it yet.)

          Comment


            #6
            cfree,

            Keep in mind 10 years is 3650 days + some for leap years. This code works so far on a daily chart :

            Code:
                    protected override void Initialize()
                    {
                        Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.HLine, "Plot0"));
                        Overlay				= true;
            			MaximumBarsLookBack = MaximumBarsLookBack.Infinite;
                    }
            
                    /// <summary>
                    /// Called on each bar update event (incoming tick)
                    /// </summary>
                    protected override void OnBarUpdate()
                    {
            			
            			
            			if(CurrentBar < 1)
            			{
            				return;
            			}
            			
            	               if(High[0]>highestval)
            			{
            				highestval = High[0];
            			}
            			
                        // Use this method for calculating your indicator values. Assign a value to each
                        // plot below by replacing 'Close[0]' with your own formula.
                        Plot0.Set(highestval);
                    }
            I checked out MNKD which had an IPO back in October of 05 and it seems to work fine.

            Please keep in mine I am using a horizontal line that will change only visually if you look back into the past. You would probably want to draw a static line or something.
            Last edited by NinjaTrader_AdamP; 02-15-2012, 09:49 AM.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Yes, that code looks good and yes I am looking for something to plot like the upper end of the Donchian Channel. In terms of code, I want the Max(High, Infinite) where infinite is the period. For some reason, I can't think of a good way to code this considering everything mentioned previously.

              Your code marks the high on given stock but won't move lower if the high of say Ford is lower than Apple.

              Comment


                #8
                cfree,

                If you want more rules related to multiple stocks it would require extra coding steps, however the main idea is there.

                There will only be a maximum of 10 years of data most of the time, so just setting a large look back period on your chart would be enough, say 10,000 days or something. That is already almost 30 years.

                Please let me know if I may assist further.
                Adam P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                2 views
                0 likes
                Last Post Perr0Grande  
                Started by elderan, Today, 08:03 PM
                0 responses
                5 views
                0 likes
                Last Post elderan
                by elderan
                 
                Started by algospoke, Today, 06:40 PM
                0 responses
                10 views
                0 likes
                Last Post algospoke  
                Started by maybeimnotrader, Today, 05:46 PM
                0 responses
                12 views
                0 likes
                Last Post maybeimnotrader  
                Started by quantismo, Today, 05:13 PM
                0 responses
                7 views
                0 likes
                Last Post quantismo  
                Working...
                X