Indicator · Pine Script v5 · On the chart

Normalize Heatmap Indicator

by palitojendthen

The Normalize Heatmap Indicator scales a chosen price source between 0 and 1 over a set lookback period using stochastic-style min-max normalization.

View on GitHub

GitHub stars20on the repository
Pine versionv5runs as is
Lines of code87
Settings7inputs
LicenceNone statedfile: MPL-2.0
Last update1 year ago12 Jul 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

87 lines of Pine Script v5 from indicator/normalize_heatmap.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

normalize_heatmap.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © palitoj_endthen

//@version=5
indicator(title = 'Normalize Heatmap Indicator', shorttitle = 'normalize_heatmap', overlay = true)


// input
src = input.source(defval = ohlc4, title = 'Source', group = 'Options', tooltip = 'Determines the source of input data to be normalized')
color_scheme = input.string(defval = 'Rainbow', title = 'Color Scheme', group = 'Options', options = ['Rainbow', 'RGB'], tooltip = 'Choose the applied heatmap color scheme')
ma_type = input.string('WMA', title = 'MA Type', group = 'Options', options = ['WMA', 'EMA', 'SMA', 'RMA'],tooltip = 'Choose between moving average types')
show_ma = input.bool(defval = true, title = 'MA', group = 'Lookback Period', tooltip = 'Determines whether to display moving average line', inline = 'f')
length = input.int(defval = 50, title = 'Length', group = 'Lookback Period', tooltip = 'Determines lookback period of data to be normalized/moving average', inline = 'f')
buy_alert = input.float(defval = .1, title = 'Buy', group = 'Alert', inline = 'f')
sell_alert = input.float(defval = .9, title = 'Sell', group = 'Alert', tooltip = 'Determines the threshold/level to be used on buy/sell alert', inline = 'f')


// normalize data
// @source: source of input data
// @length: lookback period
norm(_src, _length)=>
    _high = ta.highest(_src, _length)
    _low = ta.lowest(_src, _length)
    normalized = (_src-_low)/(_high-_low)

normalize = norm(src, length)

// moving average
float ma = switch ma_type
    'WMA' => ta.wma(src, length)
    'EMA' => ta.ema(src, length)
    'SMA' => ta.sma(src, length)
    'RMA' => ta.rma(src, length)


// color condition
// (1) scheme1: rainbow heatmap - condition
scheme1 = (normalize < 0.05 ? #0000CA :
             normalize < 0.1 ? #0000DF :
             normalize < 0.15 ? #0A4CFF :
             normalize < 0.2 ? #0A85FF :
             normalize < 0.25 ? #0AFFB6 :
             normalize < 0.3 ? #0AFF64 :
             normalize < 0.35 ? #01EB57 :
             normalize < 0.4 ? #01C74A :
             normalize < 0.45 ? #01C701 :
             normalize < 0.5 ? #33BA02 :
             normalize < 0.55 ? #EFFF06 :
             normalize < 0.6 ? #CFDE00 :
             normalize < 0.65 ? #FFE600 :
             normalize < 0.7 ? #FCB000 :
             normalize < 0.75 ? #FF9100 :
             normalize < 0.8 ? #E88300 :
             normalize < 0.85 ? #E85D00 :
             normalize < 0.9 ? #D25400 :
             normalize < 0.95 ? #FF2E04 :
             #DC0404)

// (2) scheme2: rgb - condition
scheme2(x)=>
    if x > .5
        color.rgb(255*(2-2*x), 255, 0)
    else if x < .5
        color.rgb(255, 2*255*x, 0)

color_shift = color_scheme == 'Rainbow' ? scheme1 : scheme2(normalize)

// (3) moving average - condition
ma_color = src > ma and ma > ma[1] ? color.green : color.red
_ma_color = src > ma and ma > ma[1]


// visualize
plotcandle(open, high, low, close, color = color_shift, wickcolor = color_shift, bordercolor = color_shift)
plot(show_ma ? ma : na, color = ma_color, linewidth = 2)


// create alert
// (1) moving average - alert
alertcondition((not _ma_color[1] and _ma_color), title = 'MA Entry', message = 'Buy/Long entry detected')
alertcondition((_ma_color[1] and not _ma_color), title = 'MA Close', message = 'Sell/Short entry detected ')

// (2) normalize heatmap - alert
_buy = ta.crossunder(normalize, buy_alert)
_sell = ta.crossover(normalize, sell_alert)
alertcondition(_buy, title = 'Normalized Entry', message = 'Buy/Long entry detected')
alertcondition(_sell, title = 'Normalized Close', message = 'Sell/Short entry detected')

Overview

Normalize Heatmap Indicator paints price candles on the main chart using configurable Rainbow or RGB color gradients based on the normalized level. Additionally, it optionally plots a moving average (WMA, EMA, SMA, or RMA) that dynamically changes color according to trend direction. Alerts are available for moving average crossovers and normalized threshold levels.

Details

Published by

palitojendthen on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages

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

indicatortechnical-analysispinescripttrading-algorithms

Settings

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

SettingTypeDefaultVariable
Sourcesourceohlc4src
Color SchemestringRainbowcolor_scheme
MA TypestringWMAma_type
MAbooltrueshow_ma
Lengthint50length
Buyfloat.1buy_alert
Sellfloat.9sell_alert
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

948 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average
218 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist

Daily Trend Filter

by agutinbaigo28
147 stars

Calculates market regime conditions by combining RSI, MACD, and ADX/DMI indicators. It evaluates whether the market is in a strong bullish, strong bearish, neutral, or non-trending regime. The script plots a colored line overlaying the close price to reflect t

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Daily Trend Filter

AAPP

by capissimo
114 stars

This indicator plots an adaptive moving average or scaled RSI divergence line directly on the price chart. It calculates dual RSI series to measure momentum divergence, scales the values to the chart's price range, and constructs an adaptive average filtered b

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of AAPP

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Signal Strategy 15m
56 stars

Double Screened Decision is a multi-timeframe trend and momentum indicator overlaid directly on the price chart. It dynamically selects a higher timeframe based on the active chart resolution to evaluate higher-timeframe MACD, Bollinger Bands, RSI, and Stochas

Indicator v5 TrendMoving averages Repaints
Updated 4 months ago · None stated GitHub repository of Double Screened Decision

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