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 tells the script how far to offset the lines from the current candle.

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.



Source Code

// Created by Matthew J. Slabosz
// www.zenandtheartoftrading.com
// @version=3
study(title="MJS - HTF High/Low", shorttitle="HTF High/Low", overlay=true)

// Get input
res = input(title="Timeframe", type=resolution, defval="W")
off = input(title="Offset", type=integer, defval=1)
paint = input(title="Paint Wick Zone?", type=bool, defval=false)

// Get price data
htfhigh = security(tickerid, res, high)
htflow = security(tickerid, res, low)
htfopen = security(tickerid, res, open)
htfclose = security(tickerid, res, close)

// Plot data
r1 = plot(htfhigh, color=red, title="Previous HTF High", style=linebr, linewidth=1, offset=off)
s1 = plot(htflow, color=blue, title="Previous HTF Low", style=linebr, linewidth=1, offset=off)

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

Last Updated: 21st March, 2019


TradingView Charting Platform

Leave a Comment, Question or Suggestion