Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 GwFutures1988, Today, 02:48 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by ScottWalsh, 04-16-2024, 04:29 PM
      6 responses
      28 views
      0 likes
      Last Post ScottWalsh  
      Started by frankthearm, Today, 09:08 AM
      10 responses
      36 views
      0 likes
      Last Post frankthearm  
      Started by mmenigma, Today, 02:22 PM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by NRITV, Today, 01:15 PM
      2 responses
      9 views
      0 likes
      Last Post NRITV
      by NRITV
       
      Working...
      X