• 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

Error on calling 'EventHandlerBarsUpdate' method

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

    Error on calling 'EventHandlerBarsUpdate' method

    I am finding this error in my trace file: Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object.
    That is the only line in the trace file showing any indication of an error.

    This occurs when I have already successfully loaded my strategy on a chart and then try to load an indicator from the Indicators panel.
    The strategy loads several indicators using AddChartIndicator(). None of the indicators load any additional DataSeries.

    When the error occurs, the strategy is turned off and left in an abandon state, evidenced by the fact that OnStateChange is never called for the Terminated state.
    If I re-enable the strategy, I get a second instance loaded onto the chart and there is evidence the old one is still there,

    I am running beta 10.

    What to do?

    Gary

    #2
    Hello GaryAlbers,

    Thank you for your post.

    So I may investigate this behavior further on my end please provide the following information.

    You state you try to load indicators and that message appears, does it prevent the indicators from loading? Does it prevent the Indicators menu from showing up on your screen?

    The indicators in the strategy added through AddChartIndicator(), are these all custom or pre-loaded indicators? How many times is AddChartIndicator() called in your strategy?

    Can you send us your Log and Trace files for when this occurred? You can send the files by going to Help > Email Support. Please list 'ATTN: Patrick H - 1505828' in the subject line.
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by GaryAlbers View Post
      I am finding this error in my trace file: Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object.
      That is the only line in the trace file showing any indication of an error.

      This occurs when I have already successfully loaded my strategy on a chart and then try to load an indicator from the Indicators panel.
      The strategy loads several indicators using AddChartIndicator(). None of the indicators load any additional DataSeries.

      When the error occurs, the strategy is turned off and left in an abandon state, evidenced by the fact that OnStateChange is never called for the Terminated state.
      If I re-enable the strategy, I get a second instance loaded onto the chart and there is evidence the old one is still there,

      I am running beta 10.

      What to do?

      Gary
      Welcome to my world.

      http://ninjatrader.com/support/forum...ad.php?t=83133

      Comment


        #4
        I reproduced error

        I created a test strategy that reproduces the error.
        Zip file is attached (I exported as source code).
        The strategy simply calls AddChartIndicator on 4 standard indicators.

        Follow these steps:
        - Import zip file.
        - Using Strategy selection dialog, select GTestAddChartIndicator strategy, Enable it.
        - Wait for all indicators to paint.
        - Use Indicator selection panel to select HMA indicator.
        - After a few seconds the strategy disables itself and only the HMA indicator is showing.
        - There is an error in the trace file.


        Doing the above steps produced this one line in my trace file:
        2016-04-28 17:58:36:096 ERROR: Strategy 'GTestAddIndicator': Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object.


        Gary
        Attached Files

        Comment


          #5
          Hello Gary,

          Thank you for your patience.

          Development is investigating this behavior. The case has been assigned id NTEIGHT-9795.
          Patrick H.NinjaTrader Customer Service

          Comment


            #6
            Has anyone figured this one out yet? I'm seeing this error in 8.0.0.11. I'm running replay data with a strategy that uses one custom indicator.

            Here's a stack trace that I see in the log file:

            2016-05-24 20:54:08:519|3|4|Error in realtime market data handling: System.NullReferenceException: Object reference not set to an instance of an object.
            at NinjaTrader.NinjaScript.ChartStyles.CandleStyle.Ge tBarPaintWidth(Int32 barWidth) in c:\Users\eric\Documents\NinjaTrader 8\bin\Custom\ChartStyles\@CandleStyle.cs:line 21
            at NinjaTrader.Gui.Chart.ChartControl.<>c.<GetBarPain tWidth>b__398_1(Double current, ChartBars bars)
            at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
            at NinjaTrader.Gui.Chart.ChartControl.GetBarPaintWidt h(ChartBars chartBars)
            at NinjaTrader.Gui.Chart.ChartControl.GetSlotIndexByX (Int32 x)
            at NinjaTrader.Gui.Chart.ChartBars.GetBarIdxByXBarCen tered(ChartControl chartControl, Int32 x)
            at NinjaTrader.Gui.Chart.ChartControl.UpdateCurrentSl otOrTime()
            at NinjaTrader.Gui.Chart.ChartControl.UpdateFormDataB oxCrossHair()
            at NinjaTrader.Gui.Chart.ChartControl.OnRealtimeDataT imerTick(Object s, EventArgs e)
            at NinjaTrader.Cbi.Instrument.<>c__DisplayClass187_0. <OnRealtimeDataTimerElapsed>b__1(SubscribedThrea d[] threads, Int32 i, RealtimeEvents evts)

            Here is some more info from the log file as well.

            2016-05-24 20:54:39:181|3|16|Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'Object reference not set to an instance of an object.'
            2016-05-24 20:55:00:434|3|16|Chart rendering to a software bitmap failed. There is likely a problem with a chart object's render method. D2D error = 'Object reference not set to an instance of an object.'
            Cheers,
            Eric
            Last edited by ericmacd; 05-24-2016, 10:20 PM.

            Comment


              #7
              What does your custom indicator do? Which chart style are you using? And does it happen on other chart styles?

              Comment


                #8
                Hello ericmacd,

                The fix is planned for the next Beta release.
                Patrick H.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for the replies.

                  Sledge: The indicator is just a line plot with candlesticks but uses orderbook data. Nothing too complicated as far as drawing.

                  Patrick: Thanks for the update. Looking forward to the next release..

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by sergey_z, Today, 05:44 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post sergey_z  
                  Started by NinjaCustomer, Today, 12:29 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_ChrisSch  
                  Started by ronaldgreene828, Yesterday, 07:50 PM
                  1 response
                  15 views
                  0 likes
                  Last Post NinjaTrader_EricB  
                  Started by nailz420, 07-17-2019, 08:38 AM
                  2 responses
                  14 views
                  0 likes
                  Last Post nailz420  
                  Started by bouncetherubble, Yesterday, 06:56 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post bouncetherubble  
                  Working...
                  X