Hi,
In MultiCharts (with PowerLanguage), you have explained how to detect an interruption of the real time data feed:
viewtopic.php?f=16&t=11715
How do I accomplish the same in MultiCharts.Net ?
Thanks for your help,
HPF
Check for absence of real time data
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Check for absence of real time data
Here is a sample code to check for absence of realtime data:
Create a new signal, paste this code and compile it or import the attached pla file.
Once you add it to your chart make sure you have alerts enabled in Format->Strategy properties->Alerts tab. More info on the strategy alerts in the Wiki.
The code will generate an alert of the selected type intrabar if there is no realtime data for more than 30 seconds.
Code: Select all
using System;
namespace PowerLanguage.Strategy{
[IOGMode(IOGMode.Enabled)]
public class no_realtime_data_alert : SignalObject
{
public no_realtime_data_alert(object _ctx):base(_ctx)
{
}
public VariableSeries<Double> Counter;
protected override void Create()
{
Counter = new VariableSeries<double>(this, 0, 0, true);
}
protected override void StartCalc()
{
ExecControl.RecalcLastBarAfter(new TimeSpan(0, 0, 5));
}
DateTime LastCalcTime;
protected override void CalcBar()
{
LastCalcTime = DateTime.Now;
}
protected override void OnRecalcLastBarAfterEvent()
{
if (LastCalcTime < DateTime.Now.AddSeconds(-30))
Alerts.Alert("No realtime > 30 sec");
ExecControl.RecalcLastBarAfter(new TimeSpan(0, 0, 5));
}
}
}
Once you add it to your chart make sure you have alerts enabled in Format->Strategy properties->Alerts tab. More info on the strategy alerts in the Wiki.
The code will generate an alert of the selected type intrabar if there is no realtime data for more than 30 seconds.
- Attachments
-
- no_rt_alert_MC_Net.pln
- (1.88 KiB) Downloaded 656 times