Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

cancelorder does not work in strategy analyzer

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

    cancelorder does not work in strategy analyzer

    I have a strategy using UnmanagedOrders and for some reason, an stop sell order can not be cancelled. Even after the back test is completed, the order is still in working status, which prevents all following stop sell orders being sent.

    In the log output, I have the following logs:
    8/19/2015 12:54:00 PM Strategy 'NQDayTrade/-1': Entered internal SubmitOrderUnmanaged() method at 8/19/2015 12:54:00 PM: BarsInProgress=0 Action=Sell OrderType=StopMarket Quantity=2 LimitPrice=0 StopPrice=4482.75 SignalName='stop sell 1'
    Sell stop 4482.75 stop sell 1
    short cross over at 8/19/2015 12:54:00 PM
    8/19/2015 12:55:00 PM 126511.902714423 168903 173683 253023.805428846 257520 262300
    8/19/2015 12:56:00 PM 137247.53859968 173683 181097 274495.077199361 262300 269714
    cancel order orderId='NT-00011-71' account='Backtest' name='stop sell 1' orderState=Working instrument='NQ 06-16' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=4482.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 id=-1 gtd='2099-12-01'
    cancel sell order at 8/19/2015 12:56:00 PM
    8/19/2015 12:57:00 PM 87715.5141810415 181097 185220 175431.028362083 269714 91720
    8/19/2015 12:58:00 PM 112919.470973511 185220 195003 225838.941947021 91720 101503
    8/19/2015 12:59:00 PM 171858.166871016 195003 217207 343716.333742033 101503 123707
    Cancel all orders
    cancel order orderId='NT-00011-71' account='Backtest' name='stop sell 1' orderState=Working instrument='NQ 06-16' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=4482.75 quantity=2 tif=Gtc oco='' filled=0 averageFillPrice=0 id=-1 gtd='2099-12-01'
    8/19/2015 1:00:00 PM 516776.028223527 217207 329662 1033552.05644705 123707 236162


    You can see that the order was submitted at 12:54pm, and was cancelled at 12:56pm, but it did not work. And it was cancelled again at 1:00pm, the order state was still working.

    #2
    Hello rcfcu2000,

    Thank you for writing in.

    I have created a simple script on my end utilizing the Unmanaged Approach and CancelOrder() and was unable to reproduce this behavior that you are seeing.

    When testing the script I have provided, are you still seeing the unexpected behavior?

    If not, can you please provide a simplified version of your script that duplicates the unexpected behavior so I may test on my end?
    Attached Files
    Last edited by NinjaTrader_ZacharyG; 04-30-2016, 02:07 PM.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      I would love to if I could. It is more difficult to write a test program than to debug it.

      This did not happen every time, in the same strategy, the previous cancelOrder() calls were successful, but just this one failed and there is no call back of onOrderUpdate() for this order(to be cancelled). There must be something wrong with the order handling engine, but I do not have code to debug within.

      Comment


        #4
        Hello rcfcu2000,

        I have not seen this occur before. Without a sample that can demonstrate this occurring, I would not be able to see if I would be able to reproduce this on my end.

        Is there a particular instance that you see this occur more often?
        Zachary G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by DanielTynera, Today, 01:14 AM
        0 responses
        2 views
        0 likes
        Last Post DanielTynera  
        Started by yertle, 04-18-2024, 08:38 AM
        9 responses
        40 views
        0 likes
        Last Post yertle
        by yertle
         
        Started by techgetgame, Yesterday, 11:42 PM
        0 responses
        12 views
        0 likes
        Last Post techgetgame  
        Started by sephichapdson, Yesterday, 11:36 PM
        0 responses
        2 views
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,615 views
        0 likes
        Last Post aligator  
        Working...
        X