Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Series Value is Zero

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

    Series Value is Zero

    Need a bit of help on creating a series. I've got the following code snip to create myMACDDiff series. The problem is that referencing myMACDDiff[1] always has 0.

    Code:
    protected override void OnBarUpdate()
            {
    
    
                double MACDDiff = MACD(MACDfast, MACDSlow, MACDSignalLength)[0];
                Series<double> myMACDDiff = new Series<double>(this);
                myMACDDiff[0] = MACDDiff;
    What have I done wrong?

    #2
    Data series should be created in state DataLoaded and stored as a global indicator/strategy/etc. class variable.

    Comment


      #3
      Fixed. Thank you.

      Comment


        #4
        Hello Kentoes,

        MojoJojo is correct. If you are declaring something in OnBarUpdate() then it will only exist in that run of OnBarUpdate() and then will cease to exist.

        Below is a link to the help guide on declaring custom series.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X