mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 09:38:05 +00:00
feat(dynamics): add PlusDI, MinusDI, PlusDM, MinusDM indicators
Complete thin Dx-composition wrapper indicators with full test coverage: - PlusDi/MinusDi: Directional Indicator wrappers (DiPlus/DiMinus from Dx) - PlusDm/MinusDm: Directional Movement wrappers (DmPlus/DmMinus from Dx) - Individual validation tests per indicator directory (TALib, Skender, bounds) - Combined unit tests (DiDm.Tests.cs) and validation tests (DiDm.Validation.Tests.cs) - Quantower wrappers + tests for all 4 indicators - PineScript v6 implementations with compensated RMA - Normalized .md documentation for all indicators and categories - 182 tests passing, 0 failures
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
# Trends (IIR)
|
||||
|
||||
> "Recursion trades memory for computation. Single coefficient replaces entire window. But feedback loop carries risk: instability lurks in coefficient choices that FIR designers never face."
|
||||
|
||||
Trend indicators based on Infinite Impulse Response (IIR) filters. Recursive architecture uses previous outputs to compute current values, enabling lower lag with fewer coefficients than equivalent FIR filters.
|
||||
|
||||
| Indicator | Full Name | Description |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ADXVMA: ADX Variable Moving Average
|
||||
|
||||
> *Use ADX to measure trend strength, then feed that measurement back as the smoothing constant. When the trend is strong, track fast. When it is not, stand still. The market tells you how much to listen.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `period * 2` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Use ADX to measure trend strength, then feed that measurement back as the smoothing constant. When the trend is strong, track fast. When it is not, stand still. The market tells you how much to listen."
|
||||
|
||||
ADXVMA is an adaptive IIR filter that uses the Average Directional Index (ADX) as its smoothing constant. When ADX is high (strong trend), the smoothing factor approaches 1.0 and the filter tracks price aggressively. When ADX is low (range-bound), the smoothing factor approaches 0.0 and the filter barely moves. This creates a moving average that automatically switches between responsive trend-following and noise-immune range-holding without external regime detection.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# AHRENS: Ahrens Moving Average
|
||||
|
||||
> *Richard Ahrens looked at the EMA and thought: what if the correction term accounted for where the average was, not just where it is? The result is a self-referencing IIR filter that uses its own history as a stabilizer.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Richard Ahrens looked at the EMA and thought: what if the correction term accounted for where the average was, not just where it is? The result is a self-referencing IIR filter that uses its own history as a stabilizer."
|
||||
|
||||
AHRENS is a recursive IIR filter that adjusts toward the source price minus the midpoint of its current and lagged (by one period) states. The formula $\text{AHRENS}_t = \text{AHRENS}_{t-1} + (\text{source} - \frac{\text{AHRENS}_{t-1} + \text{AHRENS}_{t-N}}{2}) / N$ creates a self-dampening feedback loop: the correction term shrinks as the current and lagged states converge, producing a smoother approach to equilibrium than a standard EMA with less tendency to overshoot on reversals.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# CORAL — Coral Trend Filter
|
||||
|
||||
> *Coral blends multiple EMA stages with tunable smoothing, producing a trend line that bends without breaking.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DECYCLER: Ehlers Decycler
|
||||
|
||||
> *The trend is what remains when you stop looking for cycles.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The trend is what remains when you stop looking for cycles."
|
||||
|
||||
The Ehlers Decycler extracts the trend component from a price series by subtracting a 2-pole Butterworth high-pass filter from the source signal. Where most moving averages blur the boundary between trend and cycle, the Decycler defines it with a frequency-domain cutoff: cycles shorter than the specified period are removed, everything longer stays. The result is an overlay that hugs price with near-zero lag during trends and rejects short-term oscillations without the smoothing artifacts of convolution-based averages.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# DEMA: Double Exponential Moving Average
|
||||
|
||||
> "EMA is good. DEMA is better. It's like an EMA that drank a double espresso and stopped lagging behind the conversation."
|
||||
> *EMA is good. DEMA is better. It's like an EMA that drank a double espresso and stopped lagging behind the conversation.*
|
||||
|
||||
## Quick Reference
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DSMA: Deviation-Scaled Moving Average
|
||||
|
||||
> *When the market screams, DSMA sprints. When it whispers, DSMA crawls. An adaptive moving average that lets volatility dictate the pace.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "When the market screams, DSMA sprints. When it whispers, DSMA crawls. An adaptive moving average that lets volatility dictate the pace."
|
||||
|
||||
DSMA (Deviation-Scaled Moving Average) is a volatility-adaptive trend filter that combines a Super Smoother (2-pole Butterworth IIR filter) with RMS-based deviation scaling. Unlike fixed-period moving averages that treat all market conditions identically, DSMA adjusts its responsiveness based on measured volatility—accelerating when trends are strong and decelerating when prices consolidate.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# EMA: Exponential Moving Average
|
||||
|
||||
> "The SMA drops an old price, the average jumps, the signal fires, the market does something unhelpful. The EMA exists because someone finally asked: what if old data just... mattered less?"
|
||||
> *The SMA drops an old price, the average jumps, the signal fires, the market does something unhelpful. The EMA exists because someone finally asked: what if old data just... mattered less?*
|
||||
|
||||
## Quick Reference
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# FRAMA: Ehlers Fractal Adaptive Moving Average
|
||||
|
||||
> *Markets do not move at one speed. FRAMA listens to the roughness and adjusts the filter.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `pe` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Markets do not move at one speed. FRAMA listens to the roughness and adjusts the filter."
|
||||
|
||||
FRAMA is John Ehlers' fractal adaptive moving average. It estimates a fractal dimension from high and low ranges, then converts that dimension into a dynamic EMA alpha. The result is a moving average that tightens in trends and relaxes in noise.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# GDEMA: Generalized Double Exponential Moving Average
|
||||
|
||||
> *Patrick Mulloy created DEMA to cancel first-order lag. GDEMA adds a volume knob: turn it past 1 and you cancel more lag than Mulloy thought possible. Turn it to 0 and you are back to a plain EMA. The generalization is the point.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Patrick Mulloy created DEMA to cancel first-order lag. GDEMA adds a volume knob: turn it past 1 and you cancel more lag than Mulloy thought possible. Turn it to 0 and you are back to a plain EMA. The generalization is the point."
|
||||
|
||||
GDEMA extends the standard DEMA (Double Exponential Moving Average) with a tunable gain factor $v$ that controls the aggressiveness of lag compensation. The formula $\text{GDEMA} = (1+v) \cdot \text{EMA}_1 - v \cdot \text{EMA}_2$ reduces to plain EMA when $v=0$, standard DEMA when $v=1$, and progressively more aggressive lag removal for $v>1$. This parametric flexibility allows traders to dial in the exact smoothness-responsiveness trade-off for their application, rather than being locked into DEMA's fixed 2:1 ratio.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# HEMA: Hull Exponential Moving Average
|
||||
|
||||
> *HMA is a topology. HEMA keeps the topology and swaps the physics: windows to decay, with identical lag.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `EstimateWarmupPeriod()` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "HMA is a topology. HEMA keeps the topology and swaps the physics: windows to decay, with identical lag."
|
||||
|
||||
## An EMA-domain analog of HMA with WMA-lag-matched alphas
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# HOLT: Holt Exponential Moving Average
|
||||
|
||||
> *Single smoothing tracks level. Double smoothing tracks trend. The elegance is not in complexity but in the admission that yesterday's direction matters.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Single smoothing tracks level. Double smoothing tracks trend. The elegance is not in complexity but in the admission that yesterday's direction matters." — Charles C. Holt (1957)
|
||||
|
||||
## Overview
|
||||
|
||||
Holt's exponential smoothing extends simple exponential smoothing (EMA) by adding a second equation that explicitly tracks the local trend. The result is a 1-step-ahead forecast that adapts to both the level and direction of the time series. When applied to financial data, HOLT produces a trend-following line that anticipates price continuation rather than merely reacting to it.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# HTIT: Ehlers Hilbert Transform Instantaneous Trend (also known as HT_TRENDLINE)
|
||||
|
||||
> *John Ehlers brought rocket science to trading. Literally. HTIT uses signal processing to find the trend by removing the cycle. It's not smoothing; it's extraction.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -18,8 +20,6 @@
|
||||
- Requires `12` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "John Ehlers brought rocket science to trading. Literally. HTIT uses signal processing to find the trend by removing the cycle. It's not smoothing; it's extraction."
|
||||
|
||||
HTIT (Hilbert Transform Instantaneous Trend) is a trend-following indicator that doesn't rely on simple averaging. Instead, it uses the Hilbert Transform to measure the dominant cycle period of the market and then computes a trendline that filters out that specific cycle. It adapts to the market's rhythm rather than imposing a fixed period.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# HWMA: Holt-Winters Moving Average
|
||||
|
||||
> *Triple exponential smoothing: because sometimes tracking level, velocity, and acceleration is exactly what a price series needs—and sometimes it's overkill. Holt and Winters figured this out for inventory forecasting in the 1950s. Traders rediscovered it decades later.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Triple exponential smoothing: because sometimes tracking level, velocity, and acceleration is exactly what a price series needs—and sometimes it's overkill. Holt and Winters figured this out for inventory forecasting in the 1950s. Traders rediscovered it decades later."
|
||||
|
||||
HWMA is an Infinite Impulse Response (IIR) filter that applies triple exponential smoothing with level (F), velocity (V), and acceleration (A) components. Unlike simple exponential smoothing which only tracks the current level, HWMA anticipates future values by extrapolating trend and trend changes.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# JMA: Jurik Moving Average
|
||||
|
||||
> *The spectral approach isn't marketing. It's the difference between guessing at volatility and measuring it.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The spectral approach isn't marketing. It's the difference between guessing at volatility and measuring it."
|
||||
|
||||
JMA (Jurik Moving Average) is Mark Jurik's flagship adaptive smoother, recovered through decompilation of his proprietary AmiBroker/MetaTrader binaries. Unlike forum-sourced approximations that use exponential volatility smoothing, this implementation maintains a 128-bar volatility distribution and applies percentile trimming to derive a robust reference. The result: identical behavior to Jurik's commercial software within floating-point tolerance, including spike rejection during 3-sigma events where approximations diverge by 3-4%.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# KAMA: Kaufman's Adaptive Moving Average
|
||||
|
||||
> *Perry Kaufman asked a simple question: 'Why should I use the same smoothing in a trending market as in a chopping market?' KAMA is the answer.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Perry Kaufman asked a simple question: 'Why should I use the same smoothing in a trending market as in a chopping market?' KAMA is the answer."
|
||||
|
||||
KAMA (Kaufman's Adaptive Moving Average) is an intelligent moving average that adjusts its smoothing speed based on market noise. When the price is moving steadily (high signal-to-noise ratio), KAMA speeds up to capture the trend. When the price is chopping sideways (low signal-to-noise ratio), KAMA slows down to filter out the noise.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# LEMA: Leader Exponential Moving Average
|
||||
|
||||
> *George Siligardos asked a simple question: what if you smoothed the EMA's own error and added it back? The answer is a moving average that leads price changes instead of lagging behind them. The error becomes the signal.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "George Siligardos asked a simple question: what if you smoothed the EMA's own error and added it back? The answer is a moving average that leads price changes instead of lagging behind them. The error becomes the signal."
|
||||
|
||||
LEMA (Leader EMA) adds a smoothed error correction to the standard EMA, creating a moving average that anticipates price movement. The formula $\text{LEMA} = \text{EMA}(x, N) + \text{EMA}(x - \text{EMA}(x, N), N)$ decomposes price into a smooth component (EMA) and an error component (residual), then re-smooths the error and adds it back. The re-smoothed error represents the systematic part of the EMA's tracking deficit, and adding it back shifts the output toward where the next price is likely to be.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# LTMA: Linear Trend Moving Average
|
||||
|
||||
> "Estimate the level. Estimate the slope. Project forward. It is the same trick radar operators use to track aircraft, applied to price data."
|
||||
> *Estimate the level. Estimate the slope. Project forward. It is the same trick radar operators use to track aircraft, applied to price data.*
|
||||
|
||||
<!-- QUICK REFERENCE CARD (scan in 5 seconds) -->
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MAMA: Ehlers MESA Adaptive Moving Average
|
||||
|
||||
> *John Ehlers again. This time, he built a moving average that doesn't just adapt to volatility—it adapts to the phase of the market cycle. It's like having a GPS for your trend.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -18,8 +20,6 @@
|
||||
- Requires `50` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "John Ehlers again. This time, he built a moving average that doesn't just adapt to volatility—it adapts to the phase of the market cycle. It's like having a GPS for your trend."
|
||||
|
||||
MAMA (MESA Adaptive Moving Average) is a unique adaptive moving average that uses the Hilbert Transform to determine the phase rate of change of the market cycle. It produces two outputs: MAMA (the adaptive average) and FAMA (Following Adaptive Moving Average), which acts as a slower, confirming signal.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MAVP: Moving Average Variable Period
|
||||
|
||||
> *You can't fix your moving average period because the market doesn't run at a fixed frequency. MAVP stops pretending it does.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `maxPeriod` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "You can't fix your moving average period because the market doesn't run at a fixed frequency. MAVP stops pretending it does."
|
||||
|
||||
## Introduction
|
||||
|
||||
MAVP applies an EMA-style exponential smoothing where the period -- and therefore the smoothing constant alpha -- changes on every bar. Each bar receives an externally supplied period value, clamped to [minPeriod, maxPeriod], producing `alpha = 2 / (period + 1)`. The result is a single-pass O(1) IIR filter with an adaptive warmup compensator that tracks the cumulative product of all per-bar `(1 - alpha)` values. With a fixed period MAVP reduces exactly to standard EMA (validated to 1e-9 tolerance against Skender and TA-Lib EMA). With a time-varying period series, it becomes a general-purpose adaptive smoother controlled entirely by external logic.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MCNMA: McNicholl EMA (Zero-Lag TEMA)
|
||||
|
||||
> *Dennis McNicholl applied TEMA to itself and subtracted the result, producing six cascaded EMA stages that cancel lag through three layers of triple-smoothing. When single TEMA is not enough, double it.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Dennis McNicholl applied TEMA to itself and subtracted the result, producing six cascaded EMA stages that cancel lag through three layers of triple-smoothing. When single TEMA is not enough, double it."
|
||||
|
||||
MCNMA computes $2 \times \text{TEMA}(x, N) - \text{TEMA}(\text{TEMA}(x, N), N)$, applying the DEMA lag-cancellation technique to TEMA itself. This requires six cascaded EMA stages: three for the inner TEMA and three for the outer TEMA of the inner TEMA's output. The result is an extremely responsive moving average that tracks fast trends with minimal lag, at the cost of significant overshoot on reversals. Published by Dennis McNicholl in "Better Bollinger Bands" (*Futures Magazine*, October 1998) as a component for improved volatility band construction.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MGDI: McGinley Dynamic Indicator
|
||||
|
||||
> *John McGinley saw moving averages failing in fast markets and said, 'It's not the market's fault, it's the math's fault.' MGDI is the apology.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "John McGinley saw moving averages failing in fast markets and said, 'It's not the market's fault, it's the math's fault.' MGDI is the apology."
|
||||
|
||||
MGDI (McGinley Dynamic Indicator) looks like a moving average but operates on a fundamentally different principle. Rather than using a fixed smoothing factor, it dynamically adjusts based on the ratio between price and the indicator's current value. The result is a filter that accelerates to catch breakouts while decelerating to avoid overshooting reversals—a behavior that fixed-alpha filters cannot achieve.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MMA: Modified Moving Average
|
||||
|
||||
> *MMA is a compromise: less lag than SMA, less overshoot than fully weighted filters. It's what you get when an SMA and a WMA have a carefully engineered offspring.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "MMA is a compromise: less lag than SMA, less overshoot than fully weighted filters. It's what you get when an SMA and a WMA have a carefully engineered offspring."
|
||||
|
||||
MMA (Modified Moving Average) uses a **simple mean** as a baseline, then adds a **weighted correction** based on the position of values within the buffer. The weighting tilts toward newer bars without fully discarding older ones, creating a filter that sits between SMA (equal weights) and WMA (linear weights) in both lag and smoothness characteristics.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# NMA: Natural Moving Average
|
||||
|
||||
> *Jim Sloman looked at how volatility distributes across a window and asked: if the most volatile bars are recent, should the filter not respond faster? NMA derives its smoothing constant from the volatility profile itself, weighted by a square-root kernel that emphasizes recent action.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Jim Sloman looked at how volatility distributes across a window and asked: if the most volatile bars are recent, should the filter not respond faster? NMA derives its smoothing constant from the volatility profile itself, weighted by a square-root kernel that emphasizes recent action."
|
||||
|
||||
NMA is an adaptive IIR filter whose smoothing ratio is derived from a volatility-weighted square-root kernel analysis of log-price movements over a lookback window. When volatility concentrates in recent bars, the ratio approaches 1.0 (fast tracking). When volatility is spread uniformly, the ratio approaches $1/\sqrt{N}$ (heavy smoothing). The square-root kernel $(\sqrt{i+1} - \sqrt{i})$ gives a concave-down weighting that gently emphasizes recency, while the log-price transformation normalizes for price level, making the adaptation scale-invariant.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# QEMA: Quad Exponential Moving Average
|
||||
|
||||
> *Four EMAs walk into a bar. The first one's slow and thoughtful. The fourth one's practically twitching. Together, they somehow produce a signal that's both smooth and responsive. The bartender asks, 'How did you achieve zero lag?' They reply, 'Constrained quadratic optimization.' The bartender pours them a free drink.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Four EMAs walk into a bar. The first one's slow and thoughtful. The fourth one's practically twitching. Together, they somehow produce a signal that's both smooth and responsive. The bartender asks, 'How did you achieve zero lag?' They reply, 'Constrained quadratic optimization.' The bartender pours them a free drink."
|
||||
|
||||
QEMA (Quad Exponential Moving Average) is a zero-lag smoothing filter that cascades four EMAs with geometrically ramped alphas and combines them using minimum-energy weights. Unlike traditional multi-stage EMAs (DEMA, TEMA) that use fixed coefficients, QEMA solves for weights that explicitly eliminate DC lag while minimizing output variance. The result is a filter that tracks linear trends with zero group delay while suppressing high-frequency noise more effectively than standard EMA cascades.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# REMA: Regularized Exponential Moving Average
|
||||
|
||||
> *Someone looked at the EMA and thought: 'What if we punished it for changing its mind?' The result is REMA—an EMA with a conscience that remembers where it was going and resists the temptation to chase every price wiggle.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Someone looked at the EMA and thought: 'What if we punished it for changing its mind?' The result is REMA—an EMA with a conscience that remembers where it was going and resists the temptation to chase every price wiggle."
|
||||
|
||||
REMA (Regularized Exponential Moving Average) combines exponential smoothing with a regularization term that penalizes deviations from the previous trend direction. The result is a filter that responds to genuine price movements while suppressing noise-induced oscillations. Think of it as an EMA with momentum awareness: it knows where it was heading and applies a penalty for sudden course corrections.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# RGMA: Recursive Gaussian Moving Average
|
||||
|
||||
> *The statisticians wanted Gaussian smoothing. The HFT folks wanted O(1) updates. RGMA splits the difference: chain enough cheap EMAs together and the impulse response starts looking suspiciously bell-shaped. It's not real Gaussian—but the market doesn't know that.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The statisticians wanted Gaussian smoothing. The HFT folks wanted O(1) updates. RGMA splits the difference: chain enough cheap EMAs together and the impulse response starts looking suspiciously bell-shaped. It's not real Gaussian—but the market doesn't know that."
|
||||
|
||||
RGMA (Recursive Gaussian Moving Average) approximates Gaussian smoothing by cascading multiple identical exponential moving averages. Each pass through an EMA filter smooths the signal further, and the mathematical magic is that cascaded low-pass filters push the impulse response toward a Gaussian-like shape. You get the desirable properties of Gaussian smoothing—smooth frequency roll-off, minimal ringing, symmetric lag—without the computational cost of a true FIR convolution.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# RMA: Running Moving Average
|
||||
|
||||
> *Wilder didn't like standard EMA weighting. He wanted history to decay slower. So he invented RMA, which is just EMA with a different alpha, confusing traders for 40 years.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `ema.WarmupPeriod` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Wilder didn't like standard EMA weighting. He wanted history to decay slower. So he invented RMA, which is just EMA with a different alpha, confusing traders for 40 years."
|
||||
|
||||
The Running Moving Average (RMA), also known as the Smoothed Moving Average (SMMA) or Wilder's Moving Average, is the backbone of J. Welles Wilder's most famous indicators: RSI, ATR, and ADX. It is functionally identical to an Exponential Moving Average (EMA), but with a smoothing factor ($\alpha$) of $1/N$ instead of $2/(N+1)$. This results in a longer "memory" and slower decay than a standard EMA of the same period.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# T3: Tillson T3 Moving Average
|
||||
|
||||
> *If one EMA is good, six must be better. Tim Tillson's logic is impeccable, provided you hate noise more than you love latency.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period * 6` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "If one EMA is good, six must be better. Tim Tillson's logic is impeccable, provided you hate noise more than you love latency."
|
||||
|
||||
The T3 Moving Average is a hyper-smooth, low-lag filter that cascades six Exponential Moving Averages (EMAs). Unlike standard cascading (which increases lag), T3 uses a "Volume Factor" ($v$) to weight the EMAs in a way that partially cancels out the lag, resulting in a curve that is smoother than an EMA but more responsive than an SMA.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# TEMA: Triple Exponential Moving Average
|
||||
|
||||
> "Patrick Mulloy looked at the lag of an EMA and took it personally. TEMA is what happens when you apply algebra to impatience."
|
||||
> *Patrick Mulloy looked at the lag of an EMA and took it personally. TEMA is what happens when you apply algebra to impatience.*
|
||||
|
||||
<!-- QUICK REFERENCE CARD (scan in 5 seconds) -->
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# TRAMA: Trend Regularity Adaptive Moving Average
|
||||
|
||||
> *LuxAlgo counted how often price makes new highs and new lows within a window, squared that fraction, and used it as an EMA smoothing constant. Trending markets produce frequent HH/LLs and the filter tracks fast. Ranging markets produce few, and the filter stops moving. Simple, effective, elegant.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "LuxAlgo counted how often price makes new highs and new lows within a window, squared that fraction, and used it as an EMA smoothing constant. Trending markets produce frequent HH/LLs and the filter tracks fast. Ranging markets produce few, and the filter stops moving. Simple, effective, elegant."
|
||||
|
||||
TRAMA is an adaptive EMA where the smoothing factor derives from the "trend regularity" of the lookback window, measured as the fraction of bars that produce either a new highest-high (HH) or a new lowest-low (LL). This fraction is squared to create a convex penalty: low regularity (ranging) produces near-zero smoothing (filter barely moves), while high regularity (trending) produces aggressive smoothing (filter tracks closely). Developed by LuxAlgo (TradingView, December 2020).
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# VAMA: Volatility Adjusted Moving Average
|
||||
|
||||
> *The market doesn't care about your moving average period. VAMA returns the favor by not caring about a fixed period either.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The market doesn't care about your moving average period. VAMA returns the favor by not caring about a fixed period either."
|
||||
|
||||
## The Core Insight
|
||||
|
||||
Most moving averages use a fixed lookback period. VAMA takes a different approach: it dynamically adjusts its effective period based on current market volatility relative to historical norms. When short-term volatility exceeds long-term volatility (high activity), VAMA shortens its period for faster response. When volatility contracts (quiet markets), it lengthens the period for smoother output.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# VIDYA: Variable Index Dynamic Average
|
||||
|
||||
> *Tushar Chande asked: 'Why should I trust a moving average that treats a market crash the same as a lunch break?' VIDYA is the answer.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Tushar Chande asked: 'Why should I trust a moving average that treats a market crash the same as a lunch break?' VIDYA is the answer."
|
||||
|
||||
The Variable Index Dynamic Average (VIDYA) is an adaptive moving average that automatically adjusts its smoothing speed based on market volatility. When the market is trending (high volatility), VIDYA speeds up to capture the move. When the market is ranging (low volatility), it slows down to filter out the noise.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# YZVAMA: Yang-Zhang Volatility Adjusted Moving Average
|
||||
|
||||
> *ATR tells you how much the market moved. Yang-Zhang tells you how much it *should* have moved given the gaps and intrabar action. YZVAMA uses that distinction to know when the market is lying about its volatility.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires 1 bar of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "ATR tells you how much the market moved. Yang-Zhang tells you how much it *should* have moved given the gaps and intrabar action. YZVAMA uses that distinction to know when the market is lying about its volatility."
|
||||
|
||||
## The Core Insight
|
||||
|
||||
Most adaptive moving averages measure volatility using close-to-close changes (standard deviation) or high-low ranges (ATR). Both approaches miss a critical market dynamic: overnight gaps. A stock that gaps up 5% at the open but closes unchanged shows zero close-to-close volatility, yet anyone trading that day felt every point of that 5% move.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ZLDEMA: Zero-Lag Double Exponential Moving Average
|
||||
|
||||
> *ZLDEMA combines the speed of zero-lag prediction with the smoothness of double exponential averaging. You get faster response than ZLEMA, with better trend-following than DEMA.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "ZLDEMA combines the speed of zero-lag prediction with the smoothness of double exponential averaging. You get faster response than ZLEMA, with better trend-following than DEMA."
|
||||
|
||||
## DEMA with lag compensation via a zero-lag signal
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ZLEMA: Zero-Lag Exponential Moving Average
|
||||
|
||||
> *ZLEMA does not erase lag. It predicts just enough to act early, then pays the price in overshoot.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "ZLEMA does not erase lag. It predicts just enough to act early, then pays the price in overshoot."
|
||||
|
||||
## EMA with lag compensation via a zero-lag signal
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ZLTEMA: Zero-Lag Triple Exponential Moving Average
|
||||
|
||||
> *ZLTEMA combines the speed of zero-lag prediction with the smoothness of triple exponential averaging. You get the fastest response in the zero-lag family, with the best noise rejection from the TEMA cascade.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
@@ -17,8 +19,6 @@
|
||||
- Requires `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "ZLTEMA combines the speed of zero-lag prediction with the smoothness of triple exponential averaging. You get the fastest response in the zero-lag family, with the best noise rejection from the TEMA cascade."
|
||||
|
||||
## TEMA with lag compensation via a zero-lag signal
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user