Is there a way to set up a timed message, say the order server connection is down for more than 5 minutes, can I somehow set up an elapsed time loop to send a message reconfiming the order server connection is still down after 5 minutes?
As for the corrected code that does work:
private ConnectionStatus dataFeed = ConnectionStatus.[COLOR="Red"]Disconnected[/COLOR];
protected override void OnConnectionStatus(ConnectionStatus orderStatus, ConnectionStatus priceStatus)
{
if (dataFeed == ConnectionStatus.ConnectionLost)
{
SendMail("[email protected]", "[email protected]", "Connection Lost", "Order Connection Lost");
SendMail("[email protected]", "[email protected]", "Connection to Order Server Lost!", "Please verify that the server's internet connection is still valid");
PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");
}
if (dataFeed == ConnectionStatus.Connecting)
{
SendMail("[email protected]", "[email protected]", "Connecting", "Trying to reestablish Connection");
SendMail("[email protected]", "[email protected]", "Connecting", "Trying to reestablish Order Server connection");
PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");
}
dataFeed = orderStatus;
if (dataFeed == ConnectionStatus.Connected)
{
SendMail("[email protected]", "[email protected]", "Connected", "Check that strategy is active");
SendMail("[email protected]", "[email protected]", "Connected", "Connected");
PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\Alert4.wav");
}
}

Comment