Indicator · Pine Script v5 · Own pane

RSI Impact Heat Map [Trendoscope]

by regalouisei· code credited to HeWhoMustNotBeNamed

This indicator analyzes and visualizes the statistical price impact following specific Relative Strength Index (RSI) trigger conditions.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code100
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update8 months ago25 Feb 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

100 lines of Pine Script v5 from pinescript/editors_picks/rsi-impact-heat-map-trendoscope.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

rsi-impact-heat-map-trendoscope.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © HeWhoMustNotBeNamed
//                                       ░▒             
//                                  ▒▒▒   ▒▒      
//                              ▒▒▒▒▒     ▒▒      
//                      ▒▒▒▒▒▒▒░     ▒     ▒▒          
//                  ▒▒▒▒▒▒           ▒     ▒▒          
//             ▓▒▒▒       ▒        ▒▒▒▒▒▒▒▒▒▒▒  
//   ▒▒▒▒▒▒▒▒▒▒▒ ▒        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒         
//   ▒  ▒       ░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░        
//   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒▒▒▒▒▒▒▒         
//   ▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒                       
//    ▒▒▒▒▒         ▒▒▒▒▒▒▒                            
//                 ▒▒▒▒▒▒▒▒▒                           
//                ▒▒▒▒▒ ▒▒▒▒▒                          
//               ░▒▒▒▒   ▒▒▒▒▓      ████████╗██████╗ ███████╗███╗   ██╗██████╗  ██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗
//              ▓▒▒▒▒     ▒▒▒▒      ╚══██╔══╝██╔══██╗██╔════╝████╗  ██║██╔══██╗██╔═══██╗██╔════╝██╔════╝██╔═══██╗██╔══██╗██╔════╝
//              ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒        ██║   ██████╔╝█████╗  ██╔██╗ ██║██║  ██║██║   ██║███████╗██║     ██║   ██║██████╔╝█████╗ 
//             ▒▒▒▒▒       ▒▒▒▒▒       ██║   ██╔══██╗██╔══╝  ██║╚██╗██║██║  ██║██║   ██║╚════██║██║     ██║   ██║██╔═══╝ ██╔══╝  
//            ▒▒▒▒▒         ▒▒▒▒▒      ██║   ██║  ██║███████╗██║ ╚████║██████╔╝╚██████╔╝███████║╚██████╗╚██████╔╝██║     ███████╗
//             ▒▒             ▒                        
//@version=5
indicator("RSI Impact Heat Map [Trendoscope]", "RSIHM[Trendoscope]", overlay = false)

rsiSource = input.source(close, 'Source', inline='r', group='RSI')
rsiLength = input.int(14, '', 5, 200, 5, inline='r', group='RSI', tooltip = 'RSI configuration')
rsiTrigger = input.string('Crossover', 'Trigger', ['Crossover', 'Crossunder'], inline='rt', group = 'RSI')
rsiTriggerValue = input.int(70, '', 0, 100, 5, inline='rt', group = 'RSI', tooltip = 'Trigger for which we need to plot the impact')

impactDuration = input.int(20, 'Duration', 0, 500, 10, group='Impact', tooltip = 'Duration for which impact needs to be measured')
reference = input.string('ATR', 'Reference', ['ATR', 'Percentage'], group='Impact', tooltip='Reference on which the impact is measured')

matrixSize = input.int(50, 'Heat Map Size', 10, 90, 10, group='Display', tooltip = 'Number of rows, columns for heat map matrix')
outliersPercentile = input.int(95, 'Outliers Percentile', 50, 100, 5, group='Display', tooltip = 'Percentile to filter outliers. Value of 95 means, 95th percentile is considered as max displacement')

backgroundColor = input.color(color.rgb(0,0,0,0), 'Background', group='Display', tooltip = 'Background color')
heatmapColor = input.color(color.red, 'Heatmap', group='Display', tooltip = 'Heatmap color')
type Event
    float xValue
    float yValue

var array<Event> events = array.new<Event>()

rsi = ta.rsi(rsiSource, rsiLength)
trigger = rsiTrigger == 'Crossover' ? ta.crossover(rsi, rsiTriggerValue) : ta.crossunder(rsi, rsiTriggerValue)
atr = ta.atr(rsiLength)

highest = ta.highest(impactDuration-1)
lowest = ta.lowest(impactDuration-1)

var array<float> displacements = array.new<float>()

if(trigger[impactDuration])
    price = close[impactDuration]
    positiveDisplacement = math.abs(highest-price)
    negativeDisplacement = math.abs(price-lowest)
    xValue = reference == 'ATR'? positiveDisplacement/atr[impactDuration] : reference == 'Percentage' ? positiveDisplacement/price : positiveDisplacement
    yValue = reference == "ATR"? negativeDisplacement/atr[impactDuration] : reference == 'Percentage' ? negativeDisplacement/price : negativeDisplacement
    array.push(displacements, xValue)
    array.push(displacements, yValue)

    Event event = Event.new(xValue, yValue)
    array.push(events, event)

if(barstate.isfirst)
    var titleTable = table.new(position.top_center, 2, 3, color.maroon, color.maroon, 1, color.maroon, 1)
    title = 'Impact of RSI('+str.tostring(rsiLength)+') '+rsiTrigger+' '+str.tostring(rsiTriggerValue)+ ' after '+str.tostring(impactDuration)+ ' bars measured in terms of '+reference
    table.cell(titleTable, 0, 0, title, text_color = color.white)

if(barstate.islast)
    matrix<int> counts = matrix.new<int>(matrixSize+1, matrixSize+1, 0)
    maxRange = array.percentile_linear_interpolation(displacements, outliersPercentile)
    for event in events
        xIndex = math.min(int(event.xValue*matrixSize/maxRange), matrixSize)
        yIndex = matrixSize - math.min(int(event.yValue*matrixSize/maxRange), matrixSize)
        matrix.set(counts, xIndex, yIndex, matrix.get(counts, xIndex, yIndex)+1)

    var heatmap = table.new(position.middle_center, matrixSize+1, matrixSize+1, backgroundColor, color.yellow, 1, backgroundColor, 0)
    table.clear(heatmap, 0, 0, matrixSize, matrixSize)
    maxCount = matrix.max(counts)
    totalCount = array.size(events)
    sums = array.new<int>(4,0)
    for [i, columns] in counts
        for [j, count] in columns
            countPercent = int(count*90/maxCount)
            sumIndex = 2*(i < ((matrixSize+1)/2) ? 0 : 1) + (j < ((matrixSize+1)/2)? 0: 1)
            array.set(sums, sumIndex, array.get(sums, sumIndex)+count)
            xRange = 'Positive Displaecment : ' + (reference == 'Percentage'? str.tostring(maxRange*i*100/matrixSize, format.percent) : (str.tostring(maxRange*i/matrixSize, format.mintick) + 'X'))
                                              + ' - '+ ((i==matrixSize)? '' : 
                                             (reference == 'Percentage'? str.tostring(maxRange*(i+1)*100/matrixSize, format.percent) : (str.tostring(maxRange*(i+1)/matrixSize, format.mintick) + 'X')))
            yRange = 'Negative Displacement : ' + (reference == 'Percentage'? str.tostring(maxRange*(matrixSize-j)*100/matrixSize, format.percent) : (str.tostring(maxRange*(matrixSize-j)/matrixSize, format.mintick) + 'X'))
                                              + ' - '+ ((j==matrixSize)? '' : 
                                             (reference == 'Percentage'? str.tostring(maxRange*(matrixSize-j+1)*100/matrixSize, format.percent) : (str.tostring(maxRange*(matrixSize-j+1)/matrixSize, format.mintick) + 'X')))
            tooltip = 'Count '+str.tostring(count)+'/'+str.tostring(totalCount)+'\n'+xRange+'\n'+yRange+'\n('+str.tostring(i)+','+str.tostring(j)+')'
            table.cell(heatmap, i, j, '', width=1, height = 1, text_color=color.yellow, bgcolor = color.new(heatmapColor, countPercent==0? 100 : 90-countPercent), text_size = size.tiny, tooltip = tooltip)

    var positions = array.from(position.top_left, position.bottom_left, position.top_right, position.bottom_right)
    for [i, sum] in sums
        tab = table.new(array.get(positions, i), 1,1, color.teal, color.teal, 1, color.teal, 1)
        table.cell(tab, 0, 0, str.tostring(sum), text_color = color.white, text_size = size.large)

Overview

When the RSI crosses over or under a defined threshold level, the script measures post-trigger price movements across a specified duration, normalized against references like ATR. It then plots a heat map matrix in a separate pane depicting the distribution and concentration of subsequent price paths. Users can customize RSI settings, trigger types and values, impact duration, outlier percentiles, and matrix dimensions.

Details

Published by

regalouisei on GitHub

Code credit

HeWhoMustNotBeNamed, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volatility & bands

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.

Settings

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

SettingTypeDefaultVariable
SourcesourceclosersiSource
rsiLengthint14rsiLength
TriggerstringCrossoverrsiTrigger
rsiTriggerValueint70rsiTriggerValue
Durationint20impactDuration
ReferencestringATRreference
Heat Map Sizeint50matrixSize
Outliers Percentileint95outliersPercentile
Backgroundcolorcolor.rgb(0,0,0,0)backgroundColor
Heatmapcolorcolor.redheatmapColor
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

TTM Squeeze

by Alorse
330 stars

This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of TTM Squeeze

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector
147 stars

This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Signal Strategy 100 Candles of 1H Timeframe

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

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