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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    63 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    90 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    47 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    105 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    63 views
    0 likes
    Last Post PaulMohn  
    Working...
    X