I'd like to get an alert (pop up, email, etc.) when a broker profile is disconnected between certain hours of the day (like 2am to 8am).
I wrote the following strategy, but I think it will only run when applied to a chart when new bars are painting (i.e. when the symbol's market is open).
Is there a way to check and alert more effectively in MultiCharts .net 11?
Stephen
Code: Select all
using ATCenterProxy.interop;
namespace PowerLanguage.Strategy
{
public class __S__Connection : SignalObject
{
public __S__Connection(object _ctx) : base(_ctx) {}
protected override void CalcBar()
{
//check profile connection and send alert
foreach(var profile in TradeManager.TradingProfiles)
if (profile.Name.Equals(Profile) &&
profile.ConnectionState != ETM_ConnectionChanged.eTM_CC_Connected
/* && hours between x and y */)
{
Alerts.Alert("{0} {1}", profile.Name, profile.ConnectionState);
break;
}
}
}
}