Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90



  • Filter
  • Time
  • Show
Clear All
new posts


    I have a strategy that submitted an order on Monday morning but was cancelled.
    I was checking log files but it does not say much about it. Only that it was cancelled.
    I also checked trace file but I do not understand the reason that made the order to be cancelled.
    There are log and traces files attached, please help me understand!
    I need to know the reason in order to know how to solve it in my strategy script.

    Thanks in advance.

    Hi lismartin, thanks for writing in.

    If the order is not submitted with the overload:

    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled (true), int quantity, double limitPrice, string signalName)

    the submitted order will be canceled at the close of the next bar unless the order is resubmitted. The log looks like the order was canceled in this way.

    If this doesn not resolve your inquiry, please share details on the strategy you are running. You may post them here, or send them to scriptingsupport at and reference "Attn ChrisL" in the body of the email.

    Kind regards,
    Chris L.NinjaTrader Customer Service


      Hello Chris, thanks for answering.

      I indeed am using isLiveUntilCancelled=true in my strategy.
      I have added a custom order management logic for order handling that cancels current order after 10 seconds when it is not PartFilled nor Filled and resubmits the order with a new limit price.
      I am sure that this is not the reason that that specific order cancelled because it cancelled after 5~6seconds and it did not resubmit the order.

      I know that there is a line in the trace file with timestamp
      2021-07-26 06:16:00:305
      that says

      IB.Adapter.OnError: id=862 errorCode='OutsideRTHIgnored' errorMessage='Advertencia sobre evento de órdenes:Attribute 'Fuera del horario de apertura de la Bolsa' is ignored based on the order type and destination. PlaceOrder is now being processed.'
      the text in spanish says "warning about orders event: Attribute 'Outside the opening hours of the Stock Exchange' is ignored..."

      I want to know if this may be a cause to the order cancelling or is there any other clue I could follow along so I can solve this issue for future trades on this strategy


        Hello lismartin,

        Prints beside the logic calling CancelOrder can confirm if the order was cancelled from your own logic. We should also note the TimeInForce parameter used with the strategy to ensure the orders are submitted GTC or Good Till Close.

        Do you have Trigger After Hours checked in the Interactive Brokers Connection? This option can be found at the bottom of the Connection parameters when configuring the Interactive Brokers connection in NinjaTrader. More details on the Connection Adapter properties can be found in the Connection Guide.

        Connection Guide -

        Please also check Trader Workstation to see if you have the following checked: "Allow order to be activated, triggered, or filled outside of regular trading hours" (Configure > Order > Order Presets > Timing menu)

        We look forward to hearing from you.
        JimNinjaTrader Customer Service



          Hello Jim, thanks for replaying.

          I previously confirmed that the reason this order cancelled was not the custom logic I added to the strategy.

          In regard to Time In Force set to GTC, according to the documentation the orders generated under this setting will remain working until explicitly cancelled, which it's not the case because this event occurred at 2am in the timezone me and my team work, which means there was no one watching out our live trading environment.

          My team just checked the option Trigger After Hours on my Interactive Brokers Connection and it is active. But we do not use Trader Workstation, we want to know how to check "Allow order to be activated, triggered, or filled outside of regular trading hours" in the Interactive Brokers Gateway.

          Thanks in advance.
          Last edited by lismartin; 07-28-2021, 11:43 AM.


            Hello lismartin,

            Interactive Brokers describes changing this property here (publicly available link) and this appears to be present in IB Gateway as well.

            If you are still stuck after this, please write in to platformsupport [at] ninjatrader [dot] com with the text "Attn Jim/Chris 3197787" and include a link to this thread with the log and trace files and a snippet of the order method which submitted the order.
            JimNinjaTrader Customer Service


              I was wondering, do I really need to mark Trigger After Hours as checked?
              My strategy trading logic is set that if conditions are met the order is placed after the first minute in the trading hour has passed.

              Do I really need to mark Trigger After Hours as checked? and Allow order to be activated, triggered, or filled outside of regular trading hours? Since my strategy is not trading outside of the trading hours of the instrument (FDAX 09-21, TH: Eurex Equity Index Futures, NinjaTrader Settings TimeZone: UTC)



                Hello lismartin,

                According to the error code presented in post #3, yes, this would be my recommendation.

                Please test that and if we are still having issues, please provide the detail noted in post #6 to Chris and I.
                JimNinjaTrader Customer Service


                Latest Posts


                Topics Statistics Last Post
                Started by Jazzman53, Today, 07:23 PM
                0 responses
                1 view
                Last Post Jazzman53  
                Started by Doctor JR, 08-05-2021, 10:02 AM
                6 responses
                Last Post Rainmakersg  
                Started by anon84, Today, 06:57 PM
                0 responses
                Last Post anon84
                by anon84
                Started by ronyggg83, 02-09-2023, 06:54 PM
                38 responses
                Last Post NinjaTrader_Ray  
                Started by trend26, Today, 07:31 AM
                2 responses
                Last Post trend26
                by trend26