Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

onExecution execution.Order is null

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

    onExecution execution.Order is null

    Hello

    still trying to migrate the same 6.5 strat to 7

    I've noticed IExecution.Order is sometimes null in the onExecution() method .

    Actually it happens only with a Close Position IExecution.

    This wasn't the case in 6.5, this is probably new normal behavior in 7
    (as now i receive a separate Close Position order, then the Filled order).

    But it is not mentionned in new Documentation.
    also, what would be the recommended check ?
    right now i've added if(execution.Order !=null) which seems the best check possible since checking on the execution.Name string is just "meh"



    If needed, script to reproduce issue :
    Code:
     protected override void OnBarUpdate()
            {
    			
    			if(Position.MarketPosition == MarketPosition.Flat)
    				EnterLong(1,"Enter");
    			
    				if(ToTime(Time[0]) > 161400)
    				{
    				EnterShortLimit(Close[1]+5);
    				
    				}
    			
    		
            }
    		
    		protected override void OnExecution(IExecution execution)
    		{
    			
    			if(execution.Order !=null)
    		log(execution.Order.OrderState.ToString());
    			else
    				log("order is null");
    		
    		}

    #2
    Hi zark.be, thanks for the report, I'll look into shortly.

    Comment


      #3
      zark.be, this is expected for NT7, so a check for null is needed as you correctly done - we'll add to the docs shortly.

      Comment


        #4
        Originally posted by NinjaTrader_Bertrand View Post
        zark.be, this is expected for NT7, so a check for null is needed as you correctly done - we'll add to the docs shortly.

        I thought so, and it's a nice addition, i'll have to make sure to update my strats to this new behavior as i wanted something like this in 6.5


        Thank you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        607 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        353 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        561 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X