Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

connection lost options

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

    connection lost options

    Hi,

    I frequently find that when I return to my trade desk my connection to my broker's order server has been lost and I was told there is no way to have it auto-reconnect. So I was wondering, is there any way to at least have an email sent to me when it is disconnected, because I know my strategy can send me an email for an order placement. Is there such an option either in NT itself or a way to program a strategy to send me an email when the order server connection is lost or at least when the strategy tries to fill an order but the order is rejected because of a lost connection?
    [The data feed from my broker still comes in to the chart when I loose the connection so I'm assuming that it's not the data server but the order server connection that is lost -- although the bottom left tab with my broker's name is highlighted RED nonetheless.]

    Thank you.

    #2
    werido, this would be possible if you monitor for example OnConnectionStatus() in your strategy -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks.
      So just changing the last line of code to make it send an email per bar that the order server is not connected would look like this:


      private ConnectionStatus dataFeed = ConnectionStatus.Connected;

      protected override void OnOrderUpdate(IOrder order)
      {
      if (dataFeed != ConnectionStatus.Connected)
      {
      SendMail("*******@gmail.com", "********@gmail.com", "Connection Lost", "Order Connection Lost");
      }
      }

      protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
      {
      dataFeed = orderStatus;
      }



      Does that look correct?

      Comment


        #4
        Looks good, werido. One thing to keep in mind is that the initial variable declaration is in the variables region, so it's not reset with bar updates or other events.

        private ConnectionStatus dataFeed = ConnectionStatus.Connected;
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          Looks correct to me.

          Let me know if I can be of further assistance.

          Comment


            #6
            Hi,

            This has helped notify me when the order server is disconnected and the price server is still connected because I put the notification under OnBarUpdate, so whenever there is a new bar and there is no order server connection, I get notified.

            But just recently my price server also became disconnected and that stops all notifications because there are no order or bar updates.

            So I was was wondering if there was a way to put dataFeed = priceStatus in addition to dataFeed = orderStatus in the code so that I can get an email notification when the price server becomes disconnected.

            The challenge here is to somehow have both the order server AND price server being checked to see if connected, and also to somehow drive the strategy to check for price server connection when there is (by definition) no OnBarUpdate.

            Is there any way to do this, or can dataFeed = ........... only have one thing assigned to it?

            Thanks.

            Comment


              #7
              werido, you can setup two variables to check for price and orderstatus - if you don't want to rely on OnBarUpdate(), check directly from OnConnectionStatus() which will be triggered on each connection event.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by RookieTrader, Today, 09:37 AM
              3 responses
              14 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by kulwinder73, Today, 10:31 AM
              0 responses
              5 views
              0 likes
              Last Post kulwinder73  
              Started by terofs, Yesterday, 04:18 PM
              1 response
              22 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by CommonWhale, Today, 09:55 AM
              1 response
              3 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by Gerik, Today, 09:40 AM
              2 responses
              7 views
              0 likes
              Last Post Gerik
              by Gerik
               
              Working...
              X