OPEN-SOURCE SCRIPT
PolyFilter [BackQuant]

PolyFilter [BackQuant]
A flexible, low-lag trend filter with three smoothing engines—optimized for clean bias, fewer whipsaws, and clear alerting.
What it does
PolyFilter draws a single “intelligent” baseline that adapts to price while suppressing noise. You choose the engine—Fractional MA, Ehlers 2-Pole Super Smoother, or a Multi-Kernel blend. The line can color itself by slope (trend) or by position vs price (above/below), and you get four ready-made alerts for flips and crosses.
What it plots
How the three engines differ
Reading the colors
Inputs you’ll actually use
Calculation Settings
UI & Plotting
Signals & Alerts
Quick starts (suggested presets)
How to use it in practice
Tuning tips
Summary
PolyFilter gives you a single, trustworthy baseline that you can read at a glance—either as a pure trend line (slope coloring) or as a dynamic “above/below fair value” reference. Pick the engine that matches your market’s personality, set a sensible length, and let the color and alerts guide bias, entries on pullbacks, and risk on reversals.
A flexible, low-lag trend filter with three smoothing engines—optimized for clean bias, fewer whipsaws, and clear alerting.
What it does
PolyFilter draws a single “intelligent” baseline that adapts to price while suppressing noise. You choose the engine—Fractional MA, Ehlers 2-Pole Super Smoother, or a Multi-Kernel blend. The line can color itself by slope (trend) or by position vs price (above/below), and you get four ready-made alerts for flips and crosses.
What it plots
- PolyFilter line — your smoothed trend baseline (width set by “Line Width”).
- Optional candle & background coloring — choose: color by trend slope or by whether price is above/below the filter.
- Signal markers — Arrows with L/S when the slope flips or when price crosses the line (if you enable shapes/alerts).
How the three engines differ
- Fractional MA (experimental) — A power-law weighting of past bars (heavier focus on the most recent samples without throwing away history). The Adaptation Speed acts like the “fraction” exponent (default 0.618). Lower values lean more on recent bars; higher values spread weight further back.
- Ehlers 2-Pole Super Smoother — Classic low-lag IIR smoother that aggressively reduces high-frequency noise while preserving turns. Great default when you want a steady, responsive baseline with minimal parameter fuss.
- Multi-Kernel — A 70/30 blend of a Gaussian window and an exponential kernel. The Gaussian contributes smooth structure; the exponential adds a hint of responsiveness. Useful for assets that oscillate but still trend.
Reading the colors
- Trend mode (default) — Line & candles turn green while the filter is rising (signal > signal[1]) and red while it’s falling.
- Above/Below mode — Line & candles reflect price’s position relative to the filter: green when price > filter, red when price < filter. This is handy if you treat the filter like a dynamic “fair value” or bias line.
Inputs you’ll actually use
Calculation Settings
- Price Source — Default HLC/3. Switch to Close for stricter trend, or HLC3/HL2 to soften single-print spikes.
- Filter Length — Window/period for all engines. Shorter = snappier turns; longer = smoother line.
- Adaptation Speed — Only affects Fractional MA. Lower it for faster, more local weighting; raise it for smoother, more global weighting.
- Filter Type — Pick one of: Fractional MA, Ehlers 2-Pole, Multi-Kernel.
UI & Plotting
- Color based off… — Choose Trend (slope) or > or < Close (position vs price).
- Long/Short Colors — Customize bull/bear hues to your theme.
- Show Filter Line / Paint candles / Color background — Visual toggles for the line, bars, and backdrop.
- Line Width — Make the filter stand out (2–3 works well on most charts).
Signals & Alerts
- PolyFilter Trend Up — Slope flips upward (the filter crosses above its prior value). Good for early continuation entries or stop-tightening on shorts.
- PolyFilter Trend Down — Slope flips downward. Often used to scale out longs or rotate bias.
- PolyFilter Above Price — The filter line crosses up through price (filter > price). This can confirm that mean has “caught up” after a pullback.
- PolyFilter Below Price — The filter line crosses down through price (filter < price). Useful to confirm momentum loss on bounces.
Quick starts (suggested presets)
- Intraday (5–15m, crypto or indices) — Ehlers 2-Pole, Length 55–80. Trend coloring ON, candle paint ON. Look for pullbacks to a rising filter; avoid fading a falling one.
- Swing (1H–4H) — Multi-Kernel, Length 80–120. Background color OFF (cleaner), candle paint ON. Add a higher-TF confirmation (e.g., 4H filter rising when you trade 1H).
- Range-prone FX — Fractional MA, Length 70–100, Adaptation ~0.55–0.70. Consider Above/Below mode to trade mean reversion to the line with a strict risk cap.
How to use it in practice
- Bias line — Trade in the direction of the filter slope; stand aside when it flattens and color chops back and forth.
- Dynamic support/resistance — Treat the line as a moving value area. In trends, entries often appear on shallow tags of the line with structure confluence.
- Regime switch — When the filter flips and holds color for several bars, tighten stops on the opposing side and look for first pullback in the new color.
- Stacking filters — Many users run PolyFilter on the active chart and a slower instance (longer length) on a higher timeframe as a “macro bias” guardrail.
Tuning tips
- If you see too many flips, lengthen the filter or switch to Multi-Kernel.
- If turns feel late, shorten the filter or try Ehlers 2-Pole for lower lag.
- On thin or very noisy symbols, prefer HLC3 as the source and longer lengths.
- Performance note: very large lengths increase computation time for the Multi-Kernel and Fractional engines. Start moderate and scale up only if needed.
Summary
PolyFilter gives you a single, trustworthy baseline that you can read at a glance—either as a pure trend line (slope coloring) or as a dynamic “above/below fair value” reference. Pick the engine that matches your market’s personality, set a sensible length, and let the color and alerts guide bias, entries on pullbacks, and risk on reversals.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Check out whop.com/signals-suite for Access to Invite Only Scripts!
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menjadikannya sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Hormat untuk penulisnya! Meskipun anda dapat menggunakannya secara gratis, ingatlah bahwa penerbitan ulang kode tersebut tunduk pada Tata Tertib kami.
Check out whop.com/signals-suite for Access to Invite Only Scripts!
Pernyataan Penyangkalan
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.