Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding indicator on a secondary data series

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

    Adding indicator on a secondary data series

    Hi experts,

    Currently, I am using a range chart + AroonOscillator indicator.

    My code goes like this:
    Code:
    myAroonOscillator = AroonOscillator(25);
    myAroonOscillator.Plots[0].Brush = Brushes.DarkGreen;
    myAroonOscillator.Plots[0].PlotStyle = PlotStyle.Bar;
    myAroonOscillator.Plots[0].AutoWidth = true;
    AddChartIndicator(myAroonOscillator);​
    I wanted to use the oscillator on a 5min timeframe instead so I added this
    Code:
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Minute, 5);
    }
    and modified the indicator code to
    Code:
    myAroonOscillator = AroonOscillator(BarsArray[1],25);
    myAroonOscillator.Plots[0].Brush = Brushes.DarkGreen;
    myAroonOscillator.Plots[0].PlotStyle = PlotStyle.Bar;
    myAroonOscillator.Plots[0].AutoWidth = true;
    AddChartIndicator(myAroonOscillator);​
    Now my indicator part of the chart is just blank. I can get a value off the variable myAroonOscillator​​ though. So I assume I am missing something and resulting in a display issue. Any advice ?

    #2
    Hello elirion,

    Thank you for your post.

    From the Help Guide page on AddChartIndicator:

    An indicator being added via AddChartIndicator() cannot use any additional data series hosted by the calling strategy, but can only use the strategy's primary data series.

    If you wish to use a different data series for the indicator's input, you can add the series in the indicator itself and explicitly reference it in the indicator code (please make sure though the hosting strategy has the same AddDataSeries() call included as well)

    https://ninjatrader.com/support/help...tindicator.htm

    Below is a link to an example of plotting a higher time frame on a lower time frame.

    https://ninjatrader.com/support/foru...196#post820196

    Please let us know if you have any additional questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X