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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      151 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      303 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      345 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      175 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X