> 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.

# ConnectionLossHandling

## Definition

Sets the manner in which your strategy will behave when a connection loss is detected.

When using **ConnectionLossHandling.Recalculate**, recalculations will only occur if the strategy was stopped based on the conditions below. Should the connection be reestablished before the strategy was stopped, the strategy will continue running without recalculating as if no disconnect occurred.

* If data feed disconnects for longer than the time specified in [DisconnectDelaySeconds](/developer/desktop-sdk/references/strategy/disconnectdelayseconds), the strategy is stopped.
* If the order feed disconnects and the strategy places an order action while disconnected, the strategy is stopped.
* If both the data and order feeds disconnect for longer than the time specified in **DisconnectDelaySeconds**, the strategy is stopped.

## Property Value

An enum determining how the strategy will behave. Default value is set to

**ConnectionLossHandling.Recalculate**. Possible values are:

| Property                                | Description                                                                                                                                                                                                               |
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ConnectionLossHandling.KeepRunning**  | Keeps the strategy running. When the connection is reestablished the strategy will resume as if no disconnect occurred.                                                                                                   |
| **ConnectionLossHandling.Recalculate**  | Strategies will attempt to recalculate its strategy position when a connection is reestablished.                                                                                                                          |
| **ConnectionLossHandling.StopStrategy** | Automatically stops the strategy when disconnected for more than [DisconnectDelaySeconds](/developer/desktop-sdk/references/strategy/disconnectdelayseconds). No action will be taken when a connection is reestablished. |

## Syntax

`ConnectionLossHandling`

## Examples

```csharp
protected override void OnStateChange()
{
     if (State == State.SetDefaults)
     {
         // Keeps the strategy running as if no disconnect occurred
         ConnectionLossHandling = ConnectionLossHandling.KeepRunning;
     }
}
```