Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder Class OCO question

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

    IOrder Class OCO question

    I use an IOrder Class to enter a 1 contract limit order. Once it is filled, the strategy will to submit a profit target and Stop loss in the OnOrderUpdate() method. This is as shown in the example "SampleOnOrderUpdate". It works fine for me and position is exited when profit target or stop loss are hit

    Before 1st position is exited, this strategy can place a second 1 contract entry limit order. using the same method. If this 2nd order is filled everything works fine.

    I run into a problem if the 2nd enty order is not filled, prior to the 1st contrat hiting the profit target. In that case the 1st contract position is filled at the profit target and the stop loss order is cancelled.

    My problem is that the 2nd entry order does not get cancelled. What must I do to tie the 2nd entry order to the 1st entry order so that it gets cancelled in this situation.

    Thanks,
    Phineas

    buy

    #2
    This is not possible. What you would need to do is monitor OnOrderUpdate() for terminal status of the stop/target (filled or cancelled) and then CancelOrder(2ndEntry).
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray,
      Thats what I thought. Thanks.
      Phineas

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      87 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      106 views
      0 likes
      Last Post CarlTrading  
      Working...
      X