Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnOrderUpdate' method for strategy

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

    Error on calling 'OnOrderUpdate' method for strategy

    I am getting the above error because: Object reference not set to an instance of an object.

    I presume it means an IOrder object.

    I have placed 3 orders all at the same price point:

    EntryOrder1: Order='f4195cb8c5cd4421955295447199b2d5/Replay101' Name='SFTSH_Long_Entry1_CL 03-11' State=Working Instrument='CL 03-11' Action=Buy Limit price=84.9 Stop price=84.9 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='f4195cb8c5cd4421955295447199b2d5' Gtd='1/1/0001 12:00:00 AM'

    EntryOrder2: Order='514907d10da74855ad10c396c6b4364c/Replay101' Name='SFTSH_Long_Entry2_CL 03-11' State=Working Instrument='CL 03-11' Action=Buy Limit price=84.9 Stop price=84.9 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='514907d10da74855ad10c396c6b4364c' Gtd='1/1/0001 12:00:00 AM'

    EntryOrder3: Order='3de3225f4105432e95622e22b3006947/Replay101' Name='SFTSH_Long_Entry3_CL 03-11' State=Working Instrument='CL 03-11' Action=Buy Limit price=84.9 Stop price=84.9 Quantity=1 Type=StopLimit Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='3de3225f4105432e95622e22b3006947' Gtd='1/1/0001 12:00:00 AM'

    Once the orders are filled I assume OnOrderUpdate is called and passes control to OnExecution and entryOrder1 is processed, successfully setting stop and target orders for it.

    OnExecution Long Entry O/T: ExOrder.Token = f4195cb8c5cd4421955295447199b2d5 : SFTSH_Long_Entry1_CL 03-11 : f4195cb8c5cd4421955295447199b2d5 , SFTSH_Long_Entry2_CL 03-11 : 514907d10da74855ad10c396c6b4364c , SFTSH_Long_Entry3_CL 03-11 : 3de3225f4105432e95622e22b3006947

    Stop Order
    2/14/2011 2:13:18 PM Entered internal PlaceOrder() method at 2/14/2011 2:13:18 PM: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=84.79 SignalName='SFTSH_Long_Stop1_CL 03-11' FromEntrySignal='SFTSH_Long_Entry1_CL 03-11'

    Target order
    2/14/2011 2:13:18 PM Entered internal PlaceOrder() method at 2/14/2011 2:13:18 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=1 LimitPrice=85.03 StopPrice=0 SignalName='SFTSH_Long_Target1_CL 03-11' FromEntrySignal='SFTSH_Long_Entry1_CL 03-11'

    However, when OnOrderUpdate is called again, I presume to process entryOrder2 I get the error above. Why is entryOrder2 not being passed to OnOrderUpdate. What might I be doing wrong?

    #2
    Hi Snaphook,

    Unfortunately I can't tell from the output why you are seeing this. To track this type of error down, you can use Try -Catch blocks in order to catch the exception and provide some output on what caused the error.

    If you can strip the strategy down to its most basic components we can give it a run here and compare.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    637 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X