OPEN-SOURCE SCRIPT
Recursive Kernel Trend [QuantAlgo]

🟢 Overview
The Recursive Kernel Trend is a trend-following indicator built on a recursive residual estimator with adaptive rate scheduling. It applies one of six selectable filter structures to a residual-corrected recursion, modulates the update rate according to efficiency and volatility conditions, and confirms directional state through slope persistence. The result is a responsive yet controlled trend line that adapts its tracking behavior to market regime while filtering noise-driven fluctuations across every timeframe and instrument.

🟢 How It Works
The calculation begins with a residual between the selected price source and the current estimate. This residual drives a base recursive update whose rate is not fixed but scheduled on every bar:
Pine Script®
The scheduled rate is produced by combining two adaptive weights. Efficiency weighting measures the ratio of net directional progress to total price path over a lookback window, raising the rate when movement is clean and lowering it during chop. Volatility weighting compares current ATR against a longer baseline and reduces the rate when volatility expands. The combined rate is then bounded by floor and ceiling limits and further scaled by an optional directional bias that applies different multipliers depending on whether price sits above or below the estimate:
Pine Script®
Six filter structures can be applied to the base update. Standard uses a single pass. Wilder halves the rate for smoother behavior. Double and Triple apply successive lag-compensated stages. Gaussian cascades four poles without compensation. Hull combines fast and slow passes then re-smooths the result. All structures receive the live scheduled rate so the adaptive weighting remains active.
A residual accumulator runs in parallel with the recursion. It retains a decaying memory of past residuals and applies a correction term that closes persistent offset during sustained trends. An optional ATR-based limiter can bound the accumulator to prevent overshoot after gaps or parabolic moves:
Pine Script®
Directional state is derived from the slope of the finished estimate after a short smoothing window. A consecutive run of bars in the same slope direction must reach a confirmation threshold before the state is allowed to flip. This step prevents single-bar noise from reversing the trend color or firing alerts.

🟢 Signal Interpretation
▶ Bullish Trend (Long/Buy): When the smoothed slope of the estimate remains positive for the required number of confirmation bars, the indicator enters bullish state. The trend line and gradient layers switch to the bullish color. This condition identifies potential long or buy opportunities and remains active until an equal run of negative slope bars confirms a reversal.
▶ Bearish Trend (Short/Sell): When the smoothed slope remains negative for the required confirmation bars, the indicator enters bearish state. The visual elements switch to the bearish color. This condition identifies potential short or sell opportunities and holds until a confirmed positive run occurs.

🟢 Features
▶ Preconfigured Presets: Three parameter sets cover different trading approaches. Default targets swing trading on 1H to daily charts with balanced rate and confirmation. Fast Response raises the recursion rate and shortens confirmation for intraday charts where the indicator needs to adapt to shorter-duration moves. Smooth Trend lowers the rate and lengthens confirmation for position trading on daily and weekly timeframes, where the cost of a false flip is higher than the cost of a delayed one. Selecting a preset overrides the individual rate, efficiency, and state detection inputs.

▶ Built-in Alerts: Three alert conditions are provided. Bullish State Signal fires when the trend state flips from bearish to bullish. Bearish State Signal fires on the opposite transition. Any State Change combines both into a single notification.

▶ Visual Customization: Six color presets (Classic, Aqua, Cosmic, Cyber, Neon, Custom) coordinate the trend line and gradient layers. Optional bar coloring tints candles with the active state color at a configurable transparency.

