Indicator · Pine Script v6 · On the chart

Decycler Momentum Regime Filter ~ CharonQuant

by eddiebelaval· code credited to CharonQuant

This indicator overlays a trend and momentum regime filter directly on the price chart.

View on GitHub

GitHub stars7on the repository
Pine versionv6current
Lines of code111
Settings5inputs
LicenceNone statedfile: MPL-2.0
Last update3 months ago24 Jul 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

111 lines of Pine Script v6 from pinescript/momentum/decycler-momentum-regime-filter-charonquant.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

decycler-momentum-regime-filter-charonquant.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CharonQuant

//@version=6
// ______________________
//  (CharonQuant;:.:. .. )
//  T""""""""""""""""""""T
//  |.;....,..........;..|
//  |;;:: .  .    .      |
//  l;;;:. :   .     ..  ;
//  `;;:::.: .    .     .'
//   l;;:. ..  .     .: ;
//   `;;::.. .    .  ; .'
//    l;;:: .  .    /  ;
//     \;;:. .   .,'  /
//      `\;:.. ..'  .'
//        `\;:.. ..'
//          \;:. /
//           l; f
//           `;f'
//            ||
//            ;l.
//           ;: l
//          / ;  \
//        ,/  :   `.
//      ./' . :     `.
//     /' ,'  :       \
//    f  /  . :        i
//   ,' ;  .  :        `.
//   f ;  .   :      .  i
//  .'    :   :       . `.
//  f ,  .    ;       :  i
//  |    :  ,/`.       : |
//  |    ;,/;:. `.     . |
//  |___,/;;:. . .`._____|
// (!;:.:. .  CharonQuant)
//  """"""""""""""""""""""`
indicator("Decycler Momentum Regime Filter ~ CharonQuant","DMRF ~ CharonQuant",overlay = true)

// ── Imports ────────────────────────────────────────────────────────────────
import TradingView/ta/7 as ta

// ── Groups ───────────────────────────────────────────────
group_decycler = "Decycler Core"
group_pmo      = "PMO Momentum Filter"

// ── Inputs ───────────────────────────────────────────────
highpassLength = input.int(8, "Highpass Period", minval=1,group=group_decycler,tooltip="Controls the Decycler smoothing strength.\nHigher values = smoother trend filter, fewer flips.\nLower values = faster reaction, more noise.")
src            = input.source(close, "Source", group=group_decycler, tooltip="Price source used for Decycler and PMO calculations.")
firstLength    = input.int(23, "PMO 1st Smoothing Length", minval=1,group=group_pmo,tooltip="First EMA smoothing stage of the PMO.\nHigher values reduce noise but slow momentum response.")
secondLength   = input.int(17, "PMO 2nd Smoothing Length", minval=1,group=group_pmo,tooltip="Second EMA smoothing stage of the PMO.\nHelps confirm sustained momentum shifts.")
signalLength   = input.int(10, "PMO Signal Length", minval=1,group=group_pmo,tooltip="Signal line length used for momentum confirmation.\nShorter = faster signals.\nLonger = more stable confirmation.")

// ── Ehlers Highpass Filter (Decycler Core) ───────────────────────────────────────────────
PI = 2 * math.asin(1)
alphaArg = 2 * PI / (highpassLength * math.sqrt(2))
alpha = 0.0
alpha := math.cos(alphaArg) != 0 ?
     (math.cos(alphaArg) + math.sin(alphaArg) - 1) / math.cos(alphaArg) :
     nz(alpha[1])
hp = 0.0
hp := math.pow(1 - (alpha / 2), 2) * (src - 2 * nz(src[1]) + nz(src[2])) +
     2 * (1 - alpha) * nz(hp[1]) -
     math.pow(1 - alpha, 2) * nz(hp[2])
decycler = src - hp

// ── PMO Calculation (Momentum Filter) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
roc1 = ta.roc(src, 1)
pmo =
     ta.ema(
         10 * ta.ema(nz(roc1), firstLength),
         secondLength
     )
signal = ta.ema(pmo, signalLength)

// ── Signals ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
decyclerUp   = decycler > decycler[1]
decyclerDown = decycler < decycler[1]

pmoBull = (pmo > signal) and (pmo > 0)
pmoBear = (pmo < signal) and (pmo < 0)

longSignal  = decyclerUp   and pmoBull
shortSignal = decyclerDown and pmoBear

var int CharonQuant = 0

if longSignal and not shortSignal
    CharonQuant := 1
if shortSignal
    CharonQuant := -1

// ── Visualization ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
color BULL    = #D4A017
color BEAR    = #6B2A3A
color NEUTRAL = color.gray
trendColor =
     CharonQuant == 1  ? BULL :
     CharonQuant == -1 ? BEAR :
     NEUTRAL
plot(decycler, title="Decycler", linewidth=3, color=trendColor)
barcolor(CharonQuant == 1  ? color.new(BULL, 0) :
         CharonQuant == -1 ? color.new(BEAR, 0) :
         color.new(NEUTRAL, 0))
bgcolor(CharonQuant == 1  ? color.new(BULL, 92) :
       CharonQuant == -1 ? color.new(BEAR, 92) :
       color.new(NEUTRAL, 95))

// ── Alerts ────────────────────────────────────────────
alertcondition(longSignal, title="DMRF Long", message="DMRF Long {{exchange}}:{{ticker}}")
alertcondition(shortSignal, title="DMRF Short", message="DMRF Short {{exchange}}:{{ticker}}")

Overview

Decycler Momentum Regime Filter ~ CharonQuant calculates an Ehlers Highpass Filter to isolate a low-frequency decycler trend line from price data. Additionally, it integrates a DecisionPoint Price Momentum Oscillator computed via double exponential moving average smoothing on one-period rate of change. Configurable parameters allow users to adjust the highpass decycler period, price source, PMO smoothing lengths, and signal line duration.

Details

Published by

eddiebelaval on GitHub

Code credit

CharonQuant, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Trend, Oscillators & momentum

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
Highpass Periodint8highpassLength
Sourcesourceclosesrc
PMO 1st Smoothing Lengthint23firstLength
PMO 2nd Smoothing Lengthint17secondLength
PMO Signal Lengthint10signalLength
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

948 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 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average

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
257 stars

This indicator uses a Lorentzian distance k-nearest neighbors classification algorithm to predict market direction based on up to five technical features, such as RSI, WaveTrend, CCI, and ADX. It compares current feature values against historical bar patterns

Indicator v5 AI / machine learningOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of Donald - Machine Learning Options
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

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 6 weeks 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 1 year ago · None stated GitHub repository of AAPP

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