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.

Settings

Timeframe:
This sets the timeframe resolution to analyze.

Offset:
(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
// www.zenandtheartoftrading.com
// @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, color=color.red, title="HTF High")
s1 = plot(htfLow, color=color.blue, title="HTF Low")

// Fill wick zone
r2 = plot(paint ? htfclose : na, color = na, transp=100)
s2 = plot(paint ? htfopen : na, color = na, transp=100)
fill(r1, r2, color=color.red, transp=90, title="HTF High Zone")
fill(s1, s2, color=color.blue, transp=90, title="HTF Low Zone")

Last Updated: 29th April, 2020


Free Premium Charts!

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments