Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Internet dropouts prevent subsequent orders

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

    Internet dropouts prevent subsequent orders

    I'm using a PATSYSTEMS broker, and for gosh-darn-it too many times just at the PRECISE moment my strategy places an order, there is a loss of connection and the order is not filled. (This is usually when the market moves in my favour.... grrrr.) An order is left hanging, "pending submit".

    This order cannot be cancelled manually, via right click.

    Moreover, it prevents any further entries from the strategy. The only way I know to get rid of that pending order is to disconnect and restart Ninja.

    This is not ideal, in fact its a huge inconvenience. Please could something be done about this behaviour.
    saltminer

    #2
    Hello saltminer,

    Unfortunately NinjaTrader does not dictate when a connection is lost. It operates like a radio receiver in that it receives a signal from your broker and then displays/reports these signals back to you the trader. When a connection is lost, it is the broker's API that determines this and reports this to NinjaTrader which in turn reports this back to the trader.

    The common problems that contribute to this are:

    - ISP issues

    - hardware firewall issues changing IP addresses frequently

    - Dynamic ISP address switching the address frequently intraday. Usually this happens once a week but you may want to check with your ISP. If they do change daily, a static IP address may work.

    - With Windows XP SP2, if you have more than 10 open TCPIP socket connections open (10 programs making connections through the internet) windows will randomly shut down some connections

    - Broker servers having problems

    Comment


      #3
      Thanks. But what about the stuck order "pending submit"? This is Ninja territory, not the broker API.
      Should I be able to use a workaround using IOrder to check if an order is stuck at "pending submit" status after a set time or a few bars, and cancel it from within the Strategy?

      How about this.. presume an order was created:
      EntryOrder = EnterLong(...)

      // method to check for stuck orders, called each OnBarUpdate()...
      private void CheckIOrders()
      {
      // checks for stuck IOrders - entry and exit - not stoploss adjustments.
      // if order has not moved off "pending submit" after 7 seconds,
      // 1) cancel it
      // 2) go flat if it was an exit order.

      if ( (EntryOrder != null) && (EntryOrder.OrderState == OrderState.PendingSubmit) && (ToTime(EntryOrder.Time) < ToTime(Time[0]) - 7) )
      {
      Print("Automatically cancelling stuck PendingSubmit Order after greater than 7 seconds:");
      Print("\t"+EntryOrder.ToString());
      CancelOrder(EntryOrder);
      }
      if ( (ExitOrder != null) && (ExitOrder.OrderState == OrderState.PendingSubmit) && (ToTime(ExitOrder.Time) < ToTime(Time[0]) - 7) )
      {
      Print("Automatically cancelling stuck Exit Order after greater than 7 seconds:");
      Print("\t"+ExitOrder.ToString());
      CancelOrder(ExitOrder);
      Print("GOING FLAT");
      if (Position.MarketPosition == MarketPosition.Long)
      ExitOrder = ExitLong();
      else if (Position.MarketPosition == MarketPosition.Short)
      ExitOrder = ExitShort();
      }
      }
      Last edited by saltminer; 01-21-2009, 08:17 AM. Reason: adding null check to code snippet

      Comment


        #4
        Why cant we host Ninja Trader on a server?
        That is always on?
        Therefore it would only be down to the broker connection.
        And I think my actual broker connection has gone down once for about 20 minutes in the last month.
        The other times was isp problems.

        Comment


          #5
          Originally posted by Mike_32 View Post
          Why cant we host Ninja Trader on a server?
          That is always on?
          Therefore it would only be down to the broker connection.
          And I think my actual broker connection has gone down once for about 20 minutes in the last month.
          The other times was isp problems.
          You can run NinjaTrader on a hosted server, nothing is preventing you from doing that.
          RayNinjaTrader Customer Service

          Comment


            #6
            saltminer,

            I do not see any reason why you can't run those checks. One point to note, when you go CancelOrder I suggest you wait for confirmation on those cancels before proceeding with your ExitLong()/Short(). Or if you must do those exits immediately, use a different IOrder object. If your CancelOrder does not get immediately cancelled and you overwrite the IOrder you will lose tracking for the PendingCancel order.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hi Guys,
              I tried this today and I'm afraid the result is not good.
              AGAIN, my strategy placed an order and IN THE SAME SECOND the connection with the broker was dropped. I'm suspecting this is not internet dropouts miraculously occuring simultaneously with my orders; rather I think the broker API is semi-sleeping most of the time, but then when an order is placed it does something new that triggers the "connection lost" state.

              Firstly, and I'm down on my knees with you for this one; please can you give me any info on the parameters in the Patsystems API; INTERVAL, TIMEOUT and TRACE LEVEL. The guys in at the broker (ActivTrades in U.K.) don't know anything - they are complete dummies. I've already rung three times over some months and had no joy. If there is anything that can be adjusted in this API to help me I'm desperate for it. If you don't know anything, please point me to the API developers so I can get in touch with them.

              Secondly, my code correctly detected the hanging pending order, and executed the CancelOrder(...)
              NOTHING HAPPENED. The order stayed hanging, in "PendingSubmit" state, showing Orange in the Orders tab of the Control Centre. My stategy tried every new bar to cancel it, but it seems out of the strategy's control, and it also cannot be cancelled manually via right-click.
              Here is some printout from my Output Window, which logs various key activities from my Strategy. (3325 is just a bar number)
              3325 SHORT V1 TRIGGER!
              3325 DoShort
              3325 ShortEntry
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              Automatically cancelling stuck PendingSubmit Order2 after greater than 7 seconds:
              Order='164043/21722956' Name='YM10R:2ndS' State=PendingSubmit Instrument='YM 03-09' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Strategy='ZZV3beta' Type=Market Tif=Day Oco='' Filled=0 Fill price=0 Token='25d42d06d1df46db9f45bb73a8c870aa' Gtd='01-Dec-99 12:00:00 AM'
              I really need help here. I've got a paid-for NinjaTrader subscription, and a funded futures account, and I can't even get an order on. It is quite frustrating.
              Hoping you can help.
              saltminer

              P.S. As I was disconnecting my broker connection to finish for the day, I got this error message (see pic).
              Attached Files
              Last edited by saltminer; 01-21-2009, 11:31 AM.

              Comment


                #8
                The interval and timeout are settings that the Patsystems DLL (API) uses in their heartbeat monitoring for detecting a connection loss with their server. Interval is the frequency of heartbeat requests, timeout is the time allowed after sending the heart beat request the API waits for a server response before throwing the connection state event indicating a loss of connection. The zero default settings correspond to default API values, not sure what those are. You could try checking the OnConnection... method, see if setting some strategy internal connect state before sending an order, I suspect this might not help in your case since as you explained, the connection is changing as the order is sent in.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  If internet connection drops are a concern, I suggest and recommend the TP-Link R480-T. It's a dual wan router, for load balancing and redundancy. I use one personally with DSL plus Cable to give me twice the bandwidth and, more importantly, redundancy. It automatically fails over/fails back, etc. Also tons more features.

                  Got mine for under $150.



                  Mike

                  Comment


                    #10
                    Today I tried upping the interval to 7. This should allow a heartbeat ping 7 seconds to do a round trip.
                    No luck. Same behaviour: when an order was placed, the connection immediately changed to ConnectionLost.
                    This has cost me $400 already just this morning. (80 minutes into the day.)

                    WHAT can be the problem?

                    Also, stuck orders of "Pending Submit" prevent any further orders in the same direction from being processed. They just disappear into some black hole.
                    To be specific, a command like EnterLong(...) does nothing.
                    No log entry or anything.

                    Please if you can think of anything else to try.
                    saltminer

                    Comment


                      #11
                      We are sorry to hear about your connectivity issues. As it stands you frequently loose connectivity on submitting orders. The connectivity between NT and your broker's server is managed by the broker API (here: Patsystems API). Unfortunately it would be out of our control.

                      The only thing we could advise is changing aspects of your connection setup which "might" impact the flawed behavior. Items in question might be:
                      - trying a different ISP (if feasible)
                      - trying to eliminate local routers, firewalls, local "helpers" on your PC like spam blocker
                      - trying wire connection instead of WAN
                      ...

                      Unfortunately these items are out of our area of experience, we only could provide little to no advise. However, it might be worthwhile to give it try.

                      Sorry for not having better news at this time.

                      Comment


                        #12
                        Potential duplicate execution.

                        Ok Dierk, thanks for the gentle hand on the shoulder. I don't have an alternate ISP but I'll try the other stuff. (Oh, I'm already wired not wireless on ADSL2+, so that should be ok.)
                        By the way, I got this message just now, about a Potential duplicate execution.
                        (attached image). It says to advise you of this error.

                        saltminer
                        Attached Files

                        Comment


                          #13
                          Thanks, please contact your broker to make sure there is no unwanted position in your account.

                          Comment


                            #14
                            OK, today I seem to have punched this gremlin into submission. I did two things:
                            1) Uninstalled and reinstalled Ninjatrader.
                            2) Turned off PCTools Internet Security software, which is Firewall and anti-virus, anti-spam software.

                            So, which thing is the significant change I can't tell yet, but I would suspect the PCTools. I'd be interested to learn if anyone else is successfully trading while running this package. I'll start a separate thread.

                            Thanks Ninja guys for all your feedback and support.

                            saltminer

                            Comment


                              #15
                              Thanks for feedback. Glad you got it resolved.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              647 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              368 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              571 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X