HTF High / Low Indicator

This simple script draws higher-timeframe price data to your chart. You can set which timeframe to draw, and the script will render the high/low for that timeframe.

You can also set it to color the zones between the higher-timeframe closes and highs/lows.

How It Works

You set the HTF resolution to scan, the lookback period to use and then the script draws the relevant information to your chart.

The upper line is the high of the previous higher-timeframe candle, and the lower line is the low of the previous higher-timeframe candle.


This sets the timeframe resolution to analyze.

(This option was removed on 29th April, 2020 due to being unnecessary).

Paint Wick Zone?
If enabled then this setting will make the script paint the zone between the highest candle close and the highest high and the lowest candle low and lowest close for the given timeframe.

Pine Script Basics Course Pine Script Mastery Course

Source Code

// Created by Matthew J. Slabosz
// Last Updated: 9th October, 2020
// @version=4
study("HTF High/Low", overlay=true)

// Get input
res = input(title="Timeframe", type=input.resolution, defval="D")
paint = input(title="Paint Wick Zone?", type=input.bool, defval=false)

// Create non-repainting security function
rp_security(_symbol, _res, _src) => security(_symbol, _res, _src[barstate.isrealtime ? 1 : 0])

// Get HTF price data
htfHigh = rp_security(syminfo.tickerid, res, high)
htfLow = rp_security(syminfo.tickerid, res, low)
htfOpen = rp_security(syminfo.tickerid, res, open)
htfClose = rp_security(syminfo.tickerid, res, close)

// Plot data to chart
r1 = plot(htfHigh,, title="HTF High")
s1 = plot(htfLow,, title="HTF Low")

// Fill wick zone
r2 = plot(paint ? htfOpen > htfClose ? htfOpen : htfClose : na, color=na, transp=100)
s2 = plot(paint ? htfOpen < htfClose ? htfOpen : htfClose : na, color=na, transp=100)
fill(r1, r2,, transp=50, title="HTF High Zone")
fill(s1, s2,, transp=50, title="HTF Low Zone")

// Trigger alerts
longAlert = close > htfHigh
shortAlert = close < htfLow
alertcondition(longAlert or shortAlert, title="HTF Breakout Alert", message="Breakout alert for {{ticker}}")

Last Updated: 9th October, 2020

Free Premium Charts!

5 2 votes
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
2 years ago

You’re doing an awesome job making all these indicators. Just wanted to say thanks!!