Dataloader

Questions about MultiCharts .NET and user contributed studies.
beggar
Posts: 27
Joined: 22 Sep 2016

Dataloader

Postby beggar » 01 Apr 2017

I am trying to test the data loader using Renko charts. So far what I have done is create a Renko tick chart with a 10 cent box size. Then I applied a simple dataloader index of closes as a study on the subchart with the same parameters as the Renko chart. The close of the dataloader has the same close as the Renko chart bar for bar.

I then applied the same dataloader study to a 15 minute chart. I noticed that there were 130 bars on the 15 minute chart going back 5 days and there were only 104 bars on Renko chart going back 5 days. So for the first 104 bars, the close of the dataloader study matched the close of the Renko chart that I originally applied it to. But on the 15 minute chart there were an additional 26 bars that were being calculated with Renko data. I am not sure where the data is coming from. On the renko chart bar 104 was the close on March 31st but bar 104 on the 15 minute chart was the close on March 30.

I tried changing the datarequest a few times to only download 5 days of data or maybe 104 days of data just to see if anything changes. But nothing seems to work

Code: Select all

using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using System.Threading;
using System.Collections.Generic;

namespace PowerLanguage.Indicator
{
public class Test_DataLoaderWaitingLoading2 : IndicatorObject
{
public Test_DataLoaderWaitingLoading2(object _ctx):base(_ctx){}
private IPlotObject plot1;
private List<Bar> m_home = new List<Bar>();

WaitHandle [] waitHandles = new WaitHandle[]
{
new AutoResetEvent(false)
};


protected override void Create()
{
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
}

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

protected override void CalcBar()
{
InstrumentDataRequest Req = Bars.Request;
Req.Subscribe2RT = true;
Req.Resolution = Resolution.CreateRenko(EResolution.Tick, 1, RenkoBoxSizeType.FIXEDPRICE,.1, true, false, true, false);
Req.Resolution.Attributes.Add(1090,0);
var dataReq = new DataRequest(DateTime.Now, Bars.FullSymbolData.Count, DataRequestType.DaysBack, DateTime.MinValue);
Req.FilterOutOfRangeData = true;
Req.Range.ToAlwaysIsNow = false;
IDataLoaderResult iRes = DataLoader.BeginLoadData(Req, _Result, waitHandles[0]);
WaitHandle.WaitAny(waitHandles); // Waiting for data
DataLoader.EndLoadData(iRes);
if (Bars.Status == EBarState.Close)
{
int index = (Bars.CurrentBar - 1);//, (m_home.Count - 1));
if (index > 0)
{
plot1.Set(m_home[index].Close);
}
}
;
}


protected void _Result( IDataLoaderResult _res )
{
AutoResetEvent _are = (AutoResetEvent)_res.State;
if (_res.IsCompleted)
{
switch (_res.Event)
{
case DataLoadedEvent.History:
m_home.AddRange(_res.Data);
break;
case DataLoadedEvent.RTNewBar:
if(_res.RTData.HasValue)
m_home.Add(_res.RTData.Value);
break;
default:
break;
}
}
else
Output.WriteLine("------> No Data");

_are.Set();

}
}
}

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: Dataloader

Postby Angelina MultiСharts » 07 Apr 2017

Hell beggar,

This is something that is beyond our regular scope of support, as it is related to a particular script design. Therefore I will leave this open for other members of our forum to answer.


Return to “MultiCharts .NET”