NinjaScript > Language Reference > Strategy >

ConnectionLossHandling

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

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

 

KeepRunning: Keeps the strategy running. When the connection is reestablished the strategy will resume as if no disconnect occurred.

 

Recalculate: Strategies will attempt to recalculate its strategy position when a connection is reestablished and held for longer than RestartDelaySeconds (default = 10). 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, 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.

 

StopStrategy: Automatically stops the strategy when disconnected for more than DisconnectDelaySeconds. No action will be taken when a connection is reestablished.

 

Property Value

ConnectionLossHandling.KeepRunning
ConnectionLossHandling.Recalculate

ConnectionLossHandling.StopStrategy

 

Syntax

ConnectionLossHandling

 

 

Examples

protected override void Initialize()
{

    // Keeps the strategy running as if no disconnect occurred
    ConnectionLossHandling = ConnectionLossHandling.KeepRunning;
}