ConnectionLossHandling

View as Markdown

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, 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:

PropertyDescription
ConnectionLossHandling.KeepRunningKeeps the strategy running. When the connection is reestablished the strategy will resume as if no disconnect occurred.
ConnectionLossHandling.RecalculateStrategies will attempt to recalculate its strategy position when a connection is reestablished.
ConnectionLossHandling.StopStrategyAutomatically stops the strategy when disconnected for more than DisconnectDelaySeconds. No action will be taken when a connection is reestablished.

Syntax

ConnectionLossHandling

Examples

1protected override void OnStateChange()
2{
3 if (State == State.SetDefaults)
4 {
5 // Keeps the strategy running as if no disconnect occurred
6 ConnectionLossHandling = ConnectionLossHandling.KeepRunning;
7 }
8}