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 NullPointStrategies, Today, 05:17 AM
    0 responses
    24 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    120 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X