Indicator · Pine Script v5 · On the chart

ICT Equal Highs and Lows

by ArunKBhaskar

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows.

View on GitHub

GitHub stars575on the repository
Pine versionv5runs as is
Lines of code108
Settings7inputs
LicenceMPL-2.0
Last update1 year ago30 Mar 2025

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

108 lines of Pine Script v5 from ICT Equal Highs and Lows/ICT Equal Highs and Lows Indicator.txt, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

ICT Equal Highs and Lows Indicator.txt
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Arun_K_Bhaskar

//@version=5
i_max_bars_back = 300
indicator(title="ICT Equal Highs and Lows", shorttitle="Equal HL", overlay=true, max_bars_back=i_max_bars_back, max_lines_count=500, max_labels_count=500)

//____________________________ Menu Pivot High Low Start

g_phl_eq = '███████████████ Equal High Low ███████████████'
int i_phl_1_left = input.int(defval=60, title='Left', group=g_phl_eq)
int i_phl_1_right = input.int(defval=30, title='Right', group=g_phl_eq)
tt_eq = "Lower values mean highs and lows are closer."
float i_phl_eq_percent = input.float(defval=0.05, minval=0, step=0.01, title='Equal HL %', tooltip=tt_eq, group=g_phl_eq) 
string i_phl_1_source = input.string(defval='High/Low', title='Source', options=['High/Low', 'Open/Close'], group=g_phl_eq)
color i_phl_1_h_ln_color = input.color(defval=#F7525F, title='Bearish Color', group=g_phl_eq)
color i_phl_1_l_ln_color = input.color(defval=#22AB94, title='Bullish Color', group=g_phl_eq)
int i_phl_eq_transp = input.int(defval=25, minval=0, title='Transparency', group=g_phl_eq) 

//____________________________ Menu Pivot High Low End

//____________________________ Equal High Low Start

// Get Source
float _high = i_phl_1_source == 'Open/Close' ? math.max(open, close) : high
float _low = i_phl_1_source == 'Open/Close' ? math.min(open, close) : low

// Arrays to store the last 2 pivot highs and lows
var float[] ph_arr = array.new_float(2)
var int[] ph_bi_arr = array.new_int(2)
var float[] pl_arr = array.new_float(2)
var int[] pl_bi_arr = array.new_int(2)

// Pivot calculations
int prev_ph_bi = na, int prev_pl_bi = na
bool ph = false, bool pl = false

phl_1_ph = ta.pivothigh(_high, i_phl_1_left, i_phl_1_right)
phl_1_pl = ta.pivotlow(_low, i_phl_1_left, i_phl_1_right)

// Update the arrays with the last 2 pivot highs and lows
if not na(phl_1_ph)
    ph := true
    prev_ph_bi := bar_index - i_phl_1_right
    array.unshift(ph_bi_arr, bar_index)
    array.pop(ph_bi_arr)

if not na(phl_1_pl)
    pl := true
    prev_pl_bi := bar_index - i_phl_1_right
    array.unshift(pl_bi_arr, bar_index)
    array.pop(pl_bi_arr)

// Function to update the arrays with the last 2 values
update_arrays(value, array_ref) =>
    array.unshift(array_ref, value)
    array.pop(array_ref)

// Update arrays with the last 2 pivot highs and lows
if ph
    update_arrays(phl_1_ph, ph_arr)
if pl
    update_arrays(phl_1_pl, pl_arr)

// Get last two pivot highs and lows
ph_price_0 = array.get(ph_arr, 0), ph_price_1 = array.get(ph_arr, 1)
ph_bi_0 = array.get(ph_bi_arr, 0), ph_bi_1 = array.get(ph_bi_arr, 1)

pl_price_0 = array.get(pl_arr, 0), pl_price_1 = array.get(pl_arr, 1)
pl_bi_0 = array.get(pl_bi_arr, 0), pl_bi_1 = array.get(pl_bi_arr, 1)

// Function to calculate percentage change
pchg(price_1, price_2) =>
    change = price_1 - price_2
    percent_change = math.abs((change / price_2) * 100)
    percent_change

// Calculate percentage change between the last two pivot highs and lows
var float ph_pchg = na
var float pl_pchg = na

if array.size(ph_arr) >= 2
    ph_pchg := pchg(array.get(ph_arr, 0), array.get(ph_arr, 1))

if array.size(pl_arr) >= 2
    pl_pchg := pchg(array.get(pl_arr, 0), array.get(pl_arr, 1))

// Draw Equals Box
var levelBoxes_equal = array.new_box()

ph_condition = ph and ph_pchg < i_phl_eq_percent and barstate.isconfirmed
pl_condition = pl and pl_pchg < i_phl_eq_percent and barstate.isconfirmed

if ph_condition
    ph_box = box.new(left=ph_bi_1 - i_phl_1_right, top=ph_price_1, right=ph_bi_0 - i_phl_1_right, bottom=ph_price_0, border_color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_h_ln_color, i_phl_eq_transp))
    array.push(levelBoxes_equal, ph_box)

if pl_condition
    pl_box = box.new(left=pl_bi_1 - i_phl_1_right, top=pl_price_1, right=pl_bi_0 - i_phl_1_right, bottom=pl_price_0, border_color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), bgcolor=color.new(i_phl_1_l_ln_color, i_phl_eq_transp))
    array.push(levelBoxes_equal, pl_box)

// Plot Equal Labels
plotshape(ph_condition ? high[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_h_ln_color, i_phl_eq_transp), size=size.small)
plotshape(pl_condition ? low[i_phl_1_right] : na, style=shape.xcross, location=location.absolute, offset=-i_phl_1_right, color=color.new(i_phl_1_l_ln_color, i_phl_eq_transp), size=size.small)

//____________________________ Equal High Low End

// _____________________________ Code End

Overview

When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and right bar counts set how pivots are confirmed, the source can be High/Low or Open/Close, and colors plus transparency control the display. It is a drawing tool only and does not generate entries, exits, or risk rules.

Details

Published by

ArunKBhaskar on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

SMC / ICT / price action, 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

pinescripttradingview

Settings

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

SettingTypeDefaultVariable
Leftint60i_phl_1_left
Rightint30i_phl_1_right
Equal HL %float0.05i_phl_eq_percent
SourcestringHigh/Lowi_phl_1_source
Bearish Colorcolor#F7525Fi_phl_1_h_ln_color
Bullish Colorcolor#22AB94i_phl_1_l_ln_color
Transparencyint25i_phl_eq_transp
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

DE-tracker

by Allen1212
303 stars

This indicator plots labels on the TradingView price chart to mark ARK Invest's buy and sell trades for the DE stock. Buy transactions appear in green with X1 or X2 multipliers showing the number of ARK ETFs involved on the same day; sells appear in red. The m

Indicator v4 Support & resistanceSMC / ICT / price action
Updated 2 years ago · None stated GitHub repository of DE-tracker

This Pine Script indicator plots a ZigZag on the price chart. It identifies reversal points when price moves more than a set percentage from the last pivot. The script calculates forecasts using zigzag data and labels detected geometric patterns including harm

Indicator v4 TrendSupport & resistance

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

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

Swing Failure Signals

by Ganador1
154 stars

This indicator calculates pivot highs and pivot lows to detect liquidity sweeps and Swing Failure Patterns. It identifies when price breaks past recent key swing highs or lows within a configurable historical window, then looks for a quick reversal or change i

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · Apache-2.0 GitHub repository of Swing Failure Signals

Fractal Model

by fxraptor-alpha
137 stars

Fractal Model is a price-chart indicator that tracks multi-timeframe liquidity sweeps, reversal confirmation, and forward projections. It draws higher-timeframe candles beside price, marks high and low sweeps, and tracks CISD plus later IC-CISD levels after a

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 weeks ago · Custom licence GitHub repository of Fractal Model

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