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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。