Indicator Β· Pine Script v5 Β· On the chart

Donald - Highest-Lowest Visual

by dearvn

This overlay indicator smooths a rolling highest low and lowest high with a rational quadratic kernel, then holds a step line that switches between those two smoothed levels when the selected source crosses them.

View on GitHub

GitHub stars257on the repository
Pine versionv5runs as is
Lines of code52
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update6 weeks ago11 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

52 lines of Pine Script v5 from highest-lowest-visual.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

highest-lowest-visual.txt
// This Pine Scriptβ„’ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

//@version=5
indicator("Donald - Highest-Lowest Visual", shorttitle = "Donald - Highest-Lowest Visual",  overlay = true)

import jdehorty/KernelFunctions/2 as kernels

///     π™π™Žπ™€π™ π™„π™‰π™‹π™π™π™Ž     ///
int length            = input(6,    group = "οΌ³ο½…ο½”ο½”ο½‰ο½Žο½‡ο½“")
int offset            = input(4,     group = "οΌ³ο½…ο½”ο½”ο½‰ο½Žο½‡ο½“")
series float src      = input(close, group = "οΌ³ο½…ο½”ο½”ο½‰ο½Žο½‡ο½“")
bool Use_High_and_Low = input(false, group = "οΌ³ο½…ο½”ο½”ο½‰ο½Žο½‡ο½“")

// Visual
bool bar_color        = input(false,        group = "οΌΆο½‰ο½“ο½•ο½ο½Œ")
color color_up        = input(color.blue, group = "οΌΆο½‰ο½“ο½•ο½ο½Œ")
color color_dn        = input(color.red,  group = "οΌΆο½‰ο½“ο½•ο½ο½Œ")

// Kernel Settings
lookbackWindow = input.int(8, "Lookback Window", tooltip="The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars. Recommended range: 3-50", group="Kernel Settings")
relativeWeighting = input.float(8., "Relative Weighting", step=0.25, tooltip="Relative weighting of time frames. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel. Recommended range: 0.25-25", group="Kernel Settings")
startBar = input.int(25, "Start Regression at Bar", tooltip="Bar index on which to start regression. The first bars of a chart are often highly volatile, and omission of these initial bars often leads to a better overall fit. Recommended range: 5-25", group="Kernel Settings")


highestHigh = kernels.rationalQuadratic(ta.highest(low, length), lookbackWindow, relativeWeighting, startBar)
lowestLow = kernels.rationalQuadratic(ta.lowest(high, length), lookbackWindow, relativeWeighting, startBar)

/// π™„π™‰π˜Ώπ™„π˜Ύπ˜Όπ™π™Šπ™ π˜Ύπ˜Όπ™‡π˜Ύπ™π™‡π˜Όπ™π™„π™Šπ™‰ ///
var series float hlt = 0.0
series float upper = highestHigh
series float lower = lowestLow

hlt :=  src > upper ? 
         lower : src < lower ? 
          upper : nz(hlt)

///      π™‹π™‡π™Šπ™         ///
color color = src >= hlt 
             ? color_up 
             : color_dn

p1 = plot(hlt, 
         color = color,
         style = plot.style_cross
         )
         
p2 = plot(src, display = display.none)

fill(p1, p2, color = color.new(color, 80))

// Bar color
barcolor(bar_color ? color : na)

Overview

Donald - Highest-Lowest Visual plots that line as crosses on the price chart, fills the area between the line and the source, and can color bars with the same up or down state. Length, source, kernel lookback, relative weighting, and the regression start bar change the calculation. It is visual only and has no trade entries or exits.

Details

Published by

dearvn on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

futures-markettradingviewtradovatetrading-futureses1best-indicator-tradingviewnq1trading-futurerus-stock-market

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
lengthint6length
offsetint4offset
srcsourceclosesrc
Use_High_and_LowboolfalseUse_High_and_Low
bar_colorboolfalsebar_color
color_upcolorcolor.bluecolor_up
color_dncolorcolor.redcolor_dn
Lookback Windowint8lookbackWindow
Relative Weightingfloat8.relativeWeighting
Start Regression at Barint25startBar
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

This indicator detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult

Indicator v5 Support & resistanceTrend
Updated 1 year ago Β· MPL-2.0 GitHub repository of ICT Equal Highs and Lows with Screener

Function - Linear Regression

by ricardosantos79
261 stars

This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up

Indicator v5 TrendSupport & resistance
Updated 4 years ago Β· None stated GitHub repository of Function - Linear Regression

Ichimoku Cloud

by harryguiacorn
219 stars

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts

Indicator v5 TrendMoving averages
Updated 1 year ago Β· None stated GitHub repository of Ichimoku Cloud
219 stars

This indicator identifies local swing highs and swing lows to construct a Zig Zag pattern on the main price chart. It evaluates pivot points based on a customizable number of surrounding left and right bars. Using persistent variables, the script tracks previo

Indicator v4 Support & resistanceTrend Repaints
Updated 5 years ago Β· None stated GitHub repository of Teaching: Finding Highs and Lows 6

Dynamic Linear Regression

by TradersPost
218 stars

Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin

Indicator v6 TrendSupport & resistance
Updated 3 months ago Β· None stated GitHub repository of Dynamic Linear Regression

Open Source Fractal

by cantolab
183 stars

This indicator implements the Fractal Model concept to plot market structure shifts, liquidity sweeps, and Change in State of Delivery (CISD) levels. It overlays custom higher-timeframe candle previews, open prices, and time markers directly on the price chart

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago Β· MIT GitHub repository of Open Source Fractal

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers