How to access data of any symbol from scripts  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
radekj
Posts: 113
Joined: 28 Apr 2008
Has thanked: 20 times
Been thanked: 1 time

How to access data of any symbol from scripts

Postby radekj » 02 Aug 2012

How to do this ?

"Access data of any symbol from scripts

Your indicators and strategies can access data for symbols that are not even charted, giving you maximum flexibility when making trading decisions.
"

ciao
radekj

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: How to access data of any symbol from scripts  [SOLVED]

Postby Dru » 03 Aug 2012

How to do this ?

"Access data of any symbol from scripts

Your indicators and strategies can access data for symbols that are not even charted, giving you maximum flexibility when making trading decisions.
"

ciao
radekj
Find in MC .NET Help -> "DataLoader"

ALC
Posts: 25
Joined: 13 May 2011
Has thanked: 8 times
Been thanked: 3 times

Re: How to access data of any symbol from scripts

Postby ALC » 05 Aug 2012

Can someone please provide a small example of the code in c# or vb regarding the DataLoader and the returned DataObject. In particular I'm not able to find any reference/help on the Callback function and on the Status of the BeginLoadData.

Thanks.

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

Re: How to access data of any symbol from scripts

Postby Stan Bokov » 06 Aug 2012

Here is a sample to show how DataLoader works:

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 816 times

tornadoatc
Posts: 11
Joined: 05 Feb 2011
Been thanked: 1 time

Re: How to access data of any symbol from scripts

Postby tornadoatc » 20 Aug 2012

I have not yet installed .NET version..

Question: With the DataLoader features is there still a need for ADE / ELC functionality or can all calculations from higher resolution data (e.g. 40,000 share, 80,000 share, and 120,000 share when working with 10,000 share bars) be calcualted and maintained within the same study?

Thanks


Return to “MultiCharts .NET”