DataLoader example

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

DataLoader example

Postby Stan Bokov » 06 Aug 2012

In MultiCharts .NET you can access a lot of various data directly from the scripts. It can be real-time ask and bid and level 2 data from various symbols that are not even charted. You can also access all information from the Order and Position Tracker. This is an example for using the DataLoader interface.

Code: Select all

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;

namespace PowerLanguage.Strategy
{
public class Test_DataLoader : SignalObject
{
public Test_DataLoader(object _ctx):base(_ctx){}
private IOrderMarket buy_order;

protected override void Create()
{
}
protected override void StartCalc()
{
Output.Clear();
}

bool isLosded = false;
protected override void CalcBar()
{
if (Bars.CurrentBar > 1)
{
isLosded = false;
InstrumentDataRequest ir1 = Bars.Request;
ir1.Resolution.Size = 1;
ir1.Resolution.Type = EResolution.Tick;
ir1.From = Bars.Time[1];
ir1.To = Bars.TimeValue;


IDataLoaderResult iRes = DataLoader.BeginLoadData(ir1, DataCB, null);
while (!isLosded)
{
System.Threading.Thread.Sleep(100);
}
}

}

protected void DataCB(IDataLoaderResult Result)
{
if (Result.IsCompleted)
{
DataLoader.EndLoadData(Result);
Output.WriteLine("From {0} To {1} Count Bars is {2}",Result.Request.From,
Result.Request.To, Result.Data.Length);
isLosded = true;
}
}
}
}
Attachments
Test_DataLoader.pln
(1.97 KiB) Downloaded 876 times

alex522
Posts: 42
Joined: 31 May 2010
Has thanked: 20 times
Been thanked: 2 times

Re: DataLoader example

Postby alex522 » 31 Oct 2012

I have tried to run this sample but got the error popup:

<<EXCEPTION>>
Code: 0xFFFFFFFFC0000005 ( -1073741819 )
Continuable: 0x0000000000000000 ( 0 )
Description: The instruction at 0x
ErrorCode: 0xFFFFFFFFC0000005 ( -1073741819 )
ExceptionType: 0x0000000000000000 ( 0 )
Module: {unknown}
Process: C:\Program Files\TS Support\MultiCharts .NET64\MultiCharts64.exe
Thread ID: 0x0000000000000F84 ( 3972 )
Time: 01.11.2012 - 03:03:07.640

Do you all run this samples correctly. Or do you have any idea what might have gone wrong.

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

Re: DataLoader example

Postby Henry MultiСharts » 01 Nov 2012

Alex522, for MultiCharts .Net 8.1 beta 1 please use the code from attachment.
Attachments
Test_DataLoader_MC_8.1.pln
(2.01 KiB) Downloaded 1080 times

alex522
Posts: 42
Joined: 31 May 2010
Has thanked: 20 times
Been thanked: 2 times

Re: DataLoader example

Postby alex522 » 02 Nov 2012

It works! Thanks a lot.

DasBoot
Posts: 6
Joined: 11 Feb 2013
Has thanked: 2 times

Re: DataLoader example

Postby DasBoot » 14 Feb 2013

Please provide code example for realtime subscribe and data load.

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

Re: DataLoader example

Postby Henry MultiСharts » 21 Feb 2013

Please provide code example for realtime subscribe and data load.
A sample code that subscribes to realtime data and outputs the realtime bar values in Output tab of PLEditor window can be found here.

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: DataLoader example

Postby bomberone1 » 14 Nov 2017

Henry,
Is it possible do it also in multicharts easylanguage?

I would like to collect all tick data from all symbols that I trade. more or less are 120
I have a list into market scanner of 120 symbol and i do not open chart.
Is it possible to do a reload with backfill of all data tick at 12.30 and at 23.30.
My purpose is to collect all data and to avoid hole in database.
What is the best solution?

Regards.

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

Re: DataLoader example

Postby Henry MultiСharts » 21 Dec 2017

Henry,
Is it possible do it also in multicharts easylanguage?

I would like to collect all tick data from all symbols that I trade. more or less are 120
I have a list into market scanner of 120 symbol and i do not open chart.
Is it possible to do a reload with backfill of all data tick at 12.30 and at 23.30.
My purpose is to collect all data and to avoid hole in database.
What is the best solution?

Regards.
bomberone1,

DataLoader is not available in PowerLanguage. Currently you can delete the data in your database that you need to have reloaded, restart all MultiCharts processes, open your scanner to load the required data range. An automated tool to do that may be added in one of the future versions:
https://www.multicharts.com/pm/public/m ... es/MC-1017


Return to “User Contributed Studies”