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.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Join the Growing (Econophysics Trading) Community! ⚛️
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Join the Growing (Econophysics Trading) Community! ⚛️
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
discord.com/invite/qb4RKFdwYJ
Trade the physics of price.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.