*Tips: Layer the Recursive Kernel Trend with complementary analysis rather than treating it as a standalone trading tool. State flips hold most reliably when backed by participation, so combine each change with volume context, since a flip on expanding volume is far more likely to sustain than one on thin flow, and read the move against market structure, as a reversal that aligns with a clear swing high or low carries more significance than one in open space. Pairing this script with volume, open interest, CVD, market structure, and mean reversion indicators from our QuantAlgo toolkit can further validate a directional shift before entry.
The Recursive Kernel Trend is a trend-following indicator built on a recursive residual estimator with adaptive rate scheduling. It applies one of six selectable filter structures to a residual-corrected recursion, modulates the update rate according to efficiency and volatility conditions, and confirms directional state through slope persistence. The result is a responsive yet controlled trend line that adapts its tracking behavior to market regime while filtering noise-driven fluctuations across every timeframe and instrument.
🟢 How It Works
The calculation begins with a residual between the selected price source and the current estimate. This residual drives a base recursive update whose rate is not fixed but scheduled on every bar:
The scheduled rate is produced by combining two adaptive weights. Efficiency weighting measures the ratio of net directional progress to total price path over a lookback window, raising the rate when movement is clean and lowering it during chop. Volatility weighting compares current ATR against a longer baseline and reduces the rate when volatility expands. The combined rate is then bounded by floor and ceiling limits and further scaled by an optional directional bias that applies different multipliers depending on whether price sits above or below the estimate:
Six filter structures can be applied to the base update. Standard uses a single pass. Wilder halves the rate for smoother behavior. Double and Triple apply successive lag-compensated stages. Gaussian cascades four poles without compensation. Hull combines fast and slow passes then re-smooths the result. All structures receive the live scheduled rate so the adaptive weighting remains active.
A residual accumulator runs in parallel with the recursion. It retains a decaying memory of past residuals and applies a correction term that closes persistent offset during sustained trends. An optional ATR-based limiter can bound the accumulator to prevent overshoot after gaps or parabolic moves:
Directional state is derived from the slope of the finished estimate after a short smoothing window. A consecutive run of bars in the same slope direction must reach a confirmation threshold before the state is allowed to flip. This step prevents single-bar noise from reversing the trend color or firing alerts.
🟢 Signal Interpretation
▶ Bullish Trend (Long/Buy): When the smoothed slope of the estimate remains positive for the required number of confirmation bars, the indicator enters bullish state. The trend line and gradient layers switch to the bullish color. This condition identifies potential long or buy opportunities and remains active until an equal run of negative slope bars confirms a reversal.
▶ Bearish Trend (Short/Sell): When the smoothed slope remains negative for the required confirmation bars, the indicator enters bearish state. The visual elements switch to the bearish color. This condition identifies potential short or sell opportunities and holds until a confirmed positive run occurs.
🟢 Features
▶ Preconfigured Presets: Three parameter sets cover different trading approaches. Default targets swing trading on 1H to daily charts with balanced rate and confirmation. Fast Response raises the recursion rate and shortens confirmation for intraday charts where the indicator needs to adapt to shorter-duration moves. Smooth Trend lowers the rate and lengthens confirmation for position trading on daily and weekly timeframes, where the cost of a false flip is higher than the cost of a delayed one. Selecting a preset overrides the individual rate, efficiency, and state detection inputs.
▶ Built-in Alerts: Three alert conditions are provided. Bullish State Signal fires when the trend state flips from bearish to bullish. Bearish State Signal fires on the opposite transition. Any State Change combines both into a single notification.
▶ Visual Customization: Six color presets (Classic, Aqua, Cosmic, Cyber, Neon, Custom) coordinate the trend line and gradient layers. Optional bar coloring tints candles with the active state color at a configurable transparency.
*Tips: Layer the Recursive Kernel Trend with complementary analysis rather than treating it as a standalone trading tool. State flips hold most reliably when backed by participation, so combine each change with volume context, since a flip on expanding volume is far more likely to sustain than one on thin flow, and read the move against market structure, as a reversal that aligns with a clear swing high or low carries more significance than one in open space. Pairing this script with volume, open interest, CVD, market structure, and mean reversion indicators from our QuantAlgo toolkit can further validate a directional shift before entry.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🟢 Access our best trading & investing tools here (3-day FREE trial): whop.com/quantalgo/
🟢 Free Special Edition indicators: joinquantalgo.com/special-editions
🟢 Discord:
🟢 Free Special Edition indicators: joinquantalgo.com/special-editions
🟢 Discord:
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🟢 Access our best trading & investing tools here (3-day FREE trial): whop.com/quantalgo/
🟢 Free Special Edition indicators: joinquantalgo.com/special-editions
🟢 Discord:
🟢 Free Special Edition indicators: joinquantalgo.com/special-editions
🟢 Discord:
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
