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.

    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.

      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.

          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.

                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 funk10101, Today, 12:02 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_LuisH  
                  Started by GLFX005, Today, 03:23 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by nandhumca, Yesterday, 03:41 PM
                  1 response
                  13 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by The_Sec, Yesterday, 03:37 PM
                  1 response
                  11 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by vecnopus, Today, 06:15 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post vecnopus  
                  Working...
                  X