Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Data Series?

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

    Data Series?

    I need a bit of clarification, updating NT7 code to NT8, on the data series. My current NT7 code is:

    private DataSeries Med;

    protected override void Initialize() {
    Med = new DataSeries(this, MaximumBarsLookBack.Infinite);
    }

    protected override void OnBarUpdate() {
    Med.Set((High[0]+Low[0])/2);
    }



    From help page http://ninjatrader.com/support/helpGuides/nt8/en-us/, I'm not sure how this convert into NT8? Something like

    Series Med = new Series(this);

    protected override void OnStateChange() {
    Med = new DataSeries(this, MaximumBarsLookBack.Infinite);
    }

    protected override void OnBarUpdate() {
    Med.Set((High[0]+Low[0])/2);
    }

    Would this be correct? Thanks

    #2
    Hello timmbbo,

    Thanks for your post.

    Above the OnStateChange() method you would need to add a variable declaration of:
    private Series<double> Med;

    In the OnStateChange() method add (as part of the
    if (State == State.SetDefaults)
    {....
    }
    else if (State == State.DataLoaded)
    {
    Med = new Series<double>(this, MaximumBarsLookBack.Infinite);
    }

    In the OnBarUpdate() method:

    Med[0] = (High[0]+Low[0])/2; The .Set() is no longer used.

    From the NT8 helpguides Code breaking changes: "The DataSeries.Set() method used to assign Data Series or Plot values has been removed and values can now be stored using a single assignment operator:" Reference: http://ninjatrader.com/support/helpG...ng_changes.htm

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    156 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    90 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    139 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    130 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X