Question to "OHLC_Yesterday.Indicator" C#  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Lawrence
Posts: 3
Joined: 30 Sep 2013
Has thanked: 2 times

Question to "OHLC_Yesterday.Indicator" C#

Postby Lawrence » 06 Oct 2013

Hi, I am a bit confused.
please see the lines 77 thru 80 of the indi
m_yestclose.Value = Bars.Close[1];
m_todaysopen.Value = Bars.Open[0];
m_todayshigh.Value = Bars.High[0];
m_todayslow.Value = Bars.Low[0];
it raises two questions:
1st - when attaching the indi to a Minute chart, were is said that Bars.Open, Bars.High and so on is taken from daily interval?
2nd - why is Bars.Open, Bars.High, Bars.Low taken from [0], which should be the current Bar in my understanding and for Bars.Close it is taken from [1], which is one bar back, in my understanding.
Oh and - I can not find a document were something like this is described.
Thanks

clonardo
Posts: 16
Joined: 27 Sep 2013
Has thanked: 1 time
Been thanked: 1 time

Re: Question to "OHLC_Yesterday.Indicator" C#  [SOLVED]

Postby clonardo » 07 Oct 2013

If I'm understanding the code correctly, the first few lines of CalcBar() determine whether the data is daily or intraday, and when to update m_yestclose.Value-

Code: Select all

EResolution resolution = Bars.Info.Resolution.Type;
if (resolution == EResolution.Quarter ||
EResolution.Week <= resolution && resolution <= EResolution.Year) return;

if (Bars.Time[0].Date != Bars.Time[1].Date)
{
m_counter.Value = (m_counter.Value + 1);
m_yestopen.Value = m_todaysopen.Value;
m_yesthigh.Value = m_todayshigh.Value;
m_yestlow.Value = m_todayslow.Value;
m_yestclose.Value = Bars.Close[1];
m_todaysopen.Value = Bars.Open[0];
m_todayshigh.Value = Bars.High[0];
m_todayslow.Value = Bars.Low[0];
It only updates m_yestclose.Value from Bars.Close[1] when your data moves to a new date, which would work regardless of resolution.


Return to “MultiCharts .NET”