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 sjsj2732, Yesterday, 04:31 AM
      0 responses
      36 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      287 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      287 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      133 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      95 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X