Indicator · Pine Script v5 · On the chart

RMI Trend Sniper

by theonetrade· code credited to TZack88

Calculates a momentum indicator by averaging the Relative Strength Index (RSI) and Money Flow Index (MFI).

View on GitHub

GitHub stars34on the repository
Pine versionv5runs as is
Lines of code101
Settings6inputs
LicenceMIT
Last update2 weeks ago8 Nov 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

101 lines of Pine Script v5 from assets/indicator/bit-exact/rmi_trend_sniper_rtD9lc5D.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

rmi_trend_sniper_rtD9lc5D.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TZack88

//@version=5
indicator('RMI Trend Sniper', overlay=true,max_labels_count = 500)

// ** ---> Inputs ------------- {
var bool positive                   = false
var bool negative                   = false
string RSI_group                    = "RMI Settings"
string mom_group                    = "Range Vales"
string visual                       = "Visuals" 
int Length                          = input(14,"RMI Length ",inline = "RMI",group = RSI_group)
int pmom                            = input(66," Positive above",inline = "rsi1",group =RSI_group )
int nmom                            = input(30,"Negative below",inline = "rsi1",group =RSI_group )
bool filleshow                      = input(true,"Show Range MA ",inline = "002",group =visual )
color bull                          = input(#00bcd4,"",inline = "002",group =visual )
color bear                          = input(#ff5252,"",inline = "002",group =visual )
float BarRange                      = high - low

up = ta.rma(math.max(ta.change(close), 0), Length)
down = ta.rma(-math.min(ta.change(close), 0), Length)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
mf = ta.mfi(hlc3, Length)
rsi_mfi = math.avg(rsi,mf)



//------------------- }

bool p_mom                          = rsi_mfi[1] < pmom and
      rsi_mfi > pmom and
      rsi_mfi > nmom and
       ta.change(ta.ema(close,5)) > 0

bool n_mom                          = rsi_mfi < nmom and
      ta.change(ta.ema(close,5)) < 0
// //  ---> Momentums ------------- {

if p_mom
    positive:= true
    negative:= false

if n_mom
    positive:= false
    negative:= true     



//
method _Band(int len)=>
    math.min (ta.atr (len) * 0.3, close * (0.3/100)) [20] /2 * 8 


Band = _Band(30) 


method rangeMA(float Range,Prd)=>
    weight = Range / math.sum(Range, Prd)
    sum = math.sum(close * weight, Prd)
    tw= math.sum(weight, Prd)
    sum / tw


// Calculate the RWMA
rwma = rangeMA(BarRange,20)

// Plotting the RWMA.
colour = positive ? bull : bear
RWMA = positive ? rwma - Band : negative ? rwma + Band : na
alpha = color.new(color.black, 100)

center = plot(filleshow ? RWMA : na, "RRTH", colour, editable = true)
plot(filleshow ? RWMA : na, "RRTH", color.new(colour, 70), 2, editable = true)
plot(filleshow ? RWMA : na, "RRTH", color.new(colour, 80), 3, editable = true)
plot(filleshow ? RWMA : na, "RRTH", color.new(colour, 90), 4, editable = true)


plot(close, "CLOSE", colour, editable = false,display = display.pane)

max = RWMA + Band
min = RWMA - Band

top = plot(filleshow ? max: na, "RRTH", alpha)
bottom = plot(filleshow ? min: na, "RRTH", alpha)
fill(top, center, top_value =  max, bottom_value = RWMA, bottom_color = color.new(colour, 75), top_color = alpha, editable = true)
fill(center, bottom, top_value =  RWMA, bottom_value = min, bottom_color = alpha, top_color = color.new(colour, 75), editable = true)
Barcol = positive ? color.green:color.red

if negative and not negative[1]
    label.new(bar_index,max+(Band/2),"",color = color.red,size=size.small)
if positive and not positive[1]
    label.new(bar_index,min-(Band/2),"",color = color.green,size=size.small,style= label.style_label_up)

plotcandle(open, high, low, close,color = Barcol,wickcolor = Barcol,bordercolor  = Barcol)
barcolor(color = Barcol)


// SPOT Trading Alerts
alertcondition(positive and not positive[1],"BUY")
alertcondition(negative and not negative[1],"SELL")

Overview

RMI Trend Sniper determines bullish and bearish trend states based on threshold crossings of this combined oscillator alongside a 5-period exponential moving average. The script plots a custom range-weighted moving average with filled dynamic ATR bands directly on the price chart, colors price candles according to the active trend, and displays directional label markers when trend shifts occur.

Details

Published by

theonetrade on GitHub

Code credit

TZack88, as written in the script's header

Draws

On the price chart

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-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
RMI Length int14Length
Positive aboveint66pmom
Negative belowint30nmom
Show Range MA booltruefilleshow
bullcolor#00bcd4bull
bearcolor#ff5252bear
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

947 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 5 weeks ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average
228 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 4 months ago · None stated GitHub repository of TradersPost Trading Checklist

Daily Trend Filter

by agutinbaigo28
147 stars

Calculates market regime conditions by combining RSI, MACD, and ADX/DMI indicators. It evaluates whether the market is in a strong bullish, strong bearish, neutral, or non-trending regime. The script plots a colored line overlaying the close price to reflect t

Indicator v5 TrendOscillators & momentum
Updated 2 months ago · MIT GitHub repository of Daily Trend Filter

AAPP

by capissimo
114 stars

This indicator plots an adaptive moving average or scaled RSI divergence line directly on the price chart. It calculates dual RSI series to measure momentum divergence, scales the values to the chart's price range, and constructs an adaptive average filtered b

Indicator v4 Moving averagesTrend
Updated 2 years ago · None stated GitHub repository of AAPP

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 4 weeks ago · MIT GitHub repository of Signal Strategy 15m
57 stars

Double Screened Decision is a multi-timeframe trend and momentum indicator overlaid directly on the price chart. It dynamically selects a higher timeframe based on the active chart resolution to evaluate higher-timeframe MACD, Bollinger Bands, RSI, and Stochas

Indicator v5 TrendMoving averages Repaints
Updated 4 months ago · None stated GitHub repository of Double Screened Decision

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers