This is why I'm interested in manually handle the change on connection status and syncing accounts when the connection status is back to connected. So, some questions:
1. the only way to detect a change in status connection is with this snippet?
private ConnectionStatus dataFeed = ConnectionStatus.Connected; protected override void OnOrderUpdate(IOrder order) { if (dataFeed != ConnectionStatus.Connected) { // Do something } } protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus) { dataFeed = priceStatus; }
protected override void Initialize() { DisconnectDelaySeconds = 10; // Disconnect has to be at least 10 seconds MaxRestartMinutes = 390; // Allow for restarting the strategy only if there were less restart attempts than MaxRestartAttempts within the last 6.5 hours MaxRestartAttempts = 4680; // Allow the strategy to restart every 5 seconds for 6.5 hours. ConnectionLossHandling = ConnectionLossHandling.Recalculate; // Strategy will attempt to recalculate its strategy position when a connection is reestablished. RestartDelaySeconds = 5; // Recalculate strategy only after connection is reestablished for at least 5 seconds }
Even though NinjaTrader provides connection loss handling features it is still important to ensure your recovered strategy's internal state is not in limbo. Should you have internal variables tracking various information it may be necessary for you to program your own additional connection loss handling into OnConnectionStatus() to properly recover all aspects of your strategy in the manner you desired.
I can do the typical comparison to know if NT is connected, using the snippet above commented, but what I don't know is how to tell to NT that its Status has changed from anything to connected once again. Any ideas would be highly appreciated.
Thanks
Comment