Untitled
"TASC 2026.09 Adaptive SuperSmoother" by PineCodersTASC, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: TASC 2026.09 Adaptive SuperSmoother (v1.0), read 2026-11-15T18:29:53.399Z; source language v6.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
TASC 2026.09 Adaptive SuperSmoother by PineCodersTASC, ported from Pine v6. Pane indicator with 4 plots and 3 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2026-08-21; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// TASC Issue: September 2026
// Article: Improved Filter Performance
// Adaptive SuperSmoother
// Article By: John F. Ehlers
// Language: Pine-compatible v6
// Provided By: PineCoders, for tradingview.com
// ------------------------------------------------------------------------------------------------
// Original author: PineCodersTASC
// Original title: TASC 2026.09 Adaptive SuperSmoother
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 6
// Fetched: 2026-11-15
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=6
TITLE = "TASC 2026.09 Adaptive SuperSmoother"
SHORTTITLE = "SS - Adaptive"
indicator(TITLE, SHORTTITLE)
//#region --- Inputs ---
// @variable The source series to analyze.
float srcInput = input.source(close, "Source")
// @variable The base period of the filters.
int perInput = input.int(20, "Base period", 2)
// @variable The RMS length for the Adaptive SuperSmoother.
int rmsInput = input.int(81, "RMS length", 2)
//#endregion
//#region --- Functions ---
// @function Calculates the root mean square (RMS) of a
// series over a specified number of bars.
// @param source The series of values to process.
// @param length The number of bars in the calculation.
// @returns The RMS value.
rms(float source, int length) =>
math.sqrt(ta.sma(source * source, length))
// @function Calculates the SuperSmoother with a specified
// critical period. The SuperSmoother is a
// second-order IIR filter. Its transfer response
// includes a second-degree polynomial in the
// denominator. The filter offers significantly
// greater maximum attenuation of high frequencies,
// without a perceptibly greater amount of
// computational lag.
// @param source The series of values to process.
// @param period The filter's critical period.
// @returns The smoothed series.
superSmoother(float source, int period) =>
float w = 1.414 * math.pi / period
float q = math.exp(-w)
float c1 = 2.0 * q * math.cos(w)
float c2 = q * q
float a0 = (1.0 - c1 + c2) / 2.0
float res = source
if bar_index >= 4
res := a0 * (source + source[1]) + c1 * res[1] - c2 * res[2]
res
// @function Calculates the Adaptive SuperSmoother. The filter
// adapts its critical period based on the rate of
// change in an initial SuperSmoother with a specified
// base period.
// @param source The series of values to process.
// @param period The base period of the filter calculation.
// @param rmsLength Optional. The number of bars over which to calculate
// the RMS of ROC in the base SuperSmoother. The RMS
// scales the ROC in the adaptive period calculation.
// The default is 81.
// @returns The adaptively smoothed series.
adaptiveSuperSmoother(float source, int period, int rmsLength = 81) =>
float ss = superSmoother(source, period)
float roc1 = nz(ss - ss[1])
float rocRMS = rms(roc1, rmsLength)
float roc = 0.0
if rocRMS > 0
roc := math.min(math.abs(roc1 / rocRMS), 2.0)
float factor = math.pow(1.0 - 0.5 * roc, 2)
int aPeriod = math.max(int(period * factor), 2)
superSmoother(source, aPeriod)
//#endregion
//#region --- Calculations and plots ---
// @variable The fixed-period SuperSmoother.
float ssBase = superSmoother(srcInput, perInput)
// @variable The Adaptive SuperSmoother.
float ssAdaptive = adaptiveSuperSmoother(srcInput, perInput, rmsInput)
float osc = ssAdaptive - ssBase
// Plot the two series for visual comparison.
plot(ssBase, "SuperSmoother", color.red, force_overlay=true)
plot(ssAdaptive, "Adaptive SuperSmoother", color.blue, force_overlay=true)
plot(0, "SS Base", color.red)
plot(osc, "Adaptive SS Oscillator", color.blue)
//#endregion
This file is under the Mozilla Public License 2.0; it is a port of the original by PineCodersTASC, with the original licence header kept and the changes made for FloScript noted in the file.
- v1
Library refresh 2026-11-15
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.