Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnConnectionStatus Behavior

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

    OnConnectionStatus Behavior

    I am connected to the CQG data feed and I have the following event handler in my strategy. As soon as I enable the strategy, the DrawTextFixed method is called and displays "Order Server Connection lost", however, I don't believe there is a problem with the Order Server. How do I correctly check order server connection status?

    Code:
    protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
    {
        dStatus = priceStatus;
        oStatus = orderStatus;
    
        //---------------
        // Order Server
        if (oStatus != null)
        {
            if (oStatus != ConnectionStatus.Connected)
            {
    				DrawTextFixed("Last", "Order Server Connection lost" , TextPosition.BottomLeft, Color.Green, new Font("Arial",16), Color.Blue, Color.DarkGray, 5);
            }
    
            //No further processing
            return;
        }
    
    }

    #2
    Hello reynoldsn,

    Thank you for your post.

    Try printing the ConnectionStatus to see what it is reporting as.

    For information on Print() please visit the following link: http://ninjatrader.com/support/helpGuides/nt7/print.htm

    The information will show in the Output window under Tools > Output.

    Please let me know if I may be of further assistance.

    Comment


      #3
      OK, this is probably more useful:
      Code:
      protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
      {
          dStatus = priceStatus;
          oStatus = orderStatus;
      
          //---------------
          // Order Server
          if (oStatus != null)
          {
      		switch (oStatus) 
      		{
      			case ConnectionStatus.Connected:
      				Print("OrderStatus: Connected");
      				break;
      			case ConnectionStatus.Connecting:
      				Print("OrderStatus: Connecting");
      				break;
      			case ConnectionStatus.ConnectionLost:
      				Print("OrderStatus: Connection lost");
      				break;
      			case ConnectionStatus.Disconnected:
      				Print("OrderStatus: Disconnected");
      				break;
      			default:
      				Print("OrderStatus: unknown");
      				break;
      		}
              return;
          }

      Comment


        #4
        Hello,

        Thank you for providing the print,

        Was this successful on your end or is this still reporting as Order Server Connection lost?

        If this is still reporting as connection lost, can you please email me at platform support @ ninjatrader.com in referecne to ticket 1340349

        I look forward to being of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        144 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        71 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        125 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X