CustomInstrument for the resolution same as primary data's

Questions about MultiCharts .NET and user contributed studies.
sunrisus
Posts: 4
Joined: 19 Mar 2019
Has thanked: 2 times

CustomInstrument for the resolution same as primary data's

Postby sunrisus » 21 Mar 2019

Hi from a new comer!

I have been playing with data retrieving using CustomInstrument, and noticed that it is working fine for retrieving instruments except the resolution the same as the primary data's.. I know I could do it with DataLoader, but the later is not bond with primary bars and would make plotting more difficult. It would be nicer if Multicharts would allow requesting new instruments with the same resolution as the primary data's, facilitating plotting.

I also know I could bypass the problem by loading data2 to chart, and using BarsOfData(2) , but if I were to manually load 10-20 instruments to chart every time, that would be a painful process.

I am not sure if not allowing the resolution same as primary series is by design or a bug.

The following is the sample code, with primary chart data resolution of 1 day. All resolutions works fine except the resolution the same as primary data's.

Code: Select all

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

namespace PowerLanguage.Indicator
{
//[SameAsSymbol(true)]
public class _aTest : IndicatorObject
{

CustomInstrument inst2;

public _aTest(object ctx) : base(ctx){
}

protected override void Create(){
}

protected override void StartCalc(){
inst2 = new PowerLanguage.CustomInstrument(
Bars,
"TS",
SymbolStorage.GetSymbols("TS", "QQQ")[0],
new Resolution { Size = 1, Type = EResolution.Minute },
//new Resolution { Size = 1, Type = EResolution.Hour },
//new Resolution { Size = 1, Type = EResolution.Day },
//new Resolution { Size = Bars.Info.Resolution.Size, Type = Bars.Info.Resolution.Type },
true,
RequestQuoteField.Trade
);
}


protected override void CalcBar(){
Output.WriteLine("inst2.CloseValue={0}", inst2.CloseValue);
}

protected override void Dispose( bool _b)
{
inst2.Dispose();
}
}
}
_aTest.pln
(1.2 KiB) Downloaded 133 times
Last edited by sunrisus on 26 Mar 2019, edited 1 time in total.

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: CustomInstrument for the resolution same as primary data

Postby Anna MultiCharts » 26 Mar 2019

Hello, sunsirius!

We’ve checked your case on our end. Your study works fine when anything but 1 day is selected for the resolution of the main data series. With minute-based main data series the data for the additional instrument having the same resolution is extracted fine with the help of CustomInstrument, but with 1 day there appears an error. Please confirm that the situation is the same on your end or please be more specific about the exact resolutions that you cannot access using CustomInstrument. Also please attach a screenshot of the error if you receive any.

sunrisus
Posts: 4
Joined: 19 Mar 2019
Has thanked: 2 times

Re: CustomInstrument for the resolution same as primary data

Postby sunrisus » 26 Mar 2019

Thank you Anna! I am sorry I did not check 1 min as main data resolution, I will check that once I get home.. But my experience is basically exact as you described, I always faill to retrieve 1 day data with CustomInstrument when I set the main chart daily. I did try to attach the captured error image, but could not manage to insert that image.

sunrisus
Posts: 4
Joined: 19 Mar 2019
Has thanked: 2 times

Re: CustomInstrument for the resolution same as primary data

Postby sunrisus » 26 Mar 2019

Hi Anna, I rechecked the problem, and list the result as follows. It seems like still as I said: the problem is with the CustomeInstrument set to the resolution the same as the primary series'. Error messages are all similar except the second line which indicates the chart resolution used,. Two error message images are attached, 1day primary resolution with 1 day CustomInstrument resolution, and 1 minute primary resolution with 1 min CustomInstrument resolution.
Capture.PNG
(35.38 KiB) Downloaded 419 times
Capture.PNG
(35.38 KiB) Downloaded 418 times
Capture.PNG
(19.29 KiB) Downloaded 430 times

User avatar
Anna MultiCharts
Posts: 461
Joined: 14 Jul 2017
Has thanked: 31 times
Been thanked: 113 times

Re: CustomInstrument for the resolution same as primary data's

Postby Anna MultiCharts » 17 Apr 2019

sunsirius,

Sorry for the delayed reply. This was confirmed to be a bug, the fix is currently targeted to MultiCharts 13.

sunrisus
Posts: 4
Joined: 19 Mar 2019
Has thanked: 2 times

Re: CustomInstrument for the resolution same as primary data's

Postby sunrisus » 18 Apr 2019

Thank you very much, Anna! I appreciate your effort striving to improve


Return to “MultiCharts .NET”