Useful example of referencing higher timeseries Data

Questions about MultiCharts .NET and user contributed studies.
davewolfs
Posts: 89
Joined: 06 Feb 2013
Has thanked: 2 times
Been thanked: 11 times

Useful example of referencing higher timeseries Data

Postby davewolfs » 06 Mar 2013

Looking for an example of following.

Base series is intraday i.e. 5M, 10M etc...

Looking for a way to take current series and current symbol and compress into higher timeframe i.e. current day, currentweek, previous week, current week.

I do not want to manually add a dataseries to the chart, I want to do this from within the code.

In addition to the above, once I have this series is it possible to feed it into an function e.g. Moving Average, Swing High, etc...

How can I do this? Is this possible.

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

Re: Useful example of referencing higher timeseries Data

Postby Henry MultiСharts » 06 Mar 2013

Hello davewolfs,

You can load a custom data series with IDataLoader. In order to have your study calculated on this data you will need to write your own code for calculation on IDataLoader data.
Here is where to find IDataLoader interface example.

davewolfs
Posts: 89
Joined: 06 Feb 2013
Has thanked: 2 times
Been thanked: 11 times

Re: Useful example of referencing higher timeseries Data

Postby davewolfs » 06 Mar 2013

A few more questions.

Is DataLoader.BeginLoadData() non blocking/asynchronous (it appears that it is). I find this odd, because you force the user to have to sleep, this doesn't seem clean.

There are two properties, Data1 and Data2 what is the difference?

Data1 is of Type Bar[]. How can I convert an array of Bar to an ISeries? If not, than how can I compute a moving average on a Bar Array?

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

Re: Useful example of referencing higher timeseries Data

Postby Henry MultiСharts » 07 Mar 2013

There are two properties, Data1 and Data2 what is the difference?
1 - For regular bars
2 - For Volume Delta resolutions
Data1 is of Type Bar[]. How can I convert an array of Bar to an ISeries? If not, than how can I compute a moving average on a Bar Array?
At the moment you need to write your own code to do that.
We are going to improve the IDataLoader interface in the future versions to make it easier for use.

davewolfs
Posts: 89
Joined: 06 Feb 2013
Has thanked: 2 times
Been thanked: 11 times

Re: Useful example of referencing higher timeseries Data

Postby davewolfs » 07 Mar 2013

What classes implement the ISeries interface? Can you please provide an example of initializing a collection of objects which implement this interface.

I see that variable series and object both do. But these classes are designed such that when assigning value you are giving the value of the current bar. I don't see anything that can take a number of bars and initialize with these values.

The Indexer is overload for the ISeries object, but it clearly specifies that it is read only. Aside form this I don't see a way to do this.

Please advise.

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

Re: Useful example of referencing higher timeseries Data

Postby Henry MultiСharts » 14 Mar 2013

There is no such class at the moment. You need to write your own code to do that or wait for the IDataLoader interface improvement.

davewolfs
Posts: 89
Joined: 06 Feb 2013
Has thanked: 2 times
Been thanked: 11 times

Re: Useful example of referencing higher timeseries Data

Postby davewolfs » 15 Mar 2013

Not tested.

But the way to go from Array to ISeries is through the undocumented Lamdba class.
The Lamda class is basically an ISeries class wrapper around your own data type.
It requires an anonymous lamdba function which is given the bar index being requested and what the value is mapped to.

So for example.

Code: Select all

private AverageFC m_averagefc1;
m_averagefc1.price = new Lambda<double>(barIndex =>Bars.High[barIndex]);
This is how one would run through a bar series of highs through a moving averages.
Not that we can use anything in the anonymous function.
So if we loaded a weekly timeframe, we could use this in place here.


Return to “MultiCharts .NET”