Indicator · Pine Script v6 · Own pane

SSF-Based Detrended Synthetic Price

by mihakralj

Calculates the detrended synthetic price using dual Super Smoother Filters (SSF) derived from a user-defined dominant cycle period.

View on GitHub

GitHub stars47on the repository
Pine versionv6current
Lines of code63
Settings2inputs
LicenceMIT
Last update8 months ago28 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

63 lines of Pine Script v6 from indicators/cycles/ssfdsp.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

ssfdsp.pine
// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("SSF-Based Detrended Synthetic Price", "SSF-DSP", overlay=false)

//@function Calculates SSF-based Detrended Synthetic Price using dual Super Smooth Filters
//@param source Series to detrend
//@param period Dominant cycle period for quarter/half-cycle SSF calculation
//@returns Detrended synthetic price (difference between quarter-cycle and half-cycle SSFs)
ssfdsp(series float source, simple int period) =>
    if period <= 0
        runtime.error("Period must be greater than 0")
    int fast_period = math.max(2, int(math.round(period / 4.0)))
    int slow_period = math.max(3, int(math.round(period / 2.0)))
    float SQRT2_PI = math.sqrt(2.0) * math.pi
    float arg_fast = SQRT2_PI / float(fast_period)
    float exp_fast = math.exp(-arg_fast)
    float c2_fast = 2.0 * exp_fast * math.cos(arg_fast)
    float c3_fast = -exp_fast * exp_fast
    float c1_fast = 1.0 - c2_fast - c3_fast
    float arg_slow = SQRT2_PI / float(slow_period)
    float exp_slow = math.exp(-arg_slow)
    float c2_slow = 2.0 * exp_slow * math.cos(arg_slow)
    float c3_slow = -exp_slow * exp_slow
    float c1_slow = 1.0 - c2_slow - c3_slow
    var float ssf_fast_1 = 0.0
    var float ssf_fast_2 = 0.0
    var int prev_fast_period = 0
    var float ssf_slow_1 = 0.0
    var float ssf_slow_2 = 0.0
    var int prev_slow_period = 0
    float current = nz(source)
    float src_1 = nz(source[1], current)
    float input = (current + src_1) * 0.5
    if prev_fast_period != fast_period
        ssf_fast_1 := input
        ssf_fast_2 := input
        prev_fast_period := fast_period
    if prev_slow_period != slow_period
        ssf_slow_1 := input
        ssf_slow_2 := input
        prev_slow_period := slow_period
    float ssf_fast = c1_fast * input + c2_fast * ssf_fast_1 + c3_fast * ssf_fast_2
    ssf_fast_2 := ssf_fast_1
    ssf_fast_1 := ssf_fast
    float ssf_slow = c1_slow * input + c2_slow * ssf_slow_1 + c3_slow * ssf_slow_2
    ssf_slow_2 := ssf_slow_1
    ssf_slow_1 := ssf_slow
    ssf_fast - ssf_slow

// ---------- Main loop ----------

// Inputs
i_source = input.source(hlc3, "Source")
i_period = input.int(40, "Dominant Cycle Period", minval=4, maxval=200, 
  tooltip="Dominant cycle period. Quarter-cycle and half-cycle SSFs calculated from this value.")

// Calculation
ssfdsp_val = ssfdsp(i_source, i_period)

// Plot
plot(ssfdsp_val, "SSF-DSP", color=color.yellow, linewidth=2)
hline(0, "Zero Line", color=color.gray, linestyle=hline.style_solid)

Overview

The indicator computes a fast SSF based on a quarter-cycle period and a slow SSF based on a half-cycle period, then plots the difference between them in a separate pane along with a zero reference line. Users can customize the price source and cycle length to isolate market cycles.

Details

Published by

mihakralj on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Oscillators & momentum, Moving averages

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinescriptpinescript-indicatorstechnical-analysistradingview-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourcehlc3i_source
Dominant Cycle Periodint40i_period
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

The Derivative Oscillator calculates a double-exponentially smoothed Relative Strength Index (RSI) and subtracts its Simple Moving Average (SMA) to form the main oscillator line. A secondary signal line is plotted using an SMA of the main oscillator values. Th

Indicator v4 Oscillators & momentumMoving averages
Updated 10 days ago · GPL-3.0 GitHub repository of Derivative Oscillator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

MACD

by Alorse
330 stars

This indicator calculates and plots the standard Moving Average Convergence Divergence oscillator in a separate pane. It computes the difference between a fast and slow moving average, derives a signal line through smoothing, and plots a histogram representing

Indicator v4 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MACD

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers