Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged + OCO + CancelOrder

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

    Unmanaged + OCO + CancelOrder

    Hello,

    When an entry order is filled, I send a bracket order (takeProfit + stoploss) tied by an OCO-ID.
    When one of the two orders is filled the other is canceled. Works fine.

    However, if you cancel before one of the two orders with the CancelOrder function, the other order is not automatically canceled.
    I think it should be automatically canceled because it is an OCO. Is it the way it should work?

    Thanks

    Edit:
    this issue occurs in Historical only. In RealTime works fine.

    Unmanaged = true
    NT7B15
    Last edited by cls71; 05-06-2010, 01:00 AM.

    #2
    cls71, thanks for reporting in and testing - would you mind sharing the snippet you used? You can also contact me directly at support at ninjatrader dot com (Attn Bertrand) to follow up - thanks.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I sent you an email with the code.

      Thanks

      Comment


        #4
        Originally posted by cls71 View Post
        Hello,

        When an entry order is filled, I send a bracket order (takeProfit + stoploss) tied by an OCO-ID.
        When one of the two orders is filled the other is canceled. Works fine.

        However, if you cancel before one of the two orders with the CancelOrder function, the other order is not automatically canceled.
        I think it should be automatically canceled because it is an OCO. Is it the way it should work?

        Thanks

        Edit:
        this issue occurs in Historical only. In RealTime works fine.

        Unmanaged = true
        NT7B15
        I'm having the same issue now even in 2019. It does not work in an expected way when running Historical simulation.

        For example I have this code that is executed at the end of the bar (lets say 1min timeframe):

        Code:
        testOrder1 = SubmitOrder(0, OrderAction.Buy, OrderType.Stop, 1, 0, Close[0]+100*TickSize, "ocolink", "order1");
        testOrder2 = SubmitOrder(0, OrderAction.SellShort, OrderType.Stop, 1, 0, Close[0]-100*TickSize, "ocolink", "order2");
        Then 1 minute later when I call CancelOrder function on one of those two orders, only the one passed to CancelOrder function is cancelled:

        Code:
        CancelOrder(testOrder1);
        This log is produced (in historical backtesting) when TraceOrders = true;

        First entering orders:
        8. 1. 2019 0:01:00 Entered internal SubmitOrder() method at 8. 1. 2019 0:01:00: Action=Buy OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=49,79 OcoId='ocolink' Name='order1'
        8. 1. 2019 0:01:00 Entered internal SubmitOrder() method at 8. 1. 2019 0:01:00: Action=SellShort OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=47,79 OcoId='ocolink' Name='order2'

        Then calling CancelOrder():
        Cancelled custom managed order at 8. 1. 2019 0:02:00: Order='NT-00000/Backtest' Name='order1' State=Working Instrument='CL 03-19' Action=Buy Limit price=0 Stop price=49,79 Quantity=1 Strategy='HighLow' Type=Stop Tif=Gtc Oco='ocolink' Filled=0 Fill price=0 Token='33747c93686241c999db608955f4b893' Gtd='1. 12. 2099 0:00:00'


        Or is this an expected behavior?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elirion, Today, 01:36 AM
        0 responses
        3 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        3 views
        0 likes
        Last Post gentlebenthebear  
        Started by samish18, Yesterday, 08:31 AM
        2 responses
        9 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by Mestor, 03-10-2023, 01:50 AM
        16 responses
        389 views
        0 likes
        Last Post z.franck  
        Started by rtwave, 04-12-2024, 09:30 AM
        4 responses
        34 views
        0 likes
        Last Post rtwave
        by rtwave
         
        Working...
        X