Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in Adding a next-time frame indicator into a stategy

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

    Error in Adding a next-time frame indicator into a stategy

    Hello Everyone,

    In coding my strategy I wanna add an 50mins RSI to the chart, and I did the following code:

    Code:
    protected override void Initialize()
            {
                            Add(PeriodType.Minute,50);
    			Add(HiLoActivator(length));
    			Add(MyDM(dMPeriod));
    			Add(RSI(BarsArray[1],rSIPeriod,rSISmooth));
    			CalculateOnBarClose = true;
            }
    But it does not work with the Strategy Analyzer, when I click on the strategy the parameters does not show up.

    And when I delete the following line:

    Code:
    Add(RSI(BarsArray[1],rSIPeriod,rSISmooth));
    it work all right with the Strategy Analyzer, anyone knows why is this happening ?

    #2
    Hello wolfcuring,

    Thank you for your post.

    This is because the BarsArray cannot be accessed within the Initialize() method. If you wish to plot an indicator from your second data series you will need to create a new Plot for that indicator and then use BarsArray[1] in the OnBarUpdate() method. The following forum post gives an example of doing this: http://www.ninjatrader.com/support/f...ad.php?t=53024

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you PatrickH, I will give a try.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X