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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X