mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 04:28:04 +00:00
Merge branch 'dev'
This commit is contained in:
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [agc.pine](agc.pine) |
|
||||
|
||||
- The Automatic Gain Control normalizes any oscillating signal to the \[-1, +1\] range through exponential peak tracking.
|
||||
- Parameterized by `decay` (default 0.991).
|
||||
- Output range: [-1, +1] (normalized amplitude).
|
||||
- Requires `1` bar of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Kalman](../kalman/Kalman.md), [LMS](../lms/Lms.md) | **Complementary:** ATR for volatility context | **Trading note:** Automatic Gain Control; normalizes signal amplitude adaptively.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -181,4 +179,4 @@ source.Add(new TValue(DateTime.UtcNow, close));
|
||||
## References
|
||||
|
||||
- Ehlers, J. F. "The Universal Oscillator." *Technical Analysis of Stocks & Commodities*, January 2015.
|
||||
- Ehlers, J. F. *Cycle Analytics for Traders*. Wiley, 2013.
|
||||
- Ehlers, J. F. *Cycle Analytics for Traders*. Wiley, 2013.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [alaguerre_signature](alaguerre_signature.md) |
|
||||
|
||||
- The Adaptive Laguerre Filter extends Ehlers' four-element all-pass cascade by replacing the fixed damping factor with a per-bar adaptive alpha deri...
|
||||
- Parameterized by `length` (default 20), `medianlength` (default 5).
|
||||
- Output range: Tracks input.
|
||||
- Requires `max(4, length)` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Laguerre](../laguerre/Laguerre.md), [SSF2](../ssf2/Ssf2.md) | **Complementary:** RSI for momentum | **Trading note:** Adaptive Laguerre filter by Ehlers; adjusts damping based on market conditions.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -185,4 +183,4 @@ Since the Adaptive Laguerre Filter is a custom Ehlers indicator not found in sta
|
||||
|
||||
- Ehlers, John F. *Cybernetic Analysis for Stocks and Futures*. Wiley, 2004. ISBN: 978-0-471-46307-8.
|
||||
- WiseStockTrader Amibroker AFL: Adaptive Laguerre Filter implementation.
|
||||
- Ehlers, John F. "Laguerre Filter." *Technical Analysis of Stocks and Commodities*, various issues.
|
||||
- Ehlers, John F. "Laguerre Filter." *Technical Analysis of Stocks and Commodities*, various issues.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [baxterking.pine](baxterking.pine) |
|
||||
|
||||
- The **Baxter-King Band-Pass Filter** is a symmetric finite impulse response (FIR) filter that approximates the ideal spectral band-pass by truncati...
|
||||
- Parameterized by `plow` (default 6), `phigh` (default 32), `k` (default 12).
|
||||
- Output range: Oscillates around zero (extracts cyclical component).
|
||||
- Requires `2K+1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Cfitz](../cfitz/Cfitz.md), [BPF](../bpf/Bpf.md) | **Complementary:** Hilbert Transform for phase | **Trading note:** Baxter-King bandpass filter; isolates business cycle frequencies. Symmetric FIR.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **Baxter-King Band-Pass Filter** is a symmetric finite impulse response (FIR) filter that approximates the ideal spectral band-pass by truncating the infinite sinc-like impulse response at lag $K$ and normalizing the weights to sum to zero. It extracts cyclical components with periodicities between $p_L$ (low) and $p_H$ (high) bars, rejecting both the DC trend and high-frequency noise. Output oscillates around zero with a fixed delay of $K$ bars.
|
||||
@@ -197,4 +195,4 @@ var (results, indicator) = BaxterKing.Calculate(series, pLow: 6, pHigh: 32, k: 1
|
||||
var source = new TSeries();
|
||||
var bkChained = new BaxterKing(source, pLow: 6, pHigh: 32, k: 12);
|
||||
source.Add(new TValue(DateTime.UtcNow, price)); // bkChained.Last auto-updates
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [bessel_signature](bessel_signature.md) |
|
||||
|
||||
- The Bessel Filter is a 2nd-order low-pass IIR filter designed to preserve the **shape** and **timing** of price moves.
|
||||
- Parameterized by `length`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `length` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Butter2](../butter2/Butter2.md), [Gauss](../gauss/Gauss.md) | **Complementary:** ATR for volatility | **Trading note:** Bessel filter; maximally flat group delay (linear phase). Best for preserving waveform shape.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> When you care more about *when* the market turns than how aggressively you can torture the noise, you reach for a Bessel.
|
||||
@@ -157,4 +155,4 @@ Validation focuses on internal consistency between streaming, TSeries, and Span
|
||||
* **Misinterpreting flat response as “weak” filter:** The goal is not to crush all noise. The goal is to keep enough structure that pattern recognition, divergence analysis, and multi-stream alignment still make sense.
|
||||
* **Ignoring NaN propagation:** If your upstream feed throws `NaN` or infinities and you do not clean it, BESSEL will fall back to the last valid value. This is intentional. If you want gaps instead, preprocess the series and pass explicit masked values.
|
||||
|
||||
Used correctly, BESSEL gives you a **shape-faithful trend line** with clean timing and low overshoot, ideal for traders who care more about *when* than *how loudly* the filter shouts.
|
||||
Used correctly, BESSEL gives you a **shape-faithful trend line** with clean timing and low overshoot, ideal for traders who care more about *when* than *how loudly* the filter shouts.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [bilateral_signature](bilateral_signature.md) |
|
||||
|
||||
- The Bilateral Filter is a non-linear, edge-preserving, and noise-reducing smoothing filter.
|
||||
- Parameterized by `period`, `sigmasratio` (default 0.5), `sigmarmult` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Kalman](../kalman/Kalman.md), [RMed](../rmed/Rmed.md) | **Complementary:** Volume for weight adjustment | **Trading note:** Bilateral filter; preserves edges (sudden price moves) while smoothing noise.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Bilateral Filter is a non-linear, edge-preserving, and noise-reducing smoothing filter. Unlike standard Gaussian filters that blur everything indiscriminately, the Bilateral Filter respects strong edges by weighting pixels based on both their spatial distance and their intensity difference (range).
|
||||
@@ -121,4 +119,4 @@ var bilateral = new Bilateral(14, sigmaSRatio: 0.5, sigmaRMult: 1.0);
|
||||
// Update with new price
|
||||
var result = bilateral.Update(new TValue(DateTime.UtcNow, 100.0));
|
||||
|
||||
Console.WriteLine($"Bilateral: {result.Value}");
|
||||
Console.WriteLine($"Bilateral: {result.Value}");
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [bpf.pine](bpf.pine) |
|
||||
|
||||
- The **BPF** (BandPass Filter) is a second-order IIR architecture designed to surgically excise specific frequency components from a time series.
|
||||
- Parameterized by `lowerperiod`, `upperperiod`.
|
||||
- Output range: Oscillates around zero (bandpass extracts cyclic component).
|
||||
- Requires `Math.Max(lowerPeriod, upperPeriod)` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BaxterKing](../baxterking/BaxterKing.md), [Notch](../notch/Notch.md) | **Complementary:** Cycle indicators | **Trading note:** Bandpass filter; isolates a specific frequency band. Used for cycle extraction.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **BPF** (BandPass Filter) is a second-order IIR architecture designed to surgically excise specific frequency components from a time series. By cascading a HighPass Filter (to reject trend) and a LowPass Filter (to reject noise), it isolates cyclic energy within a user-defined window. Unlike simple moving average crossovers which smear data, the BPF relies on Gaussian-based coefficients to achieve steeper roll-off with deterministic phase characteristics.
|
||||
@@ -124,4 +122,4 @@ var result = bpf.Update(new TValue(DateTime.UtcNow, price));
|
||||
// Static Analysis (Zero Allocation)
|
||||
double[] output = new double[prices.Length];
|
||||
Bpf.Calculate(prices, output, 40, 10);
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [butter2_signature](butter2_signature.md) |
|
||||
|
||||
- The 2-Pole Butterworth Filter (BUTTER2) is a signal processing tool designed to provide maximally flat frequency response in the passband.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `4 * period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Butter3](../butter3/Butter3.md), [Bessel](../bessel/Bessel.md) | **Complementary:** Ehlers cycle indicators | **Trading note:** 2nd-order Butterworth; maximally flat passband. Classic IIR low-pass filter.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The 2-Pole Butterworth Filter (BUTTER2) is a signal processing tool designed to provide maximally flat frequency response in the passband. Developed by British engineer Stephen Butterworth in 1930, it offers traders a means to smooth price data without introducing ripples in the frequency response. This implementation provides a 2nd-order low-pass filter that effectively removes high-frequency market noise while preserving lower-frequency trend components. Compared to other filters, Butterworth offers an optimal compromise between smoothing efficiency and signal fidelity, making it a versatile choice for various market conditions.
|
||||
@@ -108,4 +106,4 @@ double result = butter.Update(price).Value;
|
||||
|
||||
// Batch
|
||||
var series = Butter2.Calculate(sourceSeries, period: 14);
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [butter3_signature](butter3_signature.md) |
|
||||
|
||||
- The 3-Pole Butterworth Filter (BUTTER3) extends the classic Butterworth design to third order, providing -60 dB/decade rolloff compared to -40 dB/d...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `6 * period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Butter2](../butter2/Butter2.md), [Elliptic](../elliptic/Elliptic.md) | **Complementary:** Phase analysis tools | **Trading note:** 3rd-order Butterworth; steeper rolloff than 2nd-order but more phase distortion.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The 3-Pole Butterworth Filter (BUTTER3) extends the classic Butterworth design to third order, providing -60 dB/decade rolloff compared to -40 dB/decade for the 2-pole variant. Developed from John Ehlers' formulation in "Cybernetic Analysis for Stocks and Futures" (2004), this implementation uses the same pole placement as the 3-pole Super Smoother (SSF3) but with binomial (1,3,3,1) feedforward weights that preserve the maximally flat passband characteristic. The steeper rolloff makes BUTTER3 more effective at rejecting high-frequency noise, at the cost of slightly more lag than BUTTER2.
|
||||
@@ -129,4 +127,4 @@ Butter3.Batch(sourceSpan, destSpan, period: 20, initialLast: double.NaN);
|
||||
## References
|
||||
|
||||
* Ehlers, John F. "Cybernetic Analysis for Stocks and Futures." Wiley, 2004.
|
||||
* Butterworth, Stephen. "On the Theory of Filter Amplifiers." Experimental Wireless and the Wireless Engineer, 1930.
|
||||
* Butterworth, Stephen. "On the Theory of Filter Amplifiers." Experimental Wireless and the Wireless Engineer, 1930.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [cfitz.pine](cfitz.pine) |
|
||||
|
||||
- The **Christiano-Fitzgerald Band-Pass Filter** is an asymmetric full-sample filter that approximates the ideal spectral band-pass by using time-var...
|
||||
- Parameterized by `plow` (default 6), `phigh` (default 32).
|
||||
- Output range: Oscillates around zero (extracts cyclical component).
|
||||
- Requires `2` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BaxterKing](../baxterking/BaxterKing.md), [HP](../hp/Hp.md) | **Complementary:** Trend indicators | **Trading note:** Christiano-Fitzgerald bandpass filter; asymmetric, optimal for finite samples.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Overview
|
||||
@@ -183,4 +181,4 @@ var (results, indicator) = Cfitz.Calculate(series, pLow: 6, pHigh: 32);
|
||||
var source = new TSeries();
|
||||
var cfChained = new Cfitz(source, pLow: 6, pHigh: 32);
|
||||
source.Add(new TValue(DateTime.UtcNow, price)); // cfChained.Last auto-updates
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [cheby1_signature](cheby1_signature.md) |
|
||||
|
||||
- The Chebyshev Type I filter minimizes the error between the idealized and the actual filter characteristic over the range of the passband, but with...
|
||||
- Parameterized by `period`, `ripple` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Cheby2](../cheby2/Cheby2.md), [Elliptic](../elliptic/Elliptic.md) | **Complementary:** ATR for stop distance | **Trading note:** Chebyshev Type I; passband ripple for sharper transition. Steeper than Butterworth.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Chebyshev Type I filter minimizes the error between the idealized and the actual filter characteristic over the range of the passband, but with ripples in the passband. This type of filter has a steeper rolloff and more passband ripple (type I) or stopband ripple (type II) than Butterworth filters.
|
||||
@@ -109,4 +107,4 @@ IIR filters cannot be vectorized across the time axis due to their recursive str
|
||||
|
||||
## References
|
||||
|
||||
- [Chebyshev filter - Wikipedia](https://en.wikipedia.org/wiki/Chebyshev_filter)
|
||||
- [Chebyshev filter - Wikipedia](https://en.wikipedia.org/wiki/Chebyshev_filter)
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [cheby2_signature](cheby2_signature.md) |
|
||||
|
||||
- A Chebyshev Type II filter (also known as Inverse Chebyshev) with O(1) complexity.
|
||||
- Parameterized by `period`, `attenuation` (default 5.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Cheby1](../cheby1/Cheby1.md), [Elliptic](../elliptic/Elliptic.md) | **Complementary:** Trend strength indicators | **Trading note:** Chebyshev Type II; flat passband with stopband ripple. No overshoot in passband.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
A Chebyshev Type II filter (also known as Inverse Chebyshev) with O(1) complexity. Unlike the Type I filter, Type II is maximally flat in the passband (like Butterworth) but has equiripple in the stopband.
|
||||
@@ -85,4 +83,4 @@ Console.WriteLine($"Filter value: {result.Value}");
|
||||
## complexity
|
||||
|
||||
- **Time**: O(1) per update.
|
||||
- **Space**: O(1) constant storage.
|
||||
- **Space**: O(1) constant storage.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [edcf_signature](edcf_signature.md) |
|
||||
|
||||
- The **Ehlers Distance Coefficient Filter (EDCF)** is a nonlinear adaptive FIR filter created by John F.
|
||||
- Parameterized by `length` (default 15).
|
||||
- Output range: Tracks input.
|
||||
- Requires `length` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HP](../hp/Hp.md), [SSF2](../ssf2/Ssf2.md) | **Complementary:** Cycle period detection | **Trading note:** Ehlers Distance Coefficient Filter; adapts to dominant cycle period.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Overview
|
||||
@@ -160,4 +158,4 @@ SIMD reduces the inner loop throughput by 4x-8x but does not change the O(N^2) c
|
||||
## References
|
||||
|
||||
1. Ehlers, J. F. "Ehlers Filters." MESA Software. [PDF](https://www.mesasoftware.com/papers/EhlersFilters.pdf)
|
||||
2. Ehlers, J. F. "Nonlinear Ehlers Filters." *Stocks & Commodities*, V.19:4, pp.25-34.
|
||||
2. Ehlers, J. F. "Nonlinear Ehlers Filters." *Stocks & Commodities*, V.19:4, pp.25-34.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [elliptic_signature](elliptic_signature.md) |
|
||||
|
||||
- The Elliptic filter (or Cauer filter for the history buffs) is the uncompromising extremist of linear filtering.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Cheby1](../cheby1/Cheby1.md), [Butter2](../butter2/Butter2.md) | **Complementary:** Phase analysis | **Trading note:** Elliptic (Cauer) filter; sharpest transition of all IIR filters but has ripple in both bands.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Elliptic filter (or Cauer filter for the history buffs) is the uncompromising extremist of linear filtering. It offers the steepest possible roll-off for a given order, but extracts a heavy price: ripple in both the passband and the stopband. While Butterworth is polite and Chebyshev is opinionated, Elliptic is aggressive. This implementation delivers a sharp 2nd-order Lowpass response with **1dB passband ripple** and a crushing **40dB stopband attenuation**.
|
||||
@@ -90,4 +88,4 @@ Correctness is non-negotiable.
|
||||
| :--- | :--- | :--- |
|
||||
| **PineScript** | ✅ | Matches the reference implementation logic. |
|
||||
| **Python** | ✅ | Validated against scipy.signal.cheby1 (proxy) and noise reduction tests. |
|
||||
| **Stability** | ✅ | Unity gain enforced. Transient suppression active. |
|
||||
| **Stability** | ✅ | Unity gain enforced. Transient suppression active. |
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- Gauss (Gaussian Filter) is a smoothing filter that applies a Gaussian kernel to time series data.
|
||||
- Parameterized by `sigma` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `2⌈3σ⌉+1` bars of warmup before first valid output (IsHot = true). Default: **7 bars** (σ=1.0).
|
||||
- **Similar:** [Bessel](../bessel/Bessel.md), [SSF2](../ssf2/Ssf2.md) | **Complementary:** ATR for volatility bands | **Trading note:** Gaussian filter; IIR approximation of the Gaussian window. Smooth with minimal overshoot.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Gauss (Gaussian Filter) is a smoothing filter that applies a Gaussian kernel to time series data. Unlike Simple Moving Average (SMA), which weights all points in the window equally (boxcar function), the Gaussian filter applies weights that follow a bell curve distribution. This minimizes lag while providing superior noise reduction and significantly better preservation of signal edges.
|
||||
@@ -125,4 +123,4 @@ var result = gauss.Update(new TValue(DateTime.UtcNow, 100.0));
|
||||
Gauss.Calculate(inputSpan, outputSpan, sigma: 2.0);
|
||||
|
||||
// Use with a higher sigma for stronger smoothing
|
||||
var smoothGauss = new Gauss(sigma: 3.0); // Window ~19
|
||||
var smoothGauss = new Gauss(sigma: 3.0); // Window ~19
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [hann_signature](hann_signature.md) |
|
||||
|
||||
- Hann (Hann Filter) is a Finite Impulse Response (FIR) smoothing filter that applies a Hann window to time series data.
|
||||
- Parameterized by `length`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `length` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Gauss](../gauss/Gauss.md), [Bessel](../bessel/Bessel.md) | **Complementary:** Cycle analysis tools | **Trading note:** Hann window filter; smooth taper to zero at edges. Good spectral properties.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Hann (Hann Filter) is a Finite Impulse Response (FIR) smoothing filter that applies a Hann window to time series data. Named after Julius von Hann, this filter uses a cosine-sum window function that tapers inputs to zero at the edges. This tapering process significantly reduces spectral leakage and provides excellent high-frequency noise attenuation compared to a Simple Moving Average (SMA).
|
||||
@@ -116,4 +114,4 @@ var result = hann.Update(new TValue(DateTime.UtcNow, 100.0));
|
||||
Hann.Calculate(inputSpan, outputSpan, length: 20);
|
||||
|
||||
// Use with a publisher
|
||||
var hannLive = new Hann(source, length: 20);
|
||||
var hannLive = new Hann(source, length: 20);
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The Hodrick-Prescott (HP) filter is a widely used tool in macroeconomics for separating the cyclical component of a time series from raw data.
|
||||
- Parameterized by `lambda` (default 1600.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `⌈2√λ⌉` bars of warmup before first valid output (IsHot = true). Default: **~80 bars** (λ=1600).
|
||||
- **Similar:** [HPF](../hpf/Hpf.md), [Roofing](../roofing/Roofing.md) | **Complementary:** Low-pass filter for trend | **Trading note:** Hodrick-Prescott filter; separates trend from cycle component. Lambda controls smoothness.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Hodrick-Prescott (HP) filter is a widely used tool in macroeconomics for separating the cyclical component of a time series from raw data. While the standard HP filter is non-causal (requiring future data), this implementation uses a causal approximation suitable for real-time streaming analysis.
|
||||
@@ -112,4 +110,4 @@ TValue trend = hp.Update(new TValue(time, price));
|
||||
// Static batch calculation
|
||||
double[] prices = ...;
|
||||
double[] trend = new double[prices.Length];
|
||||
Hp.Calculate(prices, trend, 1600);
|
||||
Hp.Calculate(prices, trend, 1600);
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [hpf.pine](hpf.pine) |
|
||||
|
||||
- The 2-Pole Highpass Filter (HPF) is designed to separate high-frequency components (like cycles and noise) from the underlying trend.
|
||||
- Parameterized by `length` (default 40).
|
||||
- Output range: Oscillates around zero (detrended signal).
|
||||
- Requires `length` bars of warmup before first valid output (IsHot = true). Default: **40 bars**.
|
||||
- **Similar:** [HP](../hp/Hp.md), [Roofing](../roofing/Roofing.md) | **Complementary:** SSF for low-pass | **Trading note:** High-pass filter; removes trend, isolates cycles and noise. Ehlers' 1-pole design.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The 2-Pole Highpass Filter (HPF) is designed to separate high-frequency components (like cycles and noise) from the underlying trend. By suppressing low-frequency movements, it acts as a "detrender," making it invaluable for oscillator construction and cycle analysis.
|
||||
@@ -114,4 +112,4 @@ TValue cycle = hpf.Update(new TValue(time, price));
|
||||
// Static batch calculation
|
||||
double[] prices = ...;
|
||||
double[] cycle = new double[prices.Length];
|
||||
Hpf.Calculate(prices, cycle, 40);
|
||||
Hpf.Calculate(prices, cycle, 40);
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The **Kalman Filter** is a recursive algorithm that estimates the state of a dynamic system from a series of incomplete and noisy measurements.
|
||||
- Parameterized by `q` (default 0.01), `r` (default 0.1).
|
||||
- Output range: Tracks input.
|
||||
- Requires `10` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [LMS](../lms/Lms.md), [RLS](../rls/Rls.md) | **Complementary:** ATR for measurement noise estimation | **Trading note:** Kalman filter; optimal linear estimator. Adapts to changing market dynamics. Widely used in quant finance.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **Kalman Filter** is a recursive algorithm that estimates the state of a dynamic system from a series of incomplete and noisy measurements. In technical analysis, it acts as a sophisticated smoothing filter that adapts to price changes based on specified noise covariances. Unlike simple moving averages that treat all past data equally or with fixed weights, the Kalman Filter dynamically adjusts its "trust" between its own prediction and the new price data.
|
||||
@@ -126,4 +124,4 @@ Kalman.Calculate(inputs, outputs, q: 0.05, r: 0.5);
|
||||
// Chaining
|
||||
var source = new TSeries();
|
||||
var kf1 = new Kalman(source, q: 0.01, r: 0.1);
|
||||
var kf2 = new Kalman(kf1, q: 0.001, r: 0.1); // Double smoothing
|
||||
var kf2 = new Kalman(kf1, q: 0.001, r: 0.1); // Double smoothing
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The Laguerre Filter is a four-element IIR (Infinite Impulse Response) filter designed by John F.
|
||||
- Parameterized by `gamma` (default 0.8).
|
||||
- Output range: Tracks input.
|
||||
- Requires `WarmupBars` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [ALaguerre](../alaguerre/ALaguerre.md), [SSF2](../ssf2/Ssf2.md) | **Complementary:** RSI for momentum | **Trading note:** Laguerre filter by Ehlers; FIR-like response from IIR structure. Damping factor 0–1 controls smoothing.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -171,4 +169,4 @@ Since the Laguerre Filter is not available in standard external validation libra
|
||||
1. Ehlers, J.F. (2004). *Cybernetic Analysis for Stocks and Futures*. Wiley. ISBN: 978-0-471-46307-8
|
||||
2. Ehlers, J.F. "EhlersFilters.pdf" — MESA Software technical papers. [mesasoftware.com](https://www.mesasoftware.com/papers/EhlersFilters.pdf)
|
||||
3. Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. ISBN: 978-0-471-40567-1
|
||||
4. Laguerre, E. (1898). "Sur les fonctions du genre de Laguerre." *Comptes Rendus de l'Académie des Sciences.*
|
||||
4. Laguerre, E. (1898). "Sur les fonctions du genre de Laguerre." *Comptes Rendus de l'Académie des Sciences.*
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [lms.pine](lms.pine) |
|
||||
|
||||
- The **Least Mean Squares (LMS) Adaptive Filter** is the Widrow-Hoff adaptive FIR filter, the simplest and most widely deployed adaptive algorithm i...
|
||||
- Parameterized by `order` (default 16), `mu` (default 0.5).
|
||||
- Output range: Tracks input.
|
||||
- Requires `order + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [RLS](../rls/Rls.md), [Kalman](../kalman/Kalman.md) | **Complementary:** Error metrics for convergence monitoring | **Trading note:** Least Mean Squares adaptive filter; tracks changing signal statistics. Low computational cost.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **Least Mean Squares (LMS) Adaptive Filter** is the Widrow-Hoff adaptive FIR filter, the simplest and most widely deployed adaptive algorithm in signal processing. It maintains an `order`-tap weight vector that learns to predict the current input from its recent history, updating weights via the Normalized LMS (NLMS) gradient descent rule. The result is a price-following overlay filter that automatically adapts its frequency response to changing market conditions with O(order) per-bar complexity.
|
||||
@@ -192,4 +190,4 @@ Lms.Batch(prices, output, order: 16, mu: 0.5);
|
||||
var source = new TSeries();
|
||||
var lmsChained = new Lms(source, order: 16, mu: 0.5);
|
||||
source.Add(new TValue(DateTime.UtcNow, price)); // lmsChained.Last auto-updates
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [loess_signature](loess_signature.md) |
|
||||
|
||||
- Locally Estimated Scatterplot Smoothing (LOESS) applies a weighted linear regression over a localized window of nearest neighbors.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `Period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [SGF](../sgf/Sgf.md), [NW](../nw/Nw.md) | **Complementary:** Lin reg for trend | **Trading note:** Locally Estimated Scatterplot Smoothing; non-parametric regression. Adapts to local data structure.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Locally Estimated Scatterplot Smoothing (LOESS) applies a weighted linear regression over a localized window of nearest neighbors. Unlike simple averaging or global linear regression, LOESS estimates the deterministic trend point-by-point, giving maximum influence to recent data and decaying elegantly at the edges.
|
||||
@@ -113,4 +111,4 @@ Validating against statistical properties and theoretical linear trend reconstru
|
||||
### Common Pitfalls
|
||||
|
||||
* **Window Size:** Very small periods (<5) approximate the input noisily. Large periods introduce lag.
|
||||
* **NaN Propagation:** Standard implementations propagate `NaN`. This implementation stops them dead.
|
||||
* **NaN Propagation:** Standard implementations propagate `NaN`. This implementation stops them dead.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [modf_signature](modf_signature.md) |
|
||||
|
||||
- MODF is a dual-path adaptive filter that maintains separate upper and lower EMA bands with conditional state selection.
|
||||
- Parameterized by `period`, `beta` (default 0.8), `feedback` (default false), `fbweight` (default 0.5).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [HP](../hp/Hp.md), [BaxterKing](../baxterking/BaxterKing.md) | **Complementary:** Trend indicators | **Trading note:** Mode decomposition filter; separates signal into trend, cyclical, and noise components.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
MODF is a dual-path adaptive filter that maintains separate upper and lower EMA bands with conditional state selection. The upper band snaps up to price when price exceeds it (tracking rallies), while the lower band snaps down when price drops below it (tracking selloffs). An oscillator state variable determines which band is active, and a beta parameter controls the blend between filter mode (smooth tracking) and trailing-stop mode (step-like following). An optional feedback loop blends the filter's output back into its input for additional smoothing. Developed by alexgrover (CPO at LuxAlgo).
|
||||
@@ -158,4 +156,4 @@ Fully recursive — no SIMD path available. Batch throughput: ~26-30 cy/bar scal
|
||||
## Resources
|
||||
|
||||
- alexgrover (LuxAlgo). "Modular Filter" indicator. Published on TradingView.
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. Chapter 6: Adaptive Filters (general framework).
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. Chapter 6: Adaptive Filters (general framework).
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [notch_signature](notch_signature.md) |
|
||||
|
||||
- The Notch Filter is a band-stop filter with a narrow bandwidth.
|
||||
- Parameterized by `period`, `q` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BPF](../bpf/Bpf.md), [Roofing](../roofing/Roofing.md) | **Complementary:** Cycle period detection | **Trading note:** Notch filter; removes a specific frequency. Useful for eliminating known periodic noise.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> Sometimes the best way to improved signal clarity isn't amplification, but rather the surgical removal of a specific annoyance.
|
||||
@@ -108,4 +106,4 @@ var notch = new Notch(period: 10, q: 1.0);
|
||||
TValue result = notch.Update(new TValue(DateTime.UtcNow, price));
|
||||
|
||||
// Static calculation for a full series
|
||||
TSeries filtered = Notch.Calculate(series, period: 10, q: 1.0);
|
||||
TSeries filtered = Notch.Calculate(series, period: 10, q: 1.0);
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [nw_signature](nw_signature.md) |
|
||||
|
||||
- NW computes the Nadaraya-Watson kernel regression estimator with a Gaussian kernel, producing a nonparametric smooth of the price series.
|
||||
- Parameterized by `period` (default 64), `bandwidth` (default 8.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Loess](../loess/Loess.md), [SGF](../sgf/Sgf.md) | **Complementary:** Bandwidth selection via cross-validation | **Trading note:** Nadaraya-Watson kernel regression; non-parametric smoother with Gaussian kernel.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
NW computes the Nadaraya-Watson kernel regression estimator with a Gaussian kernel, producing a nonparametric smooth of the price series. For each bar, every observation in the lookback window is weighted by a Gaussian function of its temporal distance, with the bandwidth parameter $h$ controlling the effective smoothing radius. Small $h$ tracks price tightly (low bias, high variance); large $h$ smooths heavily (high bias, low variance). This implementation is non-repainting (backward-looking only).
|
||||
@@ -127,4 +125,4 @@ AVX2 dot product on contiguous double array: ~200-250 cy for N=200 vs ~1200 scal
|
||||
|
||||
- Nadaraya, E.A. (1964). "On Estimating Regression." *Theory of Probability and Its Applications*, 9(1), 141-142.
|
||||
- Watson, G.S. (1964). "Smooth Regression Analysis." *Sankhyā: The Indian Journal of Statistics*, Series A, 26(4), 359-372.
|
||||
- Wand, M.P. & Jones, M.C. (1995). *Kernel Smoothing*. Chapman & Hall/CRC. Chapter 2: The Density Estimator.
|
||||
- Wand, M.P. & Jones, M.C. (1995). *Kernel Smoothing*. Chapman & Hall/CRC. Chapter 2: The Density Estimator.
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The **One Euro Filter** (1€ Filter) is a speed-adaptive first-order low-pass filter designed to balance jitter removal against responsiveness.
|
||||
- Parameterized by `mincutoff` (default 1.0), `beta` (default 0.007), `dcutoff` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Kalman](../kalman/Kalman.md), [LMS](../lms/Lms.md) | **Complementary:** ATR for cutoff tuning | **Trading note:** One Euro filter; adaptive low-pass that reduces jitter while preserving quick movements.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **One Euro Filter** (1€ Filter) is a speed-adaptive first-order low-pass filter designed to balance jitter removal against responsiveness. It uses an adaptive cutoff frequency: at low signal speed, a low cutoff stabilizes the signal by reducing jitter; as speed increases, the cutoff rises to reduce lag.
|
||||
@@ -118,4 +116,4 @@ var smooth = new OneEuro(source, minCutoff: 1.0, beta: 0.007);
|
||||
## Reference
|
||||
|
||||
> Casiez, G., Roussel, N., & Vogel, D. (2012). **1€ Filter: A Simple Speed-Based Low-Pass Filter for Noisy Input in Interactive Systems.** *CHI '12*, pp. 2527–2530.
|
||||
> DOI: [10.1145/2207676.2208639](https://doi.org/10.1145/2207676.2208639)
|
||||
> DOI: [10.1145/2207676.2208639](https://doi.org/10.1145/2207676.2208639)
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The Recursive Least Squares (RLS) adaptive filter is the Rolls-Royce of adaptive FIR filters.
|
||||
- Parameterized by `order` (default 16), `lambda` (default 0.99).
|
||||
- Output range: Tracks input.
|
||||
- Requires `order + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [LMS](../lms/Lms.md), [Kalman](../kalman/Kalman.md) | **Complementary:** Error metrics | **Trading note:** Recursive Least Squares; faster convergence than LMS but higher computational cost. Forgetting factor adapts to regime changes.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -169,4 +167,4 @@ RLS is a custom adaptive filter with no direct equivalent in standard TA librari
|
||||
- Haykin, S. (2002). *Adaptive Filter Theory*. 4th ed. Prentice Hall. Chapters 9-10.
|
||||
- Ljung, L. & Soderstrom, T. (1983). *Theory and Practice of Recursive Identification*. MIT Press.
|
||||
- Sayed, A.H. (2008). *Adaptive Filters*. Wiley-IEEE Press.
|
||||
- Kalman, R.E. (1960). "A New Approach to Linear Filtering and Prediction Problems." *Journal of Basic Engineering*, 82(1), 35-45.
|
||||
- Kalman, R.E. (1960). "A New Approach to Linear Filtering and Prediction Problems." *Journal of Basic Engineering*, 82(1), 35-45.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [rmed_signature](rmed_signature.md) |
|
||||
|
||||
- RMED applies exponential smoothing to a 5-bar running median, creating a nonlinear IIR filter that rejects impulsive spike noise while providing sm...
|
||||
- Parameterized by `period` (default 12).
|
||||
- Output range: Tracks input.
|
||||
- Requires **5 bars** of warmup (MedianWindow) before first valid output (IsHot = true).
|
||||
- **Similar:** [Bilateral](../bilateral/Bilateral.md), [Loess](../loess/Loess.md) | **Complementary:** ATR for volatility | **Trading note:** Running median filter; non-linear, completely removes impulse noise. Preserves edges.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
RMED applies exponential smoothing to a 5-bar running median, creating a nonlinear IIR filter that rejects impulsive spike noise while providing smooth recursive tracking. The median component eliminates outliers that would corrupt any linear filter, while the EMA provides the recursive continuity that a pure median lacks. The EMA constant $\alpha$ is derived from Ehlers' cycle-period formula, connecting the smoothing rate to the dominant cycle length of the data.
|
||||
@@ -133,4 +131,4 @@ Nonlinear median + recursive EMA blocks all meaningful SIMD. Batch throughput: ~
|
||||
|
||||
- Ehlers, J.F. (2018). "Recursive Median Filters." *Technical Analysis of Stocks & Commodities*, March 2018.
|
||||
- Tukey, J.W. (1977). *Exploratory Data Analysis*. Addison-Wesley. Chapter 7: Resistant Smoothing.
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. Chapter 3: Smoothing Constants from Cycle Period.
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. Chapter 3: Smoothing Constants from Cycle Period.
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [roofing.pine](roofing.pine) |
|
||||
|
||||
- The **Roofing Filter** is John Ehlers' bandpass architecture designed specifically for oscillator construction.
|
||||
- Parameterized by `hplength` (default 48), `sslength` (default 10).
|
||||
- Output range: Oscillates around zero (bandpass behavior).
|
||||
- Requires `hpLength` bars of warmup before first valid output (IsHot = true). Default: **48 bars**.
|
||||
- **Similar:** [HPF](../hpf/Hpf.md), [SSF2](../ssf2/Ssf2.md) | **Complementary:** Cycle indicators | **Trading note:** Ehlers' roofing filter; combines high-pass + super smoother. Isolates tradeable cycle band.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **Roofing Filter** is John Ehlers' bandpass architecture designed specifically for oscillator construction. It cascades a 2nd-order Butterworth Highpass (to strip trend) with a Super Smoother Lowpass (to strip noise), passing only the cyclic energy within a user-defined frequency band. The output oscillates around zero, with zero crossings serving as directional signals.
|
||||
@@ -163,4 +161,4 @@ Roofing.Batch(prices, output, hpLength: 48, ssLength: 10);
|
||||
var source = new TSeries();
|
||||
var roofingChained = new Roofing(source, hpLength: 48, ssLength: 10);
|
||||
source.Add(new TValue(DateTime.UtcNow, price)); // roofingChained.Last auto-updates
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [sgf_signature](sgf_signature.md) |
|
||||
|
||||
- SGF (Savitzky-Golay Filter) is a digital signal processing technique that smoothes data by fitting successive sub-sets of adjacent data points with...
|
||||
- Parameterized by `period`, `polyorder` (default 2).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Loess](../loess/Loess.md), [NW](../nw/Nw.md) | **Complementary:** Polynomial order selection | **Trading note:** Savitzky-Golay filter; polynomial smoothing preserving higher moments. Good for derivative estimation.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
SGF (Savitzky-Golay Filter) is a digital signal processing technique that smoothes data by fitting successive sub-sets of adjacent data points with a low-degree polynomial by the method of linear least squares. Unlike standard moving averages that simply average the points, SGF preserves higher moments of the data distribution, such as the area, center of gravity, and line width. This makes it exceptionally good at preserving features of the distribution such as relative maxima and minima and width, which are usually flattened by other smoothing techniques.
|
||||
@@ -124,4 +122,4 @@ var result = sgf.Update(new TValue(DateTime.UtcNow, 100.0));
|
||||
Sgf.Calculate(inputSpan, outputSpan, period: 21, polyOrder: 4);
|
||||
|
||||
// Chainable using TValuePublisher
|
||||
var sgf = new Sgf(source, period: 14);
|
||||
var sgf = new Sgf(source, period: 14);
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [spbf.pine](spbf.pine) |
|
||||
|
||||
- The **Super Passband Filter** is John Ehlers' wide-band bandpass constructed by differencing two z-transformed EMAs with Ehlers-style smoothing ($\...
|
||||
- Parameterized by `shortperiod` (default 40), `longperiod` (default 60), `rmsperiod` (default 50).
|
||||
- Output range: Oscillates around zero.
|
||||
- Requires `max(longPeriod, rmsPeriod)` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Bilateral](../bilateral/Bilateral.md), [RMed](../rmed/Rmed.md) | **Complementary:** ATR for volatility context | **Trading note:** Spectral bilateral filter; edge-preserving smoother in frequency domain.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The **Super Passband Filter** is John Ehlers' wide-band bandpass constructed by differencing two z-transformed EMAs with Ehlers-style smoothing ($\alpha = 5/N$). It rejects both DC trend and high-frequency noise, passing only the cyclic energy between two EMA-defined cutoff frequencies. The output oscillates around zero, with an RMS trigger envelope providing signal/noise discrimination.
|
||||
@@ -183,4 +181,4 @@ Spbf.BatchWithRms(prices, pb, rms, shortPeriod: 40, longPeriod: 60, rmsPeriod: 5
|
||||
var source = new TSeries();
|
||||
var spbfChained = new Spbf(source, shortPeriod: 40, longPeriod: 60, rmsPeriod: 50);
|
||||
source.Add(new TValue(DateTime.UtcNow, price)); // spbfChained.Last auto-updates
|
||||
```
|
||||
```
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [ssf2_signature](ssf2_signature.md) |
|
||||
|
||||
- The 2-Pole Super Smooth Filter (SSF2) is a 2-pole Butterworth filter designed by John Ehlers.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [SSF3](../ssf3/Ssf3.md), [Butter2](../butter2/Butter2.md) | **Complementary:** HPF for cycle extraction | **Trading note:** Ehlers' 2-pole Super Smoother; superior to EMA with less lag for same smoothness.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The 2-Pole Super Smooth Filter (SSF2) is a 2-pole Butterworth filter designed by John Ehlers. It offers superior noise reduction compared to standard moving averages while maintaining minimal lag. By using complex conjugate poles, it achieves a "maximally flat" response in the passband, meaning it preserves the trend signal with high fidelity while aggressively suppressing high-frequency noise.
|
||||
@@ -103,4 +101,4 @@ Batch throughput: ~16 cy/bar.
|
||||
### Common Pitfalls
|
||||
|
||||
1. **Initialization**: The filter requires a few bars to stabilize. Per Ehlers' design, the output is set to the input price for the first 4 bars.
|
||||
2. **Period Selection**: Unlike an SMA, the "Period" $N$ in SSF2 refers to the cutoff wavelength. A period of 10 means it filters out cycles shorter than 10 bars. It is roughly comparable to an EMA of the same length but smoother.
|
||||
2. **Period Selection**: Unlike an SMA, the "Period" $N$ in SSF2 refers to the cutoff wavelength. A period of 10 means it filters out cycles shorter than 10 bars. It is roughly comparable to an EMA of the same length but smoother.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [ssf3_signature](ssf3_signature.md) |
|
||||
|
||||
- The 3-Pole Super Smoother Filter (SSF3) extends Ehlers' Super Smoother concept to third order, providing -60 dB/decade rolloff compared to -40 dB/d...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `6 * period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [SSF2](../ssf2/Ssf2.md), [Butter3](../butter3/Butter3.md) | **Complementary:** Cycle analysis | **Trading note:** Ehlers' 3-pole Super Smoother; even smoother than 2-pole but more lag.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The 3-Pole Super Smoother Filter (SSF3) extends Ehlers' Super Smoother concept to third order, providing -60 dB/decade rolloff compared to -40 dB/decade for the 2-pole variant (SSF2). It shares identical pole placement with BUTTER3 but uses a single-sample feedforward (`coef1 * x`) instead of the binomial-weighted 4-sample average (`coef1 * (x + 3x1 + 3x2 + x3)`). This makes SSF3 more responsive to recent price changes while still delivering aggressive high-frequency noise suppression.
|
||||
@@ -140,4 +138,4 @@ Ssf3.Batch(sourceSpan, destSpan, period: 20, initialLast: double.NaN);
|
||||
## References
|
||||
|
||||
* Ehlers, John F. "Cybernetic Analysis for Stocks and Futures." Wiley, 2004.
|
||||
* Ehlers, John F. "Rocket Science for Traders." Wiley, 2001.
|
||||
* Ehlers, John F. "Rocket Science for Traders." Wiley, 2001.
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [usf_signature](usf_signature.md) |
|
||||
|
||||
- The Ultimate Smoother Filter (USF) is a zero-lag smoothing filter introduced by John Ehlers in the April 2024 issue of *Technical Analysis of Stock...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [SSF2](../ssf2/Ssf2.md), [Kalman](../kalman/Kalman.md) | **Complementary:** ATR for volatility | **Trading note:** Universal Smoothing Filter; combines multiple filter approaches adaptively.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Ultimate Smoother Filter (USF) is a zero-lag smoothing filter introduced by John Ehlers in the April 2024 issue of *Technical Analysis of Stocks & Commodities*. It builds upon the Super Smoother Filter (SSF) by using a high-pass filter to remove high-frequency noise, leaving a smooth low-frequency component with minimal lag.
|
||||
@@ -119,4 +117,4 @@ Console.WriteLine($"Current USF: {usf.Last.Value}");
|
||||
|
||||
// Use in a TSeries chain
|
||||
var source = new TSeries();
|
||||
var usfSeries = new Usf(source, 20);
|
||||
var usfSeries = new Usf(source, 20);
|
||||
@@ -13,9 +13,7 @@
|
||||
| **PineScript** | [voss.pine](voss.pine) |
|
||||
|
||||
- The Voss Predictive Filter is a two-stage signal processing pipeline that extracts a dominant cycle from noisy price data and then predicts its fut...
|
||||
- Parameterized by `period` (default 20), `predict` (default 3), `bandwidth` (default 0.25).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [BPF](../bpf/Bpf.md), [Roofing](../roofing/Roofing.md) | **Complementary:** Cycle period indicators | **Trading note:** Voss predictive filter; attempts to predict the next cycle value. Zero-lag by design.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -182,4 +180,4 @@ source.Add(new TValue(DateTime.UtcNow, 100.0));
|
||||
|
||||
1. Ehlers, J. F. "A Peek Into the Future." *Technical Analysis of Stocks and Commodities*, August 2019.
|
||||
2. Voss, H. U. "Anticipating chaotic synchronization." *Physical Review E*, 61(5), 2000.
|
||||
3. Ehlers, J. F. *Cycle Analytics for Traders*. Wiley, 2013.
|
||||
3. Ehlers, J. F. *Cycle Analytics for Traders*. Wiley, 2013.
|
||||
@@ -15,9 +15,7 @@
|
||||
|
||||
|
||||
- The Wavelet Denoising Filter applies an *à trous* (with holes) Haar wavelet decomposition with soft thresholding to remove high-frequency noise fro...
|
||||
- Parameterized by `levels` (default 4), `threshmult` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- Requires `2^levels` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [SGF](../sgf/Sgf.md), [Modf](../modf/Modf.md) | **Complementary:** Multi-timeframe analysis | **Trading note:** Wavelet denoising; multi-resolution analysis separates signal at different time scales.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Introduction
|
||||
@@ -180,4 +178,4 @@ Wavelet denoising has no direct equivalent in standard TA libraries. Validation
|
||||
- Holschneider, M., Kronland-Martinet, R., Morlet, J. & Tchamitchian, P. (1989). "A Real-Time Algorithm for Signal Analysis with the Help of the Wavelet Transform." In *Wavelets: Time-Frequency Methods and Phase Space*, Springer.
|
||||
- Mallat, S. (2009). *A Wavelet Tour of Signal Processing: The Sparse Way*. 3rd ed. Academic Press.
|
||||
- Nason, G.P. (2008). *Wavelet Methods in Statistics with R*. Springer.
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. (Context for financial signal processing filters.)
|
||||
- Ehlers, J.F. (2001). *Rocket Science for Traders*. Wiley. (Context for financial signal processing filters.)
|
||||
@@ -14,9 +14,7 @@
|
||||
| **Signature** | [wiener_signature](wiener_signature.md) |
|
||||
|
||||
- The Wiener Filter is an optimal linear filter that attempts to minimize the mean square error between the estimated random process and the desired ...
|
||||
- Parameterized by `period`, `smoothperiod` (default 10).
|
||||
- Output range: Tracks input.
|
||||
- Requires `Math.Max(period, smoothPeriod)` bars of warmup before first valid output (IsHot = true).
|
||||
- **Similar:** [Kalman](../kalman/Kalman.md), [RLS](../rls/Rls.md) | **Complementary:** Noise estimation | **Trading note:** Wiener filter; optimal linear filter minimizing MSE. Assumes stationary signals.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
The Wiener Filter is an optimal linear filter that attempts to minimize the mean square error between the estimated random process and the desired process. In the context of technical analysis, it acts as an adaptive smoothing filter that adjusts its responsiveness based on the local statistical properties of the data (signal-to-noise ratio). When the signal variance is high relative to noise variance, the filter follows the input closely. When noise dominates, it smooths aggressively.
|
||||
@@ -120,4 +118,4 @@ var result = wiener.Update(new TValue(DateTime.UtcNow, 100.0));
|
||||
|
||||
// 3. Access results
|
||||
Console.WriteLine($"Filter Value: {result.Value}");
|
||||
Console.WriteLine($"Is Hot: {wiener.IsHot}");
|
||||
Console.WriteLine($"Is Hot: {wiener.IsHot}");
|
||||
Reference in New Issue
Block a user