> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# OnConnectionStatusUpdate()

## Definition

An event driven method used which is called for every change in connection status.

## Method Return Value

This method does not return a value.

## Syntax

You must override the method in your indicator with the following syntax:

**protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate)**

## Method Parameters

| Parameter                  | Description                                                                                                                                                                              |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **connectionStatusUpdate** | A **[ConnectionStatusEventArgs](/developer/desktop-sdk/references/common/onconnectionstatusupdate/connectionstatuseventargs)** object representing the most recent update in connection. |
| **Status**                 | Represents the status of the key adapter functionality. If the adapter supports live orders it will set Status to Disconnected when its order system is not connected.                   |
| **PriceStatus**            | Represents the status of the price feed.                                                                                                                                                 |

## Examples

```csharp
protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate)
{
   if(connectionStatusUpdate.Status == ConnectionStatus.Connected)
   {
     Print("Connected for orders at " + DateTime.Now);
   }

   else if(connectionStatusUpdate.Status == ConnectionStatus.ConnectionLost)
   {
     Print("Connection for orders lost at: " + DateTime.Now);
   }
}
```

```csharp

protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate)

{

   if(connectionStatusUpdate.PriceStatus == ConnectionStatus.Connected)

   {

     Print("Connected to price feed at " + DateTime.Now);

   }

   else if(connectionStatusUpdate.PriceStatus == ConnectionStatus.ConnectionLost)

   {

     Print("Connection to price feed lost at: " + DateTime.Now);

   }

}

```