Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Refering to a dataseries exposed by an indicator from a strategy

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

    Refering to a dataseries exposed by an indicator from a strategy

    Hello,


    I have a pretty complex indicator that:
    - calculates and exposes several dataseries
    - uses another indicator that calculates some other dataseries. That is done via assigning the indicator to a variable, and using that variable to access the dataseries.

    All this is working fine for a long time.

    Now I wanted to use all those in a strategy. So I tried the same way that appears on many posts and in the "indicator methods" section of the help. I assigned the indicator to a variable and tried to use its dataseries.

    The strategy's OnBarUpdate needs those values only on bar# 24 and onwards. When it calls the indicator, its OnBarUpdate is called, yet the bar number inside it is 0 and it then gives error "..on bar 0 Object reference not set to an instance".

    I tried calling it on every bar from the start.
    I tried assigning it to a variable on each OnBarUpdate, or only once in OnStartup.
    I tried accessing the dataseries directly using [] and without a variable.

    All those did not change the behaviour.

    What am I missing here ?

    Thanks

    #2
    OK problem solved

    Just for reference perhaps someone encounters such a problem
    The called indicator calculated and exposed a dataseries yet only for 255 bars
    When the strategy used that dataseries, it on occasion tried to use more bars than that. This is why the indicator itself was working fine, yet when called by the strategy was giving problems

    So the solution was to add to the indicator MaximumBarsLookback setting
    I hope this is helpful for someone

    Comment


      #3
      Hello tickling,

      Thanks for posting the resolution for others!
      JCNinjaTrader 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