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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      388 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      260 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      218 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      302 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      268 views
      0 likes
      Last Post CarlTrading  
      Working...
      X