Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on Close with Advanced Order Handling

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

    Exit on Close with Advanced Order Handling

    Using Advanced Order Handling, how should stop and target IOrder variables be managed when a position is closed by "Exit on Close"? Can I assume that the stop and target orders tied to the position by the "fromEntrySignal" parameter are automatically canceled? Is there a way to capture the "Exit on Close" event to reset my stop and target IOrder variables to null?

    Thanks,

    David
    dbw451

    #2
    No, there is no way to catch "Exit on Close" per se. You will get the OnOrderUpdate event as well as the OnExecution event for it. You can manage it that way. Check the order name when you are in OnExecution. If you get confirmed fill on "Exit on Close" then just manually reset your stop & targets IOrders.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      From what I can tell, the following code works:

      Code:
      		protected override void OnExecution(IExecution execution) 
      		{
      			if (execution.Order.Name == "Entry1") 
      			{ 
      				if (execution.Order.OrderState == OrderState.Filled) 
      				{
      					stopOrder = null;
      					targetOrder = null;
      				}
      			}
      		}
      It seems like there should be two fills (assuming no partial fills) for any given order name: an entry fill (open position) and an exit fill (close position). I don't think I want to be setting my stopOrder and targetOrder IOrder variables to null when a position is opened. However after adding the above code, I see that it handles my "Exit on Close" stop and target order management so that the back-tester seems to work correctly.

      Thanks,

      David
      dbw451
      Last edited by dbw451; 01-27-2009, 10:04 AM.

      Comment


        #4
        Right. You should set it to null when everything is done.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        0 responses
        3 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X