IDataLoader question

Questions about MultiCharts .NET and user contributed studies.
holya
Posts: 40
Joined: 28 Aug 2012
Location: Vancouver, Canada
Has thanked: 8 times
Been thanked: 1 time

IDataLoader question

Postby holya » 20 Oct 2012

I have an indicator which uses the following code to request data:

idr.Resolution = new Resolution(EResolution.Month, 1);
dlr = dl.BeginLoadData(idr, result =>
{
this.monthlyPa.AddBars(result.Data);
dl.EndLoadData(result);
}, null);

while (!dlr.IsCompleted)
Thread.Sleep(100);

This code was working flawlessly under 8.0, but now when it gets to the while loop it just gets stuck. because the dlr.IsComplete is always false.
The interesting part is that if I put a break point inside the call back method and manually run it again it downloads the data and runs normally.
Has anyone else encountered this?

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

Re: IDataLoader question

Postby Henry MultiСharts » 22 Oct 2012

Hello Holya,

You need to call IDataLoader.EndLoadData(IDataLoaderResult Result) only after all data has been obtained and all actions with the data have been finished because after calling IDataLoader.EndLoadData(IDataLoaderResult Result) the Result contents are cleaned (all flags are reset to False, all data is deleted).

holya
Posts: 40
Joined: 28 Aug 2012
Location: Vancouver, Canada
Has thanked: 8 times
Been thanked: 1 time

Re: IDataLoader question

Postby holya » 23 Oct 2012

Thank you Henry.

holya
Posts: 40
Joined: 28 Aug 2012
Location: Vancouver, Canada
Has thanked: 8 times
Been thanked: 1 time

Re: IDataLoader question

Postby holya » 23 Oct 2012

In the code above where it says:
this.monthlyPa.AddBars(result.Data);
It copies the data to the monthlyPa object. There are 7 or 8 charts which download multiple timeframes.


Return to “MultiCharts .NET”