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 SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      50 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      16 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      22 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      23 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X