protected override void StartCalc()
{
InstrumentDataRequest idr = this.Bars.Request;
idr.Resolution = this.Bars.Info.Resolution;
idr.Subscribe2RT = true;
DataRequest range = new DataRequest();
range.RequestType = DataRequestType.BarsBack;
range.Count = this.Bars.FullSymbolData.Count;
range.To = this.Bars.LastBarTime;
idr.Range = range;
this.newAnalyzer = new NewAnalyzer();
IDataLoaderResult res = this.DataLoader.BeginLoadData(idr, result =>
{
if (result.Event == DataLoadedEvent.History)
{
this.newAnalyzer.AddHistoricalBarList(result.Data.ToList());
this.downloadCompleted = true;
this.iccdr.ReDraw();
}
else if (result.Event == DataLoadedEvent.RTNewBar)
{
this.newAnalyzer.AddBar((Bar)(result.RTData));
this.iccdr.ReDraw();
}
else if (result.Event == DataLoadedEvent.RTUpdateLastBar)
{
this.newAnalyzer.UpdateBar((Bar)(result.RTData));
this.iccdr.ReDraw();
}
}, null);
#region toolbar construction
this.initToolbar();
#endregion
}
protected override void CalcBar()
{
}
When this code is run for the first time everything works accordingly, But when another symbol
is clicked the "else if (result.Event == DataLoadedEvent.RTUpdateLastBar)" keeps running with the previous data, what ever that might be!!
Can you explain why? T
Thank you.
real time data inconsistancy [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: real time data inconsistancy
Hello holya,
Please provide more details.
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About).
What do you mean by "But when another symbol is clicked" ?
Please provide more details.
What exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About).
What do you mean by "But when another symbol is clicked" ?
-
- Posts: 40
- Joined: 28 Aug 2012
- Location: Vancouver, Canada
- Has thanked: 8 times
- Been thanked: 1 time
Re: real time data inconsistancy
I have the latest version (8.. I have numerous symbols on my WatchList where I can click on any of them to run my indicators (obviously!). And when I click on any other symbol the
"else if (result.Event == DataLoadedEvent.RTUpdateLastBar)
{
this.newAnalyzer.UpdateBar((Bar)(result.RTData));
this.iccdr.ReDraw();
}"
block gets run with previous data!
Is this explanation clear enough?
Thank you
Hamid Olya
"else if (result.Event == DataLoadedEvent.RTUpdateLastBar)
{
this.newAnalyzer.UpdateBar((Bar)(result.RTData));
this.iccdr.ReDraw();
}"
block gets run with previous data!
Is this explanation clear enough?
Thank you
Hamid Olya
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: real time data inconsistancy
Hamid, you need to unsubscribe from the realtime data you were subcribed to in the code.
If you do not unsubscribe in the code then you will receive realtime data for each instrument you have subscribed.
If you do not unsubscribe in the code then you will receive realtime data for each instrument you have subscribed.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: real time data inconsistancy
To cancel data downloading the void EndLoadData(IDataLoaderResult Result) method should be called. The Result of BeginLoadData call should be put into the argument as an attribute.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2958 times
Re: real time data inconsistancy
A sample code that subscribes to realtime data and outputs the realtime bar values in Output tab of PLEditor window then unsubscribes from realtime data can be found here