Finding a list of data series objects

Questions about MultiCharts .NET and user contributed studies.
MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Finding a list of data series objects

Postby MidKnight » 14 Oct 2012

Hi there,

Is there anyway to get a list of the data series objects that are on a chart?

With thanks in advance,
MK

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2942 times

Re: Finding a list of data series objects

Postby Henry MultiСharts » 15 Oct 2012

Hello MidKnight,

check out "IInstrument".

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: Finding a list of data series objects

Postby MidKnight » 16 Oct 2012

Hi there Henry,

I don't see how IInstrument helps me - maybe you can be more specific. I want a list of all the data series objects on a chart so I can iterate through them all. There may be any number of streams on the chart so hardcoding the data stream count is not practical.

All my best,
MK

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2942 times

Re: Finding a list of data series objects

Postby Henry MultiСharts » 16 Oct 2012

Hello MidKnight,

With MaxDataStream you can check the maximum number of the data series on the chart.
With CStudyControl.IsExist you can check what dataseries are present on the chart and what are missing.

Using BarsOfData you can get access to the data of the certain dataseries. With IInstrument you can get all of the information regarding this data series.

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: Finding a list of data series objects

Postby MidKnight » 16 Oct 2012

Thanks for the reply Henry. I had seen the MaxDataStreams property but the help says:
Read-only property. Maximum available number of datastreams allowed on the chart.
But you are saying it is telling you the total number of data streams on the chart. That is why I was confused. I'll do some testing on my own with this property, but I think the help file isn't clear and/or the name of the property is ambiguous. DataStreamCount would have been a much clearer name to me.

Thanks again for the reply. You teach me a lot.

With kind regards,
MK

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2942 times

Re: Finding a list of data series objects

Postby Henry MultiСharts » 18 Oct 2012

Hello MidKnight,

Thank you. We'll fix the description.

The correct one is:
IStudy.MaxDataStream Property
Read-only property. The maximum index number of datastreams present on the chart.

User avatar
orad
Posts: 119
Joined: 14 Nov 2012
Has thanked: 50 times
Been thanked: 18 times

Re: Finding a list of data series objects

Postby orad » 22 Nov 2018

I noticed there is an inconsistency for MaxDataStream property in Portfolio Manager and when Charting.

In Portfolio Manager, MaxDataStream is always 10 while in Charting, MaxDataStream is the data number of the last data stream on the chart.

This is probably a bug in MultiCharts that needs to be fixed. For now, I'm using the following code to work around this issue:

Code: Select all

private int? _dataStreamCount;

public int DataStreamCount
{
get
{
if (_dataStreamCount == null)
{
if (Environment.ApplicationCode == EApplicationCode.Portfolio)
{
// in Portfolio Manager, MaxDataStream is always 10
_dataStreamCount = 0;
for (int i = 1; i <= MaxDataStream; i++)
{
if (!IsExist(i))
{
break;
}
_dataStreamCount++;
}
}
else
{
// in Charting, MaxDataStream is the data number of the last data stream on chart
_dataStreamCount = MaxDataStream;
}
}

return _dataStreamCount.Value;
}
}

User avatar
Svetlana MultiCharts
Posts: 296
Joined: 19 Oct 2017
Has thanked: 1 time
Been thanked: 74 times

Re: Finding a list of data series objects

Postby Svetlana MultiCharts » 07 Dec 2018

Hello, orad,

This behaviour is expected. A study cannot know how many data series are accessible, unless it tries to access each of them. One needs to take into account the number of data series required for the study operation beforehand while developing this study. Unfortunately, there is not any universal way.


Return to “MultiCharts .NET”