How to get High and Low of last 5minute candle in Hourly Chart

I need to get the last 5minute candle High and low in Hourly chart.

InHourly/Daily chart I am trying to display High of last 5minute bar but i always endup in getting high of last Hour Candle or last daily candle.

_5minHigh = TimeFrameGetPrice( "H", in5Minute, shift = 0 );
GfxTextOut( ( "Last5min High %: "+ LastValue(_5minHigh,0) ), 13, y - 80 );

Please read the manual first.
It is clearly mentioned there that you can only go from shorter interval to longer interval but not other way around.

Multiple Time Frame support

PLEASE NOTE that you can only compress data from shorter interval to longer interval. So when working with 1-minute data you can compress to 2, 3, 4, 5, 6, ....N-minute data. But when working with 15 minute data you can not get 1-minute data bars. In a similar way if you have only EOD data you can not access intraday time frames.

Also you do not need time frame functions.

Open two charts, one using 5-minute interval and other one using hourly interval.
In 5-minute interval (of chart or explorer) store last value to static var.

If ( StrMatch(Interval(2), "5-minute") ) {
    StaticVarSet("Last_High", LastValue(High));
    StaticVarSet("Last_Low", LastValue(Low));
}

And in Hourly chart you call them

last_high = StaticVarGet("Last_High");
last_low = StaticVarGet("Last_Low);

Also please carefully read first post here.

2 Likes