Indicator · Pine Script v4 · On the chart

Chart Background

by be-thomas

This indicator colors the chart background using a full-screen single-cell table based on the 20-period Relative Strength Index (RSI).

View on GitHub

GitHub stars65on the repository
Pine versionv4older, still runs
Lines of code13
Settings2inputs
LicenceGPL-3.0
Last update4 days ago24 Oct 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

13 lines of Pine Script v4 from examples/v4/tradingview-docs/v4-essential-tables-02.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

v4-essential-tables-02.pine
//@version=4
study("Chart background", "", true)
i_c_bull = input(color.new(color.green, 95), "Bull", inline = "1")
i_c_bear = input(color.new(color.red, 95), "Bear", inline = "1")
// ————— Function colors chart bg on RSI bull/bear state.
f_colorChartBg(_c_bull, _c_bear) =>
    var table _chartBg = table.new(position.middle_center, 1, 1)
    float _r = rsi(close, 20)
    color _c_bg = _r > 50 ? _c_bull : _r < 50 ? _c_bear : na
    if barstate.islast
        table.cell(_chartBg, 0, 0, width = 100, height = 100, bgcolor = _c_bg)

f_colorChartBg(i_c_bull, i_c_bear)

Overview

When the RSI is above 50, the table applies a bullish background color, and when below 50, a bearish color. The background updates on the current active bar using Pine Script table drawing functions. Users can customize the bull and bear colors and transparency settings.

Details

Published by

be-thomas on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Oscillators & momentum, Screeners & dashboards

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

algorithmic-tradingbacktestingcompilerfintechjavascriptpinescripttechnical-analysistradingview

Settings

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

SettingTypeDefaultVariable
Bullcolorcolor.new(color.green, 95)i_c_bull
Bearcolorcolor.new(color.red, 95)i_c_bear
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

This overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi

Indicator v5 Oscillators & momentumVolume
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup
330 stars

This multi-symbol indicator evaluates a combined trading condition across up to 40 user-defined symbols. It processes MACD bullish crossovers, RSI thresholds, Bollinger Band boundaries, and DMI/ADX trend filters using security calls. When buy or sell criteria

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Multi MACD + BB + RSI [Alorse]
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

8zz反指標v2

by hansai-art
121 stars

The 8zz Contrarian Indicator plots reverse sentiment trading signals directly on the price chart based on tracked retail post activity. It generates bullish signals during retail panic and bearish signals during market euphoria. The indicator features adjustab

Indicator v6 Moving averagesOscillators & momentum
Updated 3 months ago · None stated GitHub repository of 8zz反指標v2
53 stars

This indicator analyzes historical candle direction and price range over a configurable lookback window to gauge market trend. It categorizes trend direction using candle count, price range sum, or both. Signals are filtered using a Simple Moving Average to en

Indicator v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of Candle Counter + MA + RSI + Mode

This indicator displays a customizable dashboard table on the price chart. It combines Market Action Pulse state, McClellan breadth z-score, VIX Mood Ring status, and Risk Assessment Model hazard score. Users select symbols such as NASDAQ:QQQE or VIX, toggle c

Indicator v6 Screeners & dashboardsOscillators & momentum Repaints

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