What can I do to get the calculated value on the chart?

I calculate the maximum rate from H1, from specific hours in my case, 9-10 and 15-16
What to do to get the calculated value on the chart by the end of the day or a specific time?
Need to check later when this value exceeds the price, e.g. for cross functions?
It is about calculating the red lines marked by me on the print screen.

Request for help, thanks in advance :wink:

		SetChartOptions(0,chartShowArrows|chartShowDates);
		_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
		Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 



TimeFrameSet(inHourly); 
K_H1=(Ref(H,1));
K_L1=(Ref(L,1));
TimeFrameRestore(); 
TimeFrameExpand(K_H1, inHourly);
TimeFrameExpand(K_L1, inHourly);
K_H1=(TimeFrameExpand(K_H1, inHourly));
K_L1=(TimeFrameExpand(K_L1, inHourly));

Plot(K_H1, "" , colorGreen, styleThick | styleNoLabel | styleNoTitle );

Plot(TimeNum()==090000, "", colorYellow, styleArea | styleOwnScale | styleNoLabel | styleNoTitle );
Plot(TimeNum()==100000, "", colorYellow, styleArea | styleOwnScale | styleNoLabel | styleNoTitle );
Plot(TimeNum()==150000, "", colorYellow, styleArea | styleOwnScale | styleNoLabel | styleNoTitle );
Plot(TimeNum()==155900, "", colorYellow, styleArea | styleOwnScale | styleNoLabel | styleNoTitle );

image

Hi @Zbigniew ,
It's not clear to me what you really want to achieve there, I can only guess...Anyway it seems you want to compute two arrays, high of first hour (HFH) and high of last hour (HLH). Try to append something like:

TN = TimeNum();
FirstHour = (TN >= 090000) AND (TN < 100000);
LastHour = (TN >= 150000) AND (TN < 160000);
HFH = ValueWhen(FirstHour, Ref(K_H1,-1));
HLH = ValueWhen(LastHour, Ref(K_H1, -1));
Plot(HFH, "", colorRed, styleThick | styleStaircase);
Plot(HLH, "", colorRed, styleThick | styleStaircase);

// Display at EOD
LastBar = Cum(1) == BarCount;
D = Day();
EOD = (D != Ref(D, 1)) OR LastBar; // Last bar of day
GfxSetCoordsMode(1);
for(i = 0; i < BarCount; ++i) if (EOD[i]) {
	PlotText("Fist: "+HFH[i], i, HFH[i], colorRed, colorDefault, -12);
	PlotText("Last: "+HLH[i], i, HLH[i], colorRed, colorDefault, 12);
}

// Show Selected Value
Title = Title + "\nHigh of first hour: "+SelectedValue(HFH);
Title = Title + "\nHigh of last hour: "+SelectedValue(HLH);

Regards

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.