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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      68 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      61 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X