Calling XAverage on data loaded with DataLoader

Questions about MultiCharts .NET and user contributed studies.
Fabrice
Posts: 182
Joined: 14 Jun 2011
Has thanked: 44 times
Been thanked: 30 times

Calling XAverage on data loaded with DataLoader

Postby Fabrice » 16 Mar 2014

Hello,

How can we call XAverage on an instrument loaded with DataLoader ?

When we create an instance of Xaverage, we "attach" it on datastream. For example :

Code: Select all

xavg = new XAverage(this, 2)
But with Dataloader, there is no # for the instrument loaded, as Dataloader seems only able to produce Bar[] objects, where we would - naturally - expect it to provide us with an IInstrument object, or , for the least, some object that implements ISeries. We cannot do something like :

Code: Select all

private void ProcessData(List<Bar> Container, IDataLoaderResult Result)
{
Bar[] foo = Result.Data;
xavg.Price = foo; // Not allowed: Result.Data is not an ISeries
}
What is the solution ?

Regards.

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

Re: Calling XAverage on data loaded with DataLoader

Postby Henry MultiСharts » 19 Mar 2014

Fabrice,

Please find an example how to convert an array of data into ISeries here.


Return to “MultiCharts .NET”