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

Using Multiple Timeframes with Add()

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

    Using Multiple Timeframes with Add()

    Hello all.

    I am trying to code an indicator that work on say a 1 minute timeframe but looks at the value of a specific indicator on the 5 minute chart.

    I have coded the following so far

    protectedoverridevoid Initialize()
    {
    Add(PeriodType.Minute, 5);
    CalculateOnBarClose = true;
    Overlay = true;
    PriceTypeSupported = false;
    }
    protectedoverridevoid OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;
    if (CrossAbove(DM(5).DiPlus,DM(5).DiMinus,1)&& Stochastics(3,8,5).D[0] < Stochastics(3,8,5).K[0] && DM(BarsArray[1], 5)[0].DiPlus > DM(BarsArray[1], 5)[0].DiMinus )
    DrawArrowUp(CurrentBar.ToString(), true, 0, Low[0] - 0.0005, Color.Green);
    if (CrossBelow(DM(5).DiPlus,DM(5).DiMinus,1)&& Stochastics(3,8,5).D[0] > Stochastics(3,8,5).K[0] )
    DrawArrowDown(CurrentBar.ToString(), true, 0, High[0] + 0.0005, Color.Red);
    }

    My problem is that when I call the Add() line uder Inialize, I get an error telling me that "No overload for method "Add" take 2 arguements. I'm not sure what it wants since the line is taken directly from sample code in the help file.

    What am I doing wrong if I would like to look at the adx on the 5 minute chart before drawing my indicator?

    Thanks in advance for any help.

    #2
    wcmaria,

    Multi-series indicators will be available in NT7. You currently cannot do this.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi Josh, is what I am trying to do not similar to what was discussed in the following thread you responded to a while back -

      It is all possible. To work with multiple time frames first read http://www.ninjatrader-support.com/H...ameInstruments.

      To make the time frames variable you would simply need to code user selectable parameters. Be careful when you code though. The first time frame will always be whatever time frame the chart which you loaded the strategy onto is set at. If you want your strategy to work regardless of what time frame the chart/strategy analyzer is on and just solely based on your user inputs you should probably add two more time periods to your strategy. You would negate the first time period (the chart's time period) from all calculations in this instance.

      Does this still not work in version 6?

      Comment


        #4
        Josh's comment was about MultiInstrument / MultiTime strategies, those are possible with NinjaTrader 6.5

        NinjaTrader 7 will offer this concept for indicators as well.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by andrewtrades, Today, 04:57 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by chbruno, Today, 04:10 PM
        0 responses
        3 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Started by josh18955, 03-25-2023, 11:16 AM
        6 responses
        436 views
        0 likes
        Last Post Delerium  
        Started by FAQtrader, Today, 03:35 PM
        0 responses
        7 views
        0 likes
        Last Post FAQtrader  
        Started by rocketman7, Today, 09:41 AM
        5 responses
        19 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X