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

Multiple Timeframe with DO

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

    Multiple Timeframe with DO

    Hello. I am utilizing the DerivativeOscillator indicator within a strategy working off of a 5 minute chart. I would like to add the 20 minute DerivativeOscillator to the same strategy but don't see how to reference the data as I might with BarsInProgress; for example.

    Is it possible to do this with Add(PeriodType.Minute, 20); perhaps?

    Thanks for the help and insight!


    Brian

    #2
    Hello brirob14,

    Thank you for your inquiry.

    Yes, you would first want to add that 20 minute Bars object to your strategy first.

    You can then call the DerivativeOscillator indicator and utilize that secondary Bars object as your input for the indicator.

    I would recommend reading this link in the NinjaTrader help guide for further information about working with multi-time frame & instruments: http://ninjatrader.com/support/helpG...nstruments.htm

    The most relevant section would be "Using Bars Objects as Input to Indicator Methods".

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply Zachary and I'm following everything you are suggesting. However, my problem pertains to the DerivativeOscillator indicator not taking an input other than 4 parameters which are Period, Smooth1, Smooth2, and Smooth3. I don't see where it is possible to reference a secondary bars object.

      Hope this helps to clarify.

      Thanks.


      Brian

      Comment


        #4
        i suggest u make the indicator into a series.

        i give you an example for the macd.


        variable to add
        private MACD macdindicator;
        private DataSeries macdSeries;
        protected override void Initialize()
        macdSeries = new DataSeries(this);
        Add(PeriodType.Minute, 5);
        this can be accessed by using BarsArray[1], while BarsArray[0] would be your regular dataseries input

        so
        protected override void OnBarUpdate()
        macdindicator= MACD(BarsArray[1],fast,slow,smooth);
        macdSeries.Set(macdindicator[0]);
        from now on you can use the macdSeries just like always and its takin its data from the other timeframe

        so for example
        if (macdSeries[0]>0){
        do something
        }
        important to note, if your using this and then use further if or other statements inside it you might have to call
        if (BarsInProgress == 0){
        again to get the datacollection back to ur maintimeframe.

        if (macdSeries[0]>0){
        if (BarsInProgress == 0){
        GoLong();
        }
        }
        Last edited by BigRo; 09-24-2015, 04:20 AM.

        Comment


          #5
          Originally posted by brirob14 View Post
          Thanks for the reply Zachary and I'm following everything you are suggesting. However, my problem pertains to the DerivativeOscillator indicator not taking an input other than 4 parameters which are Period, Smooth1, Smooth2, and Smooth3. I don't see where it is possible to reference a secondary bars object.

          Hope this helps to clarify.

          Thanks.


          Brian
          Hello Brian,

          All indicators made in NinjaScript will have two overloads: one without the ability to utilize a different Bars object and one that does.

          When calling the DerivativeOscillator in your strategy, upon typing your opening parenthesis, a quick info box appears with the parameters for the overload. The quick info box should state "1 of 2". If you press the down arrow key on your keyboard, it should show you an alternative overload with "IDataSeries input" as the first parameter.
          Zachary G.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          30 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          942 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          9 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by rocketman7, Today, 01:00 AM
          0 responses
          4 views
          0 likes
          Last Post rocketman7  
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          28 views
          0 likes
          Last Post wzgy0920  
          Working...
          X