Indicator · Pine Script v5 · On the chart

CSW Sentiment Line

by g-moe· code credited to goodgains

The CSW Sentiment Line indicator rates RSI, Volume, and RVI from 0 to 100.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code90
Settings11inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 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

90 lines of Pine Script v5 from Tradingview/csw-sentiment-line.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

csw-sentiment-line.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("CSW Sentiment Line", overlay=true, scale=scale.none, max_lines_count=500, max_labels_count=500)

// @keywords: csw-sentiment, sentiment-line, rsi, volume-rsi, volatility-rsi, standard-deviation, sentiment-composite, sentiment-scale, gradient-scale, overbought-oversold, sentiment-labels, rsi-rating, volume-rating, volatility-rating, line-offset, instructions-tooltip, sentiment-average, scale-lines, sentiment-gauge, composite-score

//--INSTRUCTIONS--//
instructions_tooltip = "• The CSW Sentiment Line rates RSI, Volatility, and Volume from 0 to 100. Values closer to 100
 \nmeans it is overbought or a strong reading. Values closer to 0 mean it is oversold or a weak reading. 
 \nThe Sentiment Line is just an add-on tool for your chart for a quick glance to see where RSI, Volatility, and Volume are at for the current chart symbol."

instructions = input.bool(title='Show Instructions', defval=false, inline='1', tooltip = instructions_tooltip)
if barstate.islast and instructions
    var label instruction_label = na
    if not na(instruction_label[1])
        label.delete(instruction_label[1])
    instruction_label := label.new(bar_index + 5, close, instructions_tooltip, xloc = xloc.bar_index , yloc = yloc.price, color = color.black , style = label.style_label_left, textcolor = color.white, size = size.large, textalign = text.align_left) 
//--INSTRUCTIONS--//

use_rsi = input.bool(true, 'RSI', inline='2')
rsi_len = input.int(14, '', inline='2')

use_vol = input.bool(true, "Volume", inline = '3')
vol_len = input.int(14, '', inline = '3')

use_rvi = input.bool(true, 'Volatility', inline = '4')
rvi_len = input.int(14, '', inline = '4')

color_up = input.color(color.new(#27a69b,30), title='Bull Color', inline='1', group='Visual Settings')
color_down = input.color(color.new(#b63632,30), title='Bear Color', inline='1', group='Visual Settings')
label_color = input.color(#ffffff, title = 'Label Color', inline='1', group='Visual Settings')

offset = input.int(75, 'Line Offset', group='Visual Settings', minval = 0, maxval = 500)

n = bar_index
src = close
var names = array.new_string(0)
var values = array.new_float(0)
var scale_lines = array.new_line(0)
dt = math.round(n - n[1])

rsi = ta.rsi(src,rsi_len) / 100
rsi_vol = ta.rsi(ta.sma(volume,20),vol_len) / 100
rvi = ta.rsi(ta.stdev(close, 30),rvi_len) / 100

if barstate.isfirst
    for i = 0 to 99 by 1
        array.push(scale_lines, line.new(na, na, na, na))

if barstate.islast
    if use_rsi
        array.push(values, rsi)
    if use_vol
        array.push(values, rsi_vol)
    if use_rvi
        array.push(values, rvi)
    array.push(values, array.get(values, 0))

    avg = (array.avg(values) - .5) * 2
    avg_css = color.from_gradient(avg, -1.2, 1.2, color_down, color_up)

    
    if use_rsi
        label.delete(label.new(n + offset , (rsi - .5) * 2, "⬅ " + str.tostring(math.round(rsi*100,2)) + " - RSI", xloc.bar_index, color=#00000000, style=label.style_label_left, textcolor=label_color, textalign=text.align_right)[1])
    
    if use_vol
        label.delete(label.new(n + offset , (rsi_vol - .5) * 2, "⬅ " + str.tostring(math.round(rsi_vol*100,2)) + " - Volume", xloc.bar_index, color=#00000000, style=label.style_label_left, textcolor=label_color, textalign=text.align_right)[1])
        
    if use_rvi
        label.delete(label.new(n + offset , (rvi - .5) * 2, "⬅ " + str.tostring(math.round(rvi*100,2)) + " - Volatility", xloc.bar_index, color=#00000000, style=label.style_label_left, textcolor=label_color, textalign=text.align_right)[1])
        
        
    for i = 1 to 99 by 1
        y1 = ((i - 1) / 99 - .5) * 2
        y2 = (i / 99 - .5) * 2

        css = color.from_gradient(i, 1, 100, color_down, color_up)
        scale_line = array.get(scale_lines, i)
        line.set_xloc(scale_line, n + dt * offset + dt , bar_index + dt * offset + dt, xloc=xloc.bar_index)
        line.set_y1(scale_line, y1)
        line.set_y2(scale_line, y2)
        line.set_width(scale_line, 8)
        line.set_color(scale_line, css)

    label.delete(label.new(n + offset , 1.025, '100', xloc.bar_index, yloc.price, color=#00000000, style=label.style_label_center, textcolor=color_up, textalign=text.align_center)[1])
    label.delete(label.new(n + offset , -1.025, '0', xloc.bar_index, yloc.price, color=#00000000, style=label.style_label_center, textcolor=color_down, textalign=text.align_center)[1])
    label.delete(label.new(n + offset , 1.1, '� CSW Sentiment Line', xloc.bar_index, yloc.price, color=#00000000, style=label.style_label_center, textcolor=label_color, textalign=text.align_center)[1])

Overview

CSW Sentiment Line averages these to create a composite sentiment and draws labels on the price chart displaying each rating. Users can enable or disable individual metrics and customize colors and label position.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Oscillators & momentum, Volatility & bands, Volume

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
Show Instructionsboolfalseinstructions
RSIbooltrueuse_rsi
rsi_lenint14rsi_len
Volumebooltrueuse_vol
vol_lenint14vol_len
Volatilitybooltrueuse_rvi
rvi_lenint14rvi_len
Bull Colorcolorcolor.new(#27a69b,30)color_up
Bear Colorcolorcolor.new(#b63632,30)color_down
Label Colorcolor#fffffflabel_color
Line Offsetint75offset
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

The Momentum Setup is a multi-indicator visual tool designed for trend and momentum analysis directly on the price chart. It combines Relative Strength Index (RSI), Money Flow Index (MFI), Commodity Channel Index (CCI), Supertrend, and a 250-bar percentage cha

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

LiqSpikeBounceLong Feb2026

by agutinbaigo28
147 stars

LiqSpikeBounceLong Feb2026 is an indicator designed to identify long bounce entries following high-volume liquidation cascades in bearish market contexts. It checks if price is below an exponential moving average, then detects large single-bar drops exceeding

Indicator v5 Volatility & bandsVolume
Updated 6 weeks ago · MIT GitHub repository of LiqSpikeBounceLong Feb2026

Aroon-based Strategy

by capissimo
114 stars

This indicator overlay generates buy and sell signals based on Aroon extreme levels combined with optional volume or volatility filters. It calculates Aroon Up and Aroon Down lines using localized high and low lookbacks, generating trade entries when Aroon rea

Indicator v4 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Aroon-based Strategy
92 stars

This indicator plots a volume-weighted average price of the typical price on the chart and colors that line by ADX strength. It draws a standard-deviation envelope around VWAP and tints the fill green when plus DI leads and red when minus DI leads. Triangle ma

Indicator v5 TrendOscillators & momentum
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev VWAP x ADX Explosion

RSI Div at dVWAP StDev

by cryptorife
75 stars

This indicator marks RSI divergences only when price trades beyond daily VWAP standard-deviation bands. It compares recent RSI extremes with price highs and lows over a lookback window, and it treats a divergence as valid only while RSI stays beyond overbought

Indicator v4 DivergenceOscillators & momentum Repaints
Updated 3 years ago · GPL-3.0 GitHub repository of RSI Div at dVWAP StDev

This indicator builds a momentum score from the rate of change of close, using a lookback that expands or contracts with ATR relative to its standard deviation. It divides that rate of change by price standard deviation, scales the result, and weights it by vo

Indicator v5 Oscillators & momentumVolatility & bands Repaints
Updated 7 weeks ago · None stated GitHub repository of Adaptive Volatility-Adjusted Momentum Score

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