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.
    BertrandNinjaTrader Customer Service

    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.
      BertrandNinjaTrader Customer Service

      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 Tin34, Today, 03:30 AM
        2 responses
        20 views
        0 likes
        Last Post Tin34
        by Tin34
         
        Started by sastrades, Yesterday, 09:59 AM
        2 responses
        33 views
        0 likes
        Last Post brucerobinson  
        Started by ETFVoyageur, Today, 12:52 AM
        1 response
        18 views
        0 likes
        Last Post Leeroy_Jenkins  
        Started by lollers, Today, 03:26 AM
        0 responses
        19 views
        0 likes
        Last Post lollers
        by lollers
         
        Started by aliyahany, Today, 03:16 AM
        0 responses
        4 views
        0 likes
        Last Post aliyahany  
        Working...
        X