OPEN-SOURCE SCRIPT
Trend filter v2 [Jamallo]

Intro
Trend Filter v2 is the evolution of the original Trend Filter, replacing the Kalman Filter baseline and WMA-scaled bands with a kernel-smoothed Vervoort Stop and percentile-ranked deviation bands. It also draws conceptual lineage from the ENW Kernel Bands indicator, inheriting the composite kernel and dual-Vervoort architecture — but rethinking both what the kernel is applied to and how bands are sized.
Breakdown
A Line — Vervoort Stop
A classic trailing stop built on Heikin Ashi smoothed price and ATR. Color-coded by a trend state machine: bullish when price is above a rising A line, bearish when below a falling one, neutral otherwise. This is the signal line.
K Line — Kernel-Smoothed Vervoort Stop
Unlike ENW where the composite kernel is applied directly to raw price, v2 feeds a second Vervoort Stop output into the kernel. This means the K line is trend-filtered before smoothing even begins, producing a slower, more structurally stable baseline that is less reactive to noise.
Signal Line — Independent Vervoort Stop
A third Vervoort Stop with its own ATR settings, used as an additional trend reference.
Percentile Bands
The key structural departure from both v1 and ENW. Instead of scaling bands by smoothed volatility × a fixed multiplier, v2 ranks upside and downside deviations from K separately using `percentile_nearest_rank` over a configurable lookback.
END
v2 replaces the Kalman with a kernel-smoothed Vervoort Stop and swaps fixed-deviation bands for percentile-ranked asymmetric bands — a fundamental rethink of both the baseline and the band sizing at every level.
Trend Filter v2 is the evolution of the original Trend Filter, replacing the Kalman Filter baseline and WMA-scaled bands with a kernel-smoothed Vervoort Stop and percentile-ranked deviation bands. It also draws conceptual lineage from the ENW Kernel Bands indicator, inheriting the composite kernel and dual-Vervoort architecture — but rethinking both what the kernel is applied to and how bands are sized.
Breakdown
A Line — Vervoort Stop
A classic trailing stop built on Heikin Ashi smoothed price and ATR. Color-coded by a trend state machine: bullish when price is above a rising A line, bearish when below a falling one, neutral otherwise. This is the signal line.
K Line — Kernel-Smoothed Vervoort Stop
Unlike ENW where the composite kernel is applied directly to raw price, v2 feeds a second Vervoort Stop output into the kernel. This means the K line is trend-filtered before smoothing even begins, producing a slower, more structurally stable baseline that is less reactive to noise.
Signal Line — Independent Vervoort Stop
A third Vervoort Stop with its own ATR settings, used as an additional trend reference.
Percentile Bands
The key structural departure from both v1 and ENW. Instead of scaling bands by smoothed volatility × a fixed multiplier, v2 ranks upside and downside deviations from K separately using `percentile_nearest_rank` over a configurable lookback.
END
v2 replaces the Kalman with a kernel-smoothed Vervoort Stop and swaps fixed-deviation bands for percentile-ranked asymmetric bands — a fundamental rethink of both the baseline and the band sizing at every level.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Join the Growing (Econophysics Trading) Community! ⚛️
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Join the Growing (Econophysics Trading) Community! ⚛️
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.