Losing connection often provokes a lot of strategy interruption for me, this is why I've decided to verify connection before submitting orders, so I tried to use something like this :
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 256)
return;
// Set 1
// Print("Connection Status is : "+myAccount.Connection.Status);
if (myAccount.Connection.Status == ConnectionStatus.Connected)
{
Print("Im connected");
} else {
Print("Not connected");
}
}
protected override void OnAccountItemUpdate(Account account, AccountItem accountItem, double value)
{
if (myAccount.Connection.Status == ConnectionStatus.Connected)
{
Print("Im connected");
} else {
Print("Not connected");
}
}

Comment