change param of Highd  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
zzzlondon
Posts: 4
Joined: 10 Sep 2013
Has thanked: 1 time

change param of Highd

Postby zzzlondon » 28 Oct 2013

I want to change params of Highd, but the value never change

Code: Select all

namespace PowerLanguage.Indicator{
public class test1_zb : IndicatorObject {
private Function.HighD m_kbarD;
private VariableSeries<Double> Value1;
private IPlotObject plot1;

public test1_zb(object _ctx):base(_ctx){}
protected override void Create() {
plot1 = AddPlot(new PlotAttributes("", EPlotShapes.Line, Color.Red));
m_kbarD = new Function.HighD(this);
Value1=new VariableSeries<Double>(this);
}
protected override void StartCalc() {
m_kbarD.periodsago=2;
}
protected override void CalcBar(){
[b]if(Bars.TimeValue.TimeOfDay>=new TimeSpan(10,00,00))m_kbarD.periodsago=3;[/b]

Value1.Value=m_kbarD[0];
plot1.Set(0, Value1.Value);
}


}
}

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

Re: change param of Highd

Postby Henry MultiСharts » 29 Oct 2013

Hello zzzlondon,

The value changes but only once. Probably this is how your code should look like:

Code: Select all

if(Bars.TimeValue.TimeOfDay>= new TimeSpan(10,00,00))
m_kbarD.periodsago=3;
else
m_kbarD.periodsago = 2;

zzzlondon
Posts: 4
Joined: 10 Sep 2013
Has thanked: 1 time

Re: change param of Highd

Postby zzzlondon » 30 Oct 2013

sorry, doesn't work..
Image

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: change param of Highd

Postby MidKnight » 30 Oct 2013

Can you please briefly explain what you are trying to do?

With kind regards,
MK

zzzlondon
Posts: 4
Joined: 10 Sep 2013
Has thanked: 1 time

Re: change param of Highd

Postby zzzlondon » 30 Oct 2013

in EL ,code like this

if time>=1000 then value1=highD(3);
if time>=1040 then value1=highD(4);
if time>=1200 then value1=highD(5);

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: change param of Highd

Postby MidKnight » 30 Oct 2013

So you want to be able to reference the high X days ago on an intraday chart?

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

Re: change param of Highd

Postby Henry MultiСharts » 30 Oct 2013

zzzlondon, in this case you need to create multiple different function objects with the corresponding "periodsago" value. Then utilize them in your code when required.

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: change param of Highd  [SOLVED]

Postby MidKnight » 30 Oct 2013

So you want to be able to reference the high X days ago on an intraday chart?
I'm about to go to bed for the night so thought I'd post this just in case what I wrote above is what you want to do. I'd probably just use my daycompressor class. You can see it in the contrib section of this forum.

Code: Select all

http://www.multicharts.com/discussion/viewtopic.php?f=20&t=45322
I don't know what the HighD counts as the days cut off, but most of the "day" data collecting code I've seen supplied with MC.net so far just uses midnight as cut off. My code will use the defined session. Maybe this helps you.

With kind regards,
MK


Return to “MultiCharts .NET”