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 อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน