Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Panic Disconnect ?

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

    #16
    Hello jeronymite,

    Thank you for clarifying.

    Unfortunately, simulated orders cannot be recovered after restarting.

    "Note: Please note that MIT orders and Simulated Orders, which are in TriggerPending state, could not be recovered by NinjaTrader, if the provider does not provide native support. The order state after connection recovery would then be 'Unknown'.​"
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Thanks, NinjaTrader_ChelseaB. Appreciate the confirmation.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #18
        Hello! There have been a few related threads to this but this sounds the closest to my issue.

        Basically we have multi-day and sometimes multi-week strategies that hold a position overnight... We have went through the forums / issues around PANIC (disconnect on certain weekends) along with the error "unable to cancel live orders" and followed the instructions around high fill resolution...

        So from the post suggestion from NT staff here:
        "The unable to cancel live orders would indicate that the strategy has placed orders but is now unable to cancel them. This could mean the strategy was enabled outside of market hours, or the strategy is not using the immediately submit start behavior with 1-tick intra-bar granularity implemented, or could mean the orders were manually cancelled or filled while NinjaTrader was disconnected."

        On our strategy we do have multi instrument so we cannot select high fill resolution... we have to code for it.

        From my understanding and the sample code provided for high fill resolution and coding for this... You have to create another data series with 1 tick, and then you have to send orders to that data series...

        Is this correct?


        The issue we are running into on our live environment now with with Interactive Brokers for trading equities with the strategy... Basically it throws an error. Note... that we have tried using both Kinetik and Interactive Broker connection feed... but we have the same problem.

        For now we have had to place the code in a try/catch block, so this is how we know it is happening on a single line of code... which happens to be the order entry.

        Here is the dataseries that is added in state.configure:
        AddDataSeries(null, BarsPeriodType.Tick, 1);

        Here is the code (which works for sim and seems to work ok for futures but not IB stocks)...

        try
        {
        EnterLong(1, StratQuantity, "Epic Long");

        }
        catch
        {
        Print("Standard Order Entry on Tick Chart Failed!");
        EnterLong(StratQuantity, "Epic Long");
        }​


        So... thoughts? We need to make sure with each disconnect and reconnect of datafeed or orders we don't receive the "Cannot cancel live orders" problem.




        Thanks,

        Chad
        chadnash
        NinjaTrader Ecosystem Vendor - Nash Technologies

        Comment


          #19
          Hello Chad,

          From my understanding and the sample code provided for high fill resolution and coding for this... You have to create another data series with 1 tick, and then you have to send orders to that data series...

          Is this correct?
          Yes, this is correct. This provides the intra-bar information necessary to accurately fill orders at the intra-bar price and time (with the accuracy of 1 tick price without slippage).

          ​The issue we are running into on our live environment now with with Interactive Brokers for trading equities with the strategy
          NinjaTrader does not support historical tick data with Interactive Brokers, but you appear to be aware of this.

          Note... that we have tried using both Kinetik and Interactive Broker connection feed... but we have the same problem.
          May I confirm that you are using a subscription of Kinetick and not the End of Day Free connection? Are you able to load a chart with Tick bars selected as the Type in the Data Series window and see the data populate for the specific date range you are backtesting over?

          For now we have had to place the code in a try/catch block
          The try catch would not prevent the issue, and may instead just prevent the script from disabling from an error. We generally steer developers away from using try catches unless absolutely necessary.


          That said, EnterLong() produces a market order which would not be an order that remains in a working state. It would be completely unexpected that NinjaTrader would try and cancel a market order.

          May I confirm there are no stops and targets? (Which would be stop and limit orders)

          Do you have a paper trading account to test with?
          If so, are you able to reproduce the behavior using the SampleMACrossover included with NinjaTrader?


          With working orders that are submitted by a strategy and then the strategy is disabled, before the strategy is re-enabled may I confirm the orders are still in a working state with the brokerage?


          Last, may I confirm that you are only enabling the strategy during market hours? (So that if an order needs to be cancelled and resubmitted the market is live and the actions can be performed)
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Hi Chelsea,

            Thanks for your comments... Let me follow up...

            1. Yes, we are using the paid feed of Kinetik (not end of day or any free connection). This paid connection uses real time data.

            2. Yes, I generally would never want to use this in a try/catch block.. However, this was needed to really narrow down the issue to a single line of code (the EnterLong code on the single tick data series fails VS the standard EnterLong succeeds).

            3. I do have a paper trading account with IB and I will attempt to replicate it on that, or even live account using the SampleMACrossover strategy. I will follow up once I do that test and if its still a problem I will attach the installation file for the MACrossover here.

            Thanks,

            Chad
            chadnash
            NinjaTrader Ecosystem Vendor - Nash Technologies

            Comment


              #21
              Hi Chelsea,

              So creating that example using the single tick series with the sample MA code led to some positive results, but then only more questions.

              Basically I was able to confirm that on the single tick additional data series... that it was able to add entries.

              At this point I then went back and tested the code that was throwing these errors the past week... and the entries were also able to successfully enter (no additional code changes since then).

              So this tells me that likely... even though the preferred data connection was set to Kinetik, it was likely using the IB connection? I saw several posts regarding special instructions for connecting one before the other... could this be the problem? Is so that seems really difficult to always maintain, shouldn't it always use the selected settings for preferred connection real time/historical?

              This is even more critical in my case because IB gateway needs to restart every night... does it run the risk that simply because one connection is made before or after another that suddenly all of this existing code will cause a problem or not cause it? Is there any code or method we are able to use to specifically confirm that the data connection being used is the correct one? Even though I have selected the Kinetik for real time and historical, it still shows Interactive Brokers as the connection on the strategy grid/table... I am assuming because the account itself is under that connection?

              Additionally... I also noticed that even with historical data (which was never running into this problem when I tested it off hours previously)... if you are during live trading times and enable a strategy, it will error in that same code at certain times, because calling that many days back is limited to off market hours.

              Kinetik informed me:
              "When requesting tick data between the hours of 9:30 AM and 4:30 PM ET, you will have access to 8 days of historical tick data. If you request the data outside those, hours the full 180 days is available."

              So this is likely what was causing the random errors attempting to backtest for maybe two months with the data entries taking place on a tick chart? I suppose for all historical data entries we should just use the EnterLong code without specifically referencing the single tick data series?

              Thanks,

              -Chad

              chadnash
              NinjaTrader Ecosystem Vendor - Nash Technologies

              Comment


                #22
                Hello Chad,

                Preferred connections are set in the Tools -> Market Data window.


                You can check the connection with the OnConnectionStatusUpdate argument Connection property.


                I would recommend only backtesting for the days you have data available (but continuing to use 1-tick intra-bar granularity for accurate fills).
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                104 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                52 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                34 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                38 views
                0 likes
                Last Post TheRealMorford  
                Started by Mindset, 02-28-2026, 06:16 AM
                0 responses
                74 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X