Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Certain orders cancelled with no explaination

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

    Certain orders cancelled with no explaination

    I have a strategy that submits entry order, then in the OnExecution method when the entry order is filled, I submit the target and stop orders.
    The target orders are accepted and get to a Working state.
    The stop orders are cancelled by Ninja.

    The attached log fragment from Ninja shows the stop orders going through the following states:
    PendingSubmit, Accepted, PendingCancel, Cancelled.

    I cannot find any explanation for why the orders were cancelled.
    In the log, the orders I am referring to are named: GEL.Stp.4 and GEL.Stp.5.

    - Where do I look for more detail on why the order was cancelled?
    - Do you see anything wrong in the log?

    This only appears to happen in the bonds (ZB) market.
    This was on the SIM101 account during market hours.
    I could not recreate the error in Replay.

    Thanks,
    Gary
    Attached Files

    #2
    Hello,

    Thank you for your note.

    In the code, the orders submitted after GEL.Ent.4 are GEL.Stp.4, and GEL.Tgt.4. As these orders are not named Stop1, Stop2, Target1, Target2. This indicate that you are using your own exit orders and you are not using SetStopLoss and SetProfitTarget.

    As you are sending your own exit orders and not using a stop loss and profit target, may I confirm you have set the liveUntilCancelled bool to true so that the exit orders are not cancelled on the next bar?

    Below is a link to the help guide on ExitLongLimit. Please the Parameters table on liveUntilCancelled.
    http://www.ninjatrader.com/support/h...tlonglimit.htm

    Also, the SetStopLoss and SetProfitTarget methods automatically have liveUntilCancelled set to true. If these were used instead (and set one line before the entry order is submitted, this will likely also correct the issue)

    Below is a link to the help guide on SetStopLoss and SetProfitTarget.

    SetStopLoss - http://www.ninjatrader.com/support/h...etstoploss.htm

    SetProfitTarget - http://www.ninjatrader.com/support/h...ofittarget.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am using the method:
      ExitLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)

      I am passing 'true' in the liveUntilCancelled parameter.

      The basic SetStopLoss method does not meet my requirements for this situation.

      Was there any indication in the log of earlier post showing why the order was cancelled?

      Gary

      Comment


        #4
        Hello GaryAlbers,

        Your log shows that the order was cancelled via PendingCancel. Meaning that the logic in the script is causing the order to be cancelled. The log will not say why the order is being cancelled (or why any order is being submitted for that matter). The log simply shows when an order is cancelled or submitted.

        If the liveUntilCancelled bool is set to true for the Exit order then the issue is likely within the logic.

        My suggestion is to comment out all other code other than the entry and the exit and see if the exit is still being cancelled.

        (With liveUntilCancelled set to true, the order should only be cancelled if the entry trade is exited or the entry order is cancelled, or the exit order is directly cancelled with CancelOrder())

        You could also make a sample of the strategy that reduces the code to only the code necessary to demonstrate the issue. Currently, I cannot see your code and I can only make suggestions.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X