Indicator · Pine Script v5 · Own pane

Combined Indicator RSI, Vortex

by mayur-ml

This indicator plots the Vortex Indicator and the Relative Strength Index together in a separate pane.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code113
Settings6inputs
LicenceMIT
Last update2 years ago31 May 2024

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

113 lines of Pine Script v5 from RSI and VORTEX.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

RSI and VORTEX.pine
//@version=5
indicator(title = "Combined Indicator RSI, Vortex", shorttitle="Combined RSI, Vortex", format=format.price, precision=4, timeframe="", timeframe_gaps=true)
period_ = input.int(14, title="Length", minval=2)
VMP = math.sum( math.abs( high - low[1]), period_ )
VMM = math.sum( math.abs( low - high[1]), period_ )
STR = math.sum( ta.atr(1), period_ )
VIP = VMP / STR
VIM = VMM / STR
plot(VIP, title="VI +", color=#2962FF)
plot(VIM, title="VI -", color=#E91E63)

// Relative Strength Index (RSI) Indicator
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "EMA"], group="MA Settings", display = display.data_window)
maLengthInput = input.int(14, title="MA Length", group="MA Settings", display = display.data_window)
showDivergence = input.bool(false, title="Show Divergence", group="RSI Settings", display = display.data_window)

up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = maTypeInput == "SMA" ? ta.sma(rsi, maLengthInput) : ta.ema(rsi, maLengthInput)
rsiPlot = plot(rsi, "RSI", color=color.blue)
plot(rsiMA, "RSI-based MA", color=color.yellow)
rsiUpperBand = hline(70, "RSI Upper Band", color=color.gray)
midline = hline(50, "RSI Middle Band", color=color.gray)
rsiLowerBand = hline(30, "RSI Lower Band", color=color.gray)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")

// Divergence
lookbackRight = 5
lookbackLeft = 5
rangeUpper = 60
rangeLower = 5
bearColor = color.red
bullColor = color.green
textColor = color.white
noneColor = color.new(color.white, 100)

plFound = na(ta.pivotlow(rsi, lookbackLeft, lookbackRight)) ? false : true
phFound = na(ta.pivothigh(rsi, lookbackLeft, lookbackRight)) ? false : true

_inRange(cond) =>
    bars = ta.barssince(cond == true)
    rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish
// rsi: Higher Low

rsiHL = rsi[lookbackRight] > ta.valuewhen(plFound, rsi[lookbackRight], 1) and _inRange(plFound[1])

// Price: Lower Low

priceLL = low[lookbackRight] < ta.valuewhen(plFound, low[lookbackRight], 1)
bullCondAlert = priceLL and rsiHL and plFound
bullCond = showDivergence and bullCondAlert

plot(
     plFound ? rsi[lookbackRight] : na,
     offset=-lookbackRight,
     title="Regular Bullish",
     linewidth=2,
     color=(bullCond ? bullColor : noneColor),
     display = display.pane
     )

plotshape(
     bullCond ? rsi[lookbackRight] : na,
     offset=-lookbackRight,
     title="Regular Bullish Label",
     text=" Bull ",
     style=shape.labelup,
     location=location.absolute,
     color=bullColor,
     textcolor=textColor
     )

//------------------------------------------------------------------------------
// Regular Bearish
// rsi: Lower High

rsiLH = rsi[lookbackRight] < ta.valuewhen(phFound, rsi[lookbackRight], 1) and _inRange(phFound[1])

// Price: Higher High

priceHH = high[lookbackRight] > ta.valuewhen(phFound, high[lookbackRight], 1)

bearCondAlert = priceHH and rsiLH and phFound
bearCond = showDivergence and bearCondAlert

plot(
     phFound ? rsi[lookbackRight] : na,
     offset=-lookbackRight,
     title="Regular Bearish",
     linewidth=2,
     color=(bearCond ? bearColor : noneColor),
     display = display.pane
     )

plotshape(
     bearCond ? rsi[lookbackRight] : na,
     offset=-lookbackRight,
     title="Regular Bearish Label",
     text=" Bear ",
     style=shape.labeldown,
     location=location.absolute,
     color=bearColor,
     textcolor=textColor
     )

alertcondition(bullCondAlert, title='Regular Bullish Divergence', message="Found a new Regular Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar.")
alertcondition(bearCondAlert, title='Regular Bearish Divergence', message='Found a new Regular Bearish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar.')

Overview

Combined Indicator RSI, Vortex calculates VI+ and VI- from absolute high-low ranges over a shared length, then draws RSI from a chosen source with a selectable SMA or EMA of the RSI. Horizontal lines mark the 70, 50 and 30 levels and fill the area between the outer bands. When Show Divergence is enabled, it marks regular bullish and bearish RSI-price divergences after five-bar pivot confirmation. Divergence display is off by default, and the script does not generate trades or stops.

Details

Published by

mayur-ml on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Trend, Divergence

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
Lengthint14period_
RSI Lengthint14rsiLengthInput
SourcesourceclosersiSourceInput
MA TypestringSMAmaTypeInput
MA Lengthint14maLengthInput
Show DivergenceboolfalseshowDivergence
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 indicator scores whether a counter-move against the dominant structure is maturing and whether price has started turning back. It plots a composite score in a separate pane from weighted context, correction maturity, and exhaustion, scaled by trigger and a

Indicator v6 TrendOscillators & momentum
Updated yesterday · MIT GitHub repository of Directional Probability Engine v2 [WavesUnchained]

MTF MA bands + RSI

by InNoobWeTrust
4 stars

This indicator plots multi-timeframe moving average bands alongside a Relative Strength Index in a separate pane. It calculates up to four configurable moving averages across different timeframes, offering selectable types such as SMA, EMA, and WMA with colore

Indicator v6 Oscillators & momentumMoving averages
Updated today · None stated GitHub repository of MTF MA bands + RSI

QQE + AK Trend + EFI

by realanthonyc
2 stars

This indicator computes and plots a QQE histogram using RSI of the chosen source smoothed with Wilder's ATR method, alongside an AK Trend line derived from fast EMAs with dynamic scale factors adjusted by timeframe. It also calculates Elder Force Index with ad

Indicator v6 TrendOscillators & momentum
Updated 10 months ago · MPL-2.0 GitHub repository of QQE + AK Trend + EFI

Kernal Cipher 2

by kdricha0602
1 stars

Kernal Cipher 2 is a lower-pane signal panel. It scores trend with fast, slow, and long EMAs, slope, Supertrend, and ADX, then blends WaveTrend, StochRSI, pivot divergence, volume, relative strength versus equity benchmarks, and beta. Green and red diamonds ma

Indicator v6 TrendOscillators & momentum
Updated 5 weeks ago · MIT GitHub repository of Kernal Cipher 2
1 stars

This indicator calculates a multi-factor trend and momentum score by combining triple exponential moving averages, Supertrend, ADX regime filters, WaveTrend, and StochRSI oscillators. It identifies regular divergences across pivot points, checks multi-timefram

Indicator v6 TrendOscillators & momentum
Updated 5 weeks ago · MIT GitHub repository of Momentum Confluence Suite [MCS] v2
5 stars

This indicator overlays multiple technical analysis tools onto the price chart to evaluate trend direction and trade setups. It computes an exponential moving average, a smoothed Stochastic RSI, a custom Williams Alligator using smoothed moving averages with o

Indicator v4 TrendMoving averages
Updated 3 years ago · Apache-2.0 GitHub repository of 200 EMA + Alligator + Stochastic

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