Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting an Indicator on a DataSeries

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

    Plotting an Indicator on a DataSeries

    I know it is possible to plot an indicator on a backtest chart by using the Add() method in the Strategy's Initialize() method (this is shown here).
    However, if I try to add an indicator which accepts a DataSeries object, NinjaTrader crashes with 'Stack overflow'.
    For example, the following code causes the crash:
    Code:
    private DataSeries mySeries;
    protected override void Initialize()
    {  
        mySeries = new DataSeries(this);            
        Add(SUM(mySeries, 10));
        CalculateOnBarClose = true;
    }
    Using the default DataSeries does not crash:
    Code:
    protected override void Initialize()
    {  
        Add(SUM(10));
        CalculateOnBarClose = true;
    }

    Is it possible to Add() an indicator to the chart where its input is a custom DataSeries object?

    Thanks,
    Boaz

    #2
    Hello Boaz,
    Unfortunately you cannot reference any other dataseries while adding an indicator via the initialize section of the strategy.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    320 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    203 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    187 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    283 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    234 views
    0 likes
    Last Post CarlTrading  
    Working...
    X