Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Guidance

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

    Guidance

    I have the following error

    2024-08-09 11:28:36:167|3|4|Error in realtime market data handling: System.NullReferenceException: Object reference not set to an instance of an object.
    at NinjaTrader.NinjaScript.StrategyBase.Process(Objec t sender, ExecutionEventArgs executionUpdate)
    at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
    at NinjaTrader.Cbi.Account.RaiseExecutionUpdate(Execu tionEventArgs e)
    at NinjaTrader.Cbi.Account.ExecutionUpdateCallback(In strument instrument, String executionId, Exchange exchange, DateTime time, MarketPosition marketPosition, String orderId, Int32 quantity, Double price, Double commission, Double fee, Boolean isSod, DateTime statementDate, Operation operation)
    at NinjaTrader.Cbi.Simulator.Fill(Int32 maxFillQuantity, Double price)
    at NinjaTrader.Cbi.Simulator.OnMarketData(Object sender, MarketDataEventArgs e)
    at NinjaTrader.Cbi.Instrument.<>c__DisplayClass153_0. <OnRealtimeDataTimerElapsed>g__Action|1(Subscrib ed Thread[] threads, Int32 i, RealtimeEvents evts)​

    I have studied my OnExecutonUpdate quite hard and can't seem to find what object instance is missing - can anyone point me in the right direction?
    I should add this happens sporadically - so 8/10 code runs fine.

    #2
    Hello Mindset,

    Unfortunately the error does not provide any details of what the problem may be, is there a specific line of code or action you are doing to generate this message?

    Comment


      #3
      Thats my one beef with C# - it knows there is an obj instance error but it can't seem to tell me what the actual object is
      Lots of lines telling me where it is. But not what the object that should be instantiated is - which by definition it must know to call the error?

      Comment


        #4
        Hello Mindset,

        There would not be a way to know what object that was because that object was null when used and had no assigned value. Object is the base type for most types in C# so the message is telling us specifically that variable was not assigned a value so the error is relevant but its not going to have a specific type like custom objects you may be using or a NinjaScript type.

        The best way to identify what is causing the problem is to first find what specific use case this happens with and then to check any code you may have used related to that use case. If this happens but is not a result of code you used we would need to know the steps to see that problem so we can troubleshoot that situation further to know why that may have happened.

        Comment


          #5
          Jesse
          Thank you for your response and I understand this is outside the purview of NT support.
          My beef is with C#. You are right the object has a null value - but it also has a name, so I don't see the difficulty in just passing that name inside the error. Then idiots like me can go "Ah!".
          It may not be possible as I am not a programmer - more an educated hacker of bits and pieces to get what I want.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          25 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          121 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          64 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X