• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

adding volumetric data series through indicator

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

    adding volumetric data series through indicator

    Check out the attached indicator. I am trying to use this in a custom stategy but i get "Error on calling onstatechange method. Object reference not set to instance of an object." Any ideas?
    Attached Files

    #2
    Hello evanp90,

    Thanks for your post.

    The error is advising to check OnStateChange. I recommend adding debugging prints to identify which line of code is throwing the error so you can see which object is null when you are referencing it.

    Please also note that some objects may not be available in State.Configure this can be seen particularly with optimization backtests. Please see AddDataSeries warnings for more details.

    https://ninjatrader.com/support/help...dataseries.htm

    One of these objects is null when the strategy tries to access it. Likely ChartBars. Dynamically adding a data series based on user input or loaded data is not supported because these objects are not guaranteed to be available in State.Configure, but this does work in many cases. For example, using BarsPeriod.Value when adding data may work in many cases, but there are cases where this would not work, like optimization backtests.

    Debugging tips - https://ninjatrader.com/support/help...script_cod.htm

    I look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by countjoemoney, Today, 01:16 PM
    0 responses
    8 views
    0 likes
    Last Post countjoemoney  
    Started by fx.practic, Today, 12:59 PM
    0 responses
    7 views
    0 likes
    Last Post fx.practic  
    Started by TheNomadicAspie, Today, 12:07 PM
    0 responses
    8 views
    0 likes
    Last Post TheNomadicAspie  
    Started by alcorr247, Today, 12:04 PM
    0 responses
    9 views
    0 likes
    Last Post alcorr247  
    Started by firstlanetech, Today, 11:24 AM
    1 response
    22 views
    0 likes
    Last Post firstlanetech  
    Working...
    X