Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitOnClose Order Rejected

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

    ExitOnClose Order Rejected

    Hi

    I'm trying to understand why the order produced by ExitOnClose was rejected. I would like suggestions for what I should investigate.

    The strategy opened a short position with EnterShortStop().
    Take profit and Stop loss orders were placed after entry fill.
    ExitOnClose = true and ExitOnCloseSeconds = 660 (11 mintues).
    The normal exits have been working fine.
    ExitOnClose has tested OK on a demo account, but this is the first time ExitOnClose was required to close the position on a live account.

    In this case the error stated "The order type is not allowed for the commodity affected Order" BuyToCover 1 Market"
    However, the stop loss and take profit executions are also BuyToCover and work fine.

    The account is with AMP / CQG.
    PC time is set to New Zealand local time.

    Cheers
    Tony

    Here is a section of the log:
    13/09/2012 7:49:00|1|128|Exit on close handling for strategy 'Gap11' started. 13/09/2012 7:49:00|1|32|Order='1923921760/86497!AMP!ac86497' Name='Profit target' New state=PendingCancel Instrument='TF 09-12' Action=BuyToCover Limit price=838.2 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='1923921761/86497!AMP!ac86497' Name='Stop loss' New state=PendingCancel Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=846.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='2cd16e0faa39460e9051079c3d19df 28/86497!AMP!ac86497' Name='Exit on close' New state=PendingSubmit Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='2cd16e0faa39460e9051079c3d19df 28/86497!AMP!ac86497' Name='Exit on close' New state=Rejected Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=OrderRejected Native error='The order type is not allowed for the commodity' 13/09/2012 7:49:00|0|32|AMP Live, The order type is not allowed for the commodity affected Order: BuyToCover 1 Market 13/09/2012 7:49:00|0|128|Strategy 'Gap11/cd7055f2e7e749b88edcb152c9347629' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself. 13/09/2012 7:49:00|1|32|Order='1923921760/86497!AMP!ac86497' Name='Profit target' New state=Cancelled Instrument='TF 09-12' Action=BuyToCover Limit price=838.2 Stop price=0 Quantity=1 Type=Limit Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='1923921761/86497!AMP!ac86497' Name='Stop loss' New state=Cancelled Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=846.5 Quantity=1 Type=Stop Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='6322db98c24042799b6ed63707aca5 8f/86497!AMP!ac86497' Name='Close' New state=PendingSubmit Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='' 13/09/2012 7:49:00|1|32|Order='6322db98c24042799b6ed63707aca5 8f/86497!AMP!ac86497' Name='Close' New state=Rejected Instrument='TF 09-12' Action=BuyToCover Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=OrderRejected Native error='The order type is not allowed for the commodity' 13/09/2012 7:49:00|0|32|AMP Live, The order type is not allowed for the commodity affected Order: BuyToCover 1 Market 13/09/2012 7:49:00|1|128|Disabling NinjaScript strategy 'Gap11/cd7055f2e7e749b88edcb152c9347629'

    #2
    Hi Tony, which TIF setting were you using for this strategy for the market order on TF?

    Comment


      #3
      ExitOnClose Order Rejected

      Hi Bertrand

      TIF in strategy settings is GTC.

      In the strategy code, for a short position:
      Entry order is: EnterShortStop( 0, true, nContracts, entryLevel, entryName ); // GTC, worked OK
      Take profit order is: SetProfitTarget( entryName, CalculationMode.Price, target ); // GTC, I think
      Stop loss order is: SetStopLoss( entryName, CalculationMode.Price, stopLoss, false ); // GTC, I think
      The rejected order was generated by Exit On Close handling. I don't know what TIF is set for this.

      The strategy generated orders seem fine, it's the order generated by the exit on close handling that was rejected for being an order type that is not allowed.

      I hope this helps, but let me know what else I can do.

      Cheers
      Tony

      Comment


        #4
        GTC market orders are not supported on the TF /ICE exchange.

        You will need to set your TIF to DAY at least for the market orders.

        TimeInForce = Cbi.TimeInForce.Day;
        MatthewNinjaTrader Product Management

        Comment


          #5
          ExitOnClose Order Rejected

          Hi Matthew

          These little pieces of information are like gold! Thanks.

          For my further understanding:

          1. At the moment I do not set TimeInForce in the strategy code, but I will. In the meantime, is it OK to set the Time in force = Day in the strategy settings on the chart?
          2. At the moment in the strategy code, the entry orders use liveUntilCancelled = true. I presume I can I leave this as is, because they are not market orders. Right?

          To help me avoid similar issues in the future, where can I find this kind of information without bugging you guys?

          Thanks again.
          Tony

          Comment


            #6
            Yes, setting the TIF manually as strategy parameter would be fine - as an alternative - http://www.ninjatrader.com/support/h...imeinforce.htm

            liveUntilCancelled is fine, with a TIF of DAY those would be cancelled with the session end handling as well.

            We don't feel bugged at all, so just post or email when you need something.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            42 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            25 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            162 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            98 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            157 views
            2 likes
            Last Post CaptainJack  
            Working...
            X