Indicator · Pine Script v5 · Own pane

Relative Strength Index And Money Flow Index

by leocairos

This indicator plots the Relative Strength Index and Money Flow Index together in a separate pane.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code58
Settings8inputs
LicenceMIT
Last update2 years ago11 Mar 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

58 lines of Pine Script v5 from anotherFiles/old/tradingview/tradview.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

tradview.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @author leocairos

//@version=5
indicator(title="Relative Strength Index And Money Flow Index", shorttitle="RSI x MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)

// RSI
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
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))
rsiUpperBand = hline(80, "RSI Upper Band", color=#787B86)
rsiLowerBand = hline(20, "RSI Lower Band", color=#787B86)
plot(rsi, "RSI", color=#7E57C2)


//MFI
length = input.int(title="Length", defval=14, minval=1, maxval=2000)
src = hlc3
mf = ta.mfi(src, length)
plot(mf, "MF", color=#E1E1E1)
overbought=hline(80, title="Overbought", color=#787B86)
hline(50, "Middle Band", color=color.new(#787B86, 50))
oversold=hline(20, title="Oversold", color=#787B86)

HighlightBreaches=input(true, title="Highlight Oversold/Overbought?", type=bool)
upper=80, low=20
b_color = (mf > upper) ? color(#FF0D0D,70) : (mf < lower) ? color(#13D100,60) : na
bgcolor(HighlightBreaches ? b_color : na)



// @version 2
// @author seiglerj
// MFI indicator based on LazyBear's MFI/RSI indicator
// 
study(title = "MFI [seiglerj]", shorttitle="MFI", precision=0)
source = hlc3
length = input(14, minval=1), lower = input(20, minval=0, maxval=50, type=integer), upper = input(80, minval=50, maxval=100, type=integer)
// DrawMFI_f=input(true, title="Draw MFI?", type=bool)
HighlightBreaches=input(true, title="Highlight Oversold/Overbought?", type=bool)

// MFI
upper_s = sum(volume * (change(source) <= 0 ? 0 : source), length)
lower_s = sum(volume * (change(source) >= 0 ? 0 : source), length)
mf = rsi(upper_s, lower_s)
mfp = plot(mf, color=color(gray,0), linewidth=1)
top = hline(upper, color=color(gray,100), linewidth=1, editable=false)
bottom = hline(lower, color=color(gray,100), linewidth=1, editable=false)
hline(0, color=color(black,100), editable=false)
hline(100, color=color(black,100), editable=false)

// Breaches
b_color = (mf > upper) ? color(#FF0D0D,70) : (mf < lower) ? color(#13D100,60) : na
bgcolor(HighlightBreaches ? b_color : na)

fill(top, bottom, color=gray, transp=75)

Overview

Relative Strength Index And Money Flow Index calculates both oscillators using user-defined lookback lengths and price source inputs. Horizontal reference lines mark standard levels at twenty, fifty, and eighty. The script highlights overbought and oversold conditions by changing the background color when values cross threshold boundaries. Main settings adjust oscillator periods and toggle threshold background highlights. The file contains appended legacy code from another indicator and does not generate trade signals or automated alerts.

Details

Published by

leocairos on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volume

Markets

Crypto

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
RSI Lengthint14rsiLengthInput
SourcesourceclosersiSourceInput
Lengthint14length
Highlight Oversold/Overbought?booltrueHighlightBreaches
lengthint14length
lowerint20lower
upperint80upper
Highlight Oversold/Overbought?booltrueHighlightBreaches
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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero. It compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for bo

Indicator v6 VolumeOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Bill Williams Market Facilitation Index

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 4 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

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