PolyFilter [BackQuant]PolyFilter
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 ) 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.
Volatility-filter
Theil-Sen Line Filter [BackQuant]Theil-Sen Line Filter
A robust, median-slope baseline that tracks price while resisting outliers. Designed for the chart pane as a clean, adaptive reference line with optional candle coloring and slope-flip alerts.
What this is
A trend filter that estimates the underlying slope of price using a Theil-Sen style median of past slopes, then advances a baseline by a controlled fraction of that slope each bar. The result is a smooth line that reacts to real directional change while staying calm through noise, gaps, and single-bar shocks.
Why Theil-Sen
Classical moving averages are sensitive to outliers and shape changes. Ordinary least squares is sensitive to large residuals. The Theil-Sen idea replaces a single fragile estimate with the median of many simple slopes, which is statistically robust and less influenced by a few extreme bars. That makes the baseline steadier in choppy conditions and cleaner around regime turns.
What it plots
Filtered baseline that advances by a fraction of the robust slope each bar.
Optional candle coloring by baseline slope sign for quick trend read.
Alerts when the baseline slope turns up or down.
How it behaves (high level)
Looks back over a fixed window and forms many “current vs past” bar-to-bar slopes.
Takes the median of those slopes to get a robust estimate for the bar.
Optionally caps the magnitude of that per-bar slope so a single volatile bar cannot yank the line.
Moves the baseline forward by a user-controlled fraction of the estimated slope. Lower fractions are smoother. Higher fractions are more responsive.
Inputs and what they do
Price Source — the series the filter tracks. Typical is close; HL2 or HLC3 can be smoother.
Window Length — how many bars to consider for slopes. Larger windows are steadier and slower. Smaller windows are quicker and noisier.
Response — fraction of the estimated slope applied each bar. 1.00 follows the robust slope closely; values below 1.00 dampen moves.
Slope Cap Mode — optional guardrail on each bar’s slope:
None — no cap.
ATR — cap scales with recent true range.
Percent — cap scales with price level.
Points — fixed absolute cap in price points.
ATR Length / Mult, Cap Percent, Cap Points — tune the chosen cap mode’s size.
UI Settings — show or hide the line, paint candles by slope, choose long and short colors.
How to read it
Up-slope baseline and green candles indicate a rising robust trend. Pullbacks that do not flip the slope often resolve in trend direction.
Down-slope baseline and red candles indicate a falling robust trend. Bounces against the slope are lower-probability until proven otherwise.
Flat or frequent flips suggest a range. Increase window length or decrease response if you want fewer whipsaws in sideways markets.
Use cases
Bias filter — only take longs when slope is up, shorts when slope is down. It is a simple way to gate faster setups.
Stop or trail reference — use the line as a trailing guide. If price closes beyond the line and the slope flips, consider reducing exposure.
Regime detector — widen the window on higher timeframes to define major up vs down regimes for asset rotation or risk toggles.
Noise control — enable a cap mode in very volatile symbols to retain the line’s continuity through event bars.
Tuning guidance
Quick swing trading — shorter window, higher response, optionally add a percent cap to keep it stable on large moves.
Position trading — longer window, moderate response. ATR cap tends to scale well across cycles.
Low-liquidity or gappy charts — prefer longer window and a points or ATR cap. That reduces jumpiness around discontinuities.
Alerts included
Theil-Sen Up Slope — baseline’s one-bar change crosses above zero.
Theil-Sen Down Slope — baseline’s one-bar change crosses below zero.
Strengths
Robust to outliers through median-based slope estimation.
Continuously advances with price rather than re-anchoring, which reduces lag at turns.
User-selectable slope caps to tame shock bars without over-smoothing everything.
Minimal visuals with optional candle painting for fast regime recognition.
Notes
This is a filter, not a trading system. It does not account for execution, spreads, or gaps. Pair it with entry logic, risk management, and higher-timeframe context if you plan to use it for decisions.
TVMC - Composite Indicator with Technical RatingsDescription:
The TVMC (Trend, Volume, Momentum, Composite) indicator is a powerful multi-component tool designed to provide traders with a comprehensive understanding of market conditions. By combining four essential technical analysis components—trend, momentum, volume, and volatility—this indicator offers clear and actionable insights to assist in decision-making.
Key Features:
1. Trend Component (TC):
* Based on MACD (Moving Average Convergence Divergence), this component analyzes the relationship between two exponential moving averages (fast and slow) to determine the prevailing market trend.
* The MACD signal is normalized to a range of -1 to +1 for consistency and clarity.
2. Momentum Component (MC):
* Utilizes RSI (Relative Strength Index) to measure the strength and speed of price movements.
* This component highlights overbought or oversold conditions, which may indicate potential market reversals.
3. Volume Confirmation (VC):
* Compares the current trading volume to its moving average over a specified period.
* High volume relative to the average confirms the validity of the current trend.
4. Volatility Filter (VF):
* Uses ATR (Average True Range) to gauge market volatility.
* Adjusts and smooths signals to reduce noise during periods of high volatility.
5. Technical Ratings Integration:
* Incorporates TradingView’s Technical Ratings, allowing users to validate signals using moving averages, oscillators, or a combination of both.
* Users can choose their preferred source of ratings for enhanced signal confirmation.
How It Works:
The TVMC indicator combines the weighted contributions of the Trend, Momentum, and Volume components, further refined by the Volatility Filter. Each component plays a specific role:
* Trend: Identifies whether the market is bullish, bearish, or neutral.
* Momentum: Highlights the strength of price action.
* Volume: Confirms whether the current price action is supported by sufficient trading activity.
* Volatility: Filters out excessive noise in volatile market conditions, providing a smoother and more reliable output.
Visualization:
1. Bullish Signals:
* The indicator line turns green and remains above the zero line, indicating upward momentum.
2. Bearish Signals:
* The indicator line turns red and falls below the zero line, signaling downward momentum.
3. Neutral Signals:
* The line is orange and stays near zero, indicating a lack of strong trend or momentum.
4. Zones:
* Horizontal lines at +30 and -30 mark strong bullish and bearish zones, respectively.
* A zero line is included for clear separation between bullish and bearish signals.
Recommended Usage:
* Best Timeframes: The indicator is optimized for higher timeframes such as 4-hour (H4) and daily (D1) charts.
* Trading Style: Suitable for swing and positional trading.
* Customization: The indicator allows users to adjust all major parameters (e.g., MACD, RSI, volume, and ATR settings) to fit their trading preferences.
Customization Options:
* Adjustable weights for Trend, Momentum, and Volume components.
* Fully configurable settings for MACD, RSI, Volume SMA, and ATR periods.
* Timeframe selection for multi-timeframe analysis.
Important Notes:
1. Originality: The TVMC indicator combines multiple analysis methods into a unique framework. It does not replicate or minimally modify existing indicators.
2. Transparency: The description is detailed enough for users to understand the methodology without requiring access to the code.
3. Clarity: The indicator is explained in a way that is accessible even to users unfamiliar with complex technical analysis tools.
Compliance with TradingView Rules:
* The indicator is written in Pine Script version 5, adhering to TradingView’s language standards.
* The description is written in English to ensure accessibility to the global community, with a clear explanation of all components and functionality.
* No promotional content, links, or unrelated references are included.
* The chart accompanying the indicator is clean and demonstrates its intended use clearly, with no additional indicators unless explicitly explained.
Bandpass Filters v.02
This is an alternative way to do bandpass filtering. I Still need to update it to support moveable frequency bands. The lowBandpass() is just a 'trick,' as it simply subtracts the highBandpass() from the close data, so it is not really accurate in that it removes the low frequencies, just in a rather less-than-ideal manner.
The "spectrum" of the dataset to filter will always be from 0 to 100, so think of filter boundary as %. So, a boundary of 40% means: 40% of the low-frequencies have been removed from the original data to make the red graph, and 40% of the high-frequencies have been removed from the original data to make the green graph.
This came about after reading the excellent tutorial on signal processing in Pine Script (www.pinecoders.com), as the techniques listed there did not do exactly what I was looking for.
Here is a low-pass graph
Here is a hi-pass graph
[A618]Improved Wave channel 3D The Script is an Amalgamation of Two prominent Scripts in One
1. Ehlers 2 Pole ButterWorth Filter
2. Wave Channel 3D
Intuitively,
Buy when Candles are above all the filter Lines
Sell when Candles are below the Filter Lines
CREDITS