mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 01:58:06 +00:00
doc headers
This commit is contained in:
@@ -1,4 +1,21 @@
|
||||
# ADXVMA: ADX Variable Moving Average
|
||||
# ADXVMA: ADX Variable Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | OHLCV bar (TBar) |
|
||||
| **Parameters** | `period` (default 14) |
|
||||
| **Outputs** | Single series (Adxvma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period * 2` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- ADXVMA is an adaptive IIR filter that uses the Average Directional Index (ADX) as its smoothing constant.
|
||||
- Parameterized by `period` (default 14).
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# AHRENS: Ahrens Moving Average
|
||||
# AHRENS: Ahrens Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 9) |
|
||||
| **Outputs** | Single series (Ahrens) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- AHRENS is a recursive IIR filter that adjusts toward the source price minus the midpoint of its current and lagged (by one period) states.
|
||||
- Parameterized by `period` (default 9).
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# CORAL — Coral Trend Filter
|
||||
# CORAL — Coral Trend Filter
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `cd` (default 0.4) |
|
||||
| **Outputs** | Single series (Coral) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The **Coral** filter is a smooth, low-lag trend indicator that chains six cascaded EMA passes and combines stages 3–6 using polynomial coefficients...
|
||||
- Parameterized by `period`, `cd` (default 0.4).
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# DECYCLER: Ehlers Decycler
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 60) |
|
||||
| **Outputs** | Single series (Decycler) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The Ehlers Decycler extracts the trend component from a price series by subtracting a 2-pole Butterworth high-pass filter from the source signal.
|
||||
- Parameterized by `period` (default 60).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# DEMA: Double Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Dema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- DEMA (Double Exponential Moving Average) is not just "two EMAs." It's a clever mathematical hack to cancel out the lag inherent in a standard EMA.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "EMA is good. DEMA is better. It's like an EMA that drank a double espresso and stopped lagging behind the conversation."
|
||||
|
||||
DEMA (Double Exponential Moving Average) is not just "two EMAs." It's a clever mathematical hack to cancel out the lag inherent in a standard EMA. By subtracting the "error" (the difference between a single EMA and a double EMA) from the original EMA, DEMA produces a curve that hugs the price action much tighter. The extrapolation formula $2 \times \text{EMA}_1 - \text{EMA}_2$ effectively predicts where EMA "should be" based on its current trajectory.
|
||||
@@ -235,4 +252,4 @@ Both EMA states are rolled back atomically for consistent correction.
|
||||
|
||||
## References
|
||||
|
||||
- Mulloy, P. (1994). "Smoothing Data with Faster Moving Averages." *Technical Analysis of Stocks & Commodities*, 12(1), 11-19.
|
||||
- Mulloy, P. (1994). "Smoothing Data with Faster Moving Averages." *Technical Analysis of Stocks & Commodities*, 12(1), 11-19.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# DSMA: Deviation-Scaled Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `scaleFactor` (default 0.5) |
|
||||
| **Outputs** | Single series (Dsma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- DSMA (Deviation-Scaled Moving Average) is a volatility-adaptive trend filter that combines a Super Smoother (2-pole Butterworth IIR filter) with RM...
|
||||
- Parameterized by `period`, `scalefactor` (default 0.5).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -238,4 +255,4 @@ The 2-pole IIR recursion and adaptive alpha dependency on running RMS preclude S
|
||||
|
||||
6. **Bar Correction**: Like all QuanTAlib indicators, DSMA supports bar correction via the `isNew` parameter. When `isNew = false`, it rolls back to the previous state before recalculating. Ensure your data feed correctly signals bar updates versus corrections.
|
||||
|
||||
7. **SIMD Limitation**: The recursive nature of the Super Smoother filter and adaptive alpha calculation precludes efficient SIMD vectorization. The `Calculate(Span)` method uses a scalar loop. For bulk backtesting, consider parallelizing across multiple series rather than within a single series.
|
||||
7. **SIMD Limitation**: The recursive nature of the Super Smoother filter and adaptive alpha calculation precludes efficient SIMD vectorization. The `Calculate(Span)` method uses a scalar loop. For bulk backtesting, consider parallelizing across multiple series rather than within a single series.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# EMA: Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Ema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The Exponential Moving Average is the reference standard for trend-following indicators.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "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 Exponential Moving Average is the reference standard for trend-following indicators. Unlike the SMA, which treats data from 10 days ago with the same reverence as data from 10 seconds ago (a touching but mathematically questionable form of loyalty), the EMA applies exponentially decaying weights to older prices. The result: faster reaction to new information without the "drop-off effect" that makes SMA users twitch nervously around window boundaries. Simple, well-understood, computationally cheap. The indicator equivalent of a reliable sedan: not glamorous, but it starts every morning.
|
||||
@@ -286,4 +303,4 @@ else
|
||||
|
||||
- Hunter, J. S. (1986). "The Exponentially Weighted Moving Average." *Journal of Quality Technology*, 18(4), 203-210.
|
||||
- Roberts, S. W. (1959). "Control Chart Tests Based on Geometric Moving Averages." *Technometrics*, 1(3), 239-250.
|
||||
- Ehlers, J. F. (2001). *Rocket Science for Traders*. John Wiley & Sons. Chapter 3: Smoothing. (The title oversells it slightly, but the content is solid.)
|
||||
- Ehlers, J. F. (2001). *Rocket Science for Traders*. John Wiley & Sons. Chapter 3: Smoothing. (The title oversells it slightly, but the content is solid.)
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# FRAMA: Ehlers Fractal Adaptive Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | OHLCV bar (TBar) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Frama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `pe` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- FRAMA is John Ehlers' fractal adaptive moving average.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -207,4 +224,4 @@ This approach is simple and cache-friendly for typical periods (10-50). Monotoni
|
||||
1. **Period parity**: The algorithm requires even `N`. Odd values are rounded up.
|
||||
2. **Warmup**: Outputs are `NaN` until `N` bars are available.
|
||||
3. **Range source**: FRAMA uses High and Low ranges. Feeding Close-only data collapses the ranges.
|
||||
4. **Bar correction**: Use `isNew=false` for corrections so the last bar is recomputed safely.
|
||||
4. **Bar correction**: Use `isNew=false` for corrections so the last bar is recomputed safely.
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# GDEMA: Generalized Double Exponential Moving Average
|
||||
# GDEMA: Generalized Double Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 10), `vfactor` (default 1.0) |
|
||||
| **Outputs** | Single series (Gdema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- GDEMA extends the standard DEMA (Double Exponential Moving Average) with a tunable gain factor $v$ that controls the aggressiveness of lag compensa...
|
||||
- Parameterized by `period` (default 10), `vfactor` (default 1.0).
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
# HEMA: Hull Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Hema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `EstimateWarmupPeriod()` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- HEMA is a Hull-style moving average built entirely from **exponential smoothers**.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
|
||||
> "HMA is a topology. HEMA keeps the topology and swaps the physics: windows to decay, with identical lag."
|
||||
|
||||
HEMA is a Hull-style moving average built entirely from **exponential smoothers**. It preserves the classic HMA pipeline (fast minus slow, then smooth) but replaces WMA sub-filters with EMAs whose alphas are tuned to produce **identical lag** to the WMA stages they replace. At period $N$: HEMA($N$) and HMA($N$) have the same theoretical group delay, but HEMA has infinite memory and smoother transient behavior.
|
||||
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# HOLT: Holt Exponential Moving Average
|
||||
# HOLT: Holt Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `gamma` (default 0) |
|
||||
| **Outputs** | Single series (HOLT) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- Holt's exponential smoothing extends simple exponential smoothing (EMA) by adding a second equation that explicitly tracks the local trend.
|
||||
- Parameterized by `period`, `gamma` (default 0).
|
||||
- Output range: Tracks input.
|
||||
- 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)
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# HTIT: Ehlers Hilbert Transform Instantaneous Trend (also known as HT_TRENDLINE)
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | None |
|
||||
| **Outputs** | Single series (HTIT) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `12` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- HTIT (Hilbert Transform Instantaneous Trend) is a trend-following indicator that doesn't rely on simple averaging.
|
||||
- No configurable parameters; computation is stateless per bar.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -257,4 +274,4 @@ Uses `Math.Atan2` for proper quadrant handling in phase calculation, avoiding di
|
||||
1. **Warmup**: This indicator needs significant warmup (at least 12 bars, ideally 50+) for the feedback loops (period smoothing) to stabilize. Don't trust the first 50 bars.
|
||||
2. **Lag**: While it adapts, the trendline still lags because it's essentially a dynamic SMA. The advantage is that the period is optimal for the current market condition, not that it has zero lag.
|
||||
3. **Complexity**: Debugging this is a nightmare. Trust the math.
|
||||
4. **Ranging Markets**: In a pure range, the "trend" should be flat. HTIT handles this well because the cycle cancellation works best when the cycle is clear.
|
||||
4. **Ranging Markets**: In a pure range, the "trend" should be flat. HTIT handles this well because the cycle cancellation works best when the cycle is clear.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# HWMA: Holt-Winters Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 10) |
|
||||
| **Outputs** | Single series (Hwma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- HWMA is an Infinite Impulse Response (IIR) filter that applies triple exponential smoothing with level (F), velocity (V), and acceleration (A) comp...
|
||||
- Parameterized by `period` (default 10).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -236,4 +253,4 @@ HWMA has constant memory regardless of period—approximately **142 bytes** per
|
||||
|
||||
5. **Seasonal Confusion**: "Holt-Winters" often implies seasonal decomposition. This implementation is the non-seasonal variant focusing on level-trend-acceleration only.
|
||||
|
||||
6. **Parameter Sensitivity**: Small changes in β and γ significantly affect behavior. Start with the default period-based derivation before experimenting with custom values.
|
||||
6. **Parameter Sensitivity**: Small changes in β and γ significantly affect behavior. Start with the default period-based derivation before experimenting with custom values.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# JMA: Jurik Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `phase` (default 0), `power` (default 0.45) |
|
||||
| **Outputs** | Single series (Jma) |
|
||||
| **Output range** | $-100$ to $+100$ |
|
||||
| **Warmup** | 1 bar |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- JMA (Jurik Moving Average) is Mark Jurik's flagship adaptive smoother, recovered through decompilation of his proprietary AmiBroker/MetaTrader bina...
|
||||
- Parameterized by `period`, `phase` (default 0), `power` (default 0.45).
|
||||
- Output range: $-100$ to $+100$.
|
||||
- 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%.
|
||||
@@ -356,4 +373,4 @@ All hot-path methods are decorated with `[MethodImpl(MethodImplOptions.Aggressiv
|
||||
## References
|
||||
|
||||
- Jurik Research. (1998-2005). "JMA White Papers." *jurikres.com* (archived).
|
||||
- Kositsin, Nikolay. (2007). "Digital Indicators for MetaTrader 4." *Alpari Forum Archives*.
|
||||
- Kositsin, Nikolay. (2007). "Digital Indicators for MetaTrader 4." *Alpari Forum Archives*.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# KAMA: Kaufman's Adaptive Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 10), `fastPeriod` (default 2), `slowPeriod` (default 30) |
|
||||
| **Outputs** | Single series (Kama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period + 1` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- KAMA (Kaufman's Adaptive Moving Average) is an intelligent moving average that adjusts its smoothing speed based on market noise.
|
||||
- Parameterized by `period` (default 10), `fastperiod` (default 2), `slowperiod` (default 30).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -199,4 +216,4 @@ The epsilon guard (1e-10) prevents division by zero in flat markets, while the E
|
||||
|
||||
1. **Flatlining**: In very choppy markets, KAMA can become almost horizontal. This is a feature, not a bug—it's telling you to stay out.
|
||||
2. **Parameters**: The standard settings are (10, 2, 30). 10 is the ER period, 2 is the fast EMA, 30 is the slow EMA. Tweaking the ER period changes the sensitivity to noise.
|
||||
3. **Trend Following**: KAMA is excellent for trailing stops because it flattens out when momentum stalls.
|
||||
3. **Trend Following**: KAMA is excellent for trailing stops because it flattens out when momentum stalls.
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# LEMA: Leader Exponential Moving Average
|
||||
# LEMA: Leader Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Lema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- LEMA (Leader EMA) adds a smoothed error correction to the standard EMA, creating a moving average that anticipates price movement.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# MAMA: Ehlers MESA Adaptive Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `fastLimit` (default 0.5), `slowLimit` (default 0.05) |
|
||||
| **Outputs** | Single series (Mama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `50` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- MAMA (MESA Adaptive Moving Average) is a unique adaptive moving average that uses the Hilbert Transform to determine the phase rate of change of th...
|
||||
- Parameterized by `fastlimit` (default 0.5), `slowlimit` (default 0.05).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -341,4 +358,4 @@ MAMA works best when combined with indicators that cover its blind spots:
|
||||
|
||||
5. **Precision Expectations**: Don't expect your MAMA to match TradingView or TA-Lib to the sixth decimal. It won't. Those implementations have accumulated rounding errors from 20 years of cargo-cult porting. Your values will be more accurate but numerically different. If this breaks your backtests, the backtests were fragile.
|
||||
|
||||
6. **Ignoring the Alpha Output**: Many traders only look at MAMA and FAMA values. The adaptive alpha itself is valuable information—it tells you how confident MAMA is in its cycle estimate. High alpha (near FastLimit) means rapid phase change and uncertainty. Low alpha (near SlowLimit) means stable, established trend.
|
||||
6. **Ignoring the Alpha Output**: Many traders only look at MAMA and FAMA values. The adaptive alpha itself is valuable information—it tells you how confident MAMA is in its cycle estimate. High alpha (near FastLimit) means rapid phase change and uncertainty. Low alpha (near SlowLimit) means stable, established trend.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# MAVP: Moving Average Variable Period
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `minPeriod` (default 2), `maxPeriod` (default 30) |
|
||||
| **Outputs** | Single series (Mavp) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `maxPeriod` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- MAVP applies an EMA-style exponential smoothing where the period -- and therefore the smoothing constant alpha -- changes on every bar.
|
||||
- Parameterized by `minperiod` (default 2), `maxperiod` (default 30).
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# MCNMA: McNicholl EMA (Zero-Lag TEMA)
|
||||
# MCNMA: McNicholl EMA (Zero-Lag TEMA)
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Mcnma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- MCNMA computes $2 \times \text{TEMA}(x, N) - \text{TEMA}(\text{TEMA}(x, N), N)$, applying the DEMA lag-cancellation technique to TEMA itself.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# MGDI: McGinley Dynamic Indicator
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` (default 14), `k` (default 0.6) |
|
||||
| **Outputs** | Single series (Mgdi) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- MGDI (McGinley Dynamic Indicator) looks like a moving average but operates on a fundamentally different principle.
|
||||
- Parameterized by `period` (default 14), `k` (default 0.6).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -148,4 +165,4 @@ MGDI is inherently recursive (each value depends on the previous), limiting SIMD
|
||||
|
||||
## References
|
||||
|
||||
- McGinley, J.R. (1991). "The McGinley Dynamic." *Market Technicians Association Journal*, Fall 1991.
|
||||
- McGinley, J.R. (1991). "The McGinley Dynamic." *Market Technicians Association Journal*, Fall 1991.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# MMA: Modified Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Mma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- MMA (Modified Moving Average) uses a **simple mean** as a baseline, then adds a **weighted correction** based on the position of values within the ...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -158,4 +175,4 @@ The weighted sum computation is vectorizable:
|
||||
|
||||
## References
|
||||
|
||||
- PineScript reference implementation: `lib/trends_IIR/mma/mma.pine`
|
||||
- PineScript reference implementation: `lib/trends_IIR/mma/mma.pine`
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# NMA: Natural Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Nma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- 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...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
|
||||
@@ -1,4 +1,21 @@
|
||||
# QEMA: Quad Exponential Moving Average
|
||||
# QEMA: Quad Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Qema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- QEMA (Quad Exponential Moving Average) is a zero-lag smoothing filter that cascades four EMAs with geometrically ramped alphas and combines them us...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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."
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# REMA: Regularized Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `lambda` (default 0.5) |
|
||||
| **Outputs** | Single series (Rema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- REMA (Regularized Exponential Moving Average) combines exponential smoothing with a regularization term that penalizes deviations from the previous...
|
||||
- Parameterized by `period`, `lambda` (default 0.5).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -194,4 +211,4 @@ REMA is ideal when:
|
||||
REMA is less suitable when:
|
||||
- You need maximum responsiveness (use EMA instead)
|
||||
- You're comparing against external libraries that don't implement REMA
|
||||
- You need predictable, standardized behavior across platforms
|
||||
- You need predictable, standardized behavior across platforms
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# RGMA: Recursive Gaussian Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `passes` (default 3) |
|
||||
| **Outputs** | Single series (Rgma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- RGMA (Recursive Gaussian Moving Average) approximates Gaussian smoothing by cascading multiple identical exponential moving averages.
|
||||
- Parameterized by `period`, `passes` (default 3).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -214,4 +231,4 @@ RGMA is less suitable when:
|
||||
## References
|
||||
|
||||
- TradingView reference implementation: `lib/trends_IIR/rgma/rgma.pine`
|
||||
- Central Limit Theorem and cascaded filter theory: Smith, S.W. *The Scientist and Engineer's Guide to Digital Signal Processing*, Chapter 15
|
||||
- Central Limit Theorem and cascaded filter theory: Smith, S.W. *The Scientist and Engineer's Guide to Digital Signal Processing*, Chapter 15
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# RMA: Running Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Rma) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `ema.WarmupPeriod` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The Running Moving Average (RMA), also known as the Smoothed Moving Average (SMMA) or Wilder's Moving Average, is the backbone of J.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -94,4 +111,4 @@ Validated against Skender and Ooples.
|
||||
|
||||
1. **Initialization**: Like EMA, RMA requires a "warmup" period to converge. Wilder often initialized with a Simple Moving Average (SMA) of the first $N$ bars. QuanTAlib follows this convention.
|
||||
2. **Naming**: Often called SMMA (Smoothed Moving Average) in other libraries.
|
||||
3. **Period Mismatch**: Using an EMA(14) where an RMA(14) is expected will result in a much faster-moving line (equivalent to RMA(7.5)).
|
||||
3. **Period Mismatch**: Using an EMA(14) where an RMA(14) is expected will result in a much faster-moving line (equivalent to RMA(7.5)).
|
||||
|
||||
+18
-1
@@ -1,5 +1,22 @@
|
||||
# T3: Tillson T3 Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period`, `vfactor` (default 0.7) |
|
||||
| **Outputs** | Single series (T3) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period * 6` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The T3 Moving Average is a hyper-smooth, low-lag filter that cascades six Exponential Moving Averages (EMAs).
|
||||
- Parameterized by `period`, `vfactor` (default 0.7).
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -99,4 +116,4 @@ T3 is inherently recursive due to 6 cascaded EMAs. SIMD parallelization across b
|
||||
|
||||
1. **Warmup**: Because it cascades 6 EMAs, T3 takes significantly longer to stabilize than a standard EMA. A T3(10) might need 60+ bars to converge.
|
||||
2. **Overshoot**: With high $v$ values ($>1$), T3 can overshoot price turns, creating false breakout signals.
|
||||
3. **Complexity**: It is computationally heavier than SMA or EMA (approx 6x ops), though still negligible on modern CPUs.
|
||||
3. **Complexity**: It is computationally heavier than SMA or EMA (approx 6x ops), though still negligible on modern CPUs.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# TEMA: Triple Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Tema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period * 3` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The Triple Exponential Moving Average (TEMA) is a lag-reducing filter that combines a single, double, and triple EMA.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- Requires `period * 3` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Patrick Mulloy looked at the lag of an EMA and took it personally. TEMA is what happens when you apply algebra to impatience."
|
||||
|
||||
The Triple Exponential Moving Average (TEMA) is a lag-reducing filter that combines a single, double, and triple EMA. Unlike a simple triple smoothing (which would be incredibly slow), TEMA uses a weighted combination of the three to cancel out the lag, resulting in an indicator that hugs price action tighter than a spandex cycling short.
|
||||
@@ -165,4 +182,4 @@ Each EmaState contains: Ema (8B), E (8B), IsHot (1B), IsCompensated (1B) + paddi
|
||||
|
||||
1. **Overshoot**: TEMA is so responsive it can overshoot price turns, creating a "whiplash" effect in volatile markets.
|
||||
2. **Noise**: By reducing lag, TEMA sacrifices some noise suppression. It is "nervous" compared to an SMA.
|
||||
3. **Identity Crisis**: Often confused with T3 (Tillson). T3 is a generalized version; TEMA is specifically T3 with $v=1$.
|
||||
3. **Identity Crisis**: Often confused with T3 (Tillson). T3 is a generalized version; TEMA is specifically T3 with $v=1$.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# TRAMA: Trend Regularity Adaptive Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Trama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- TRAMA is an adaptive EMA where the smoothing factor derives from the "trend regularity" of the lookback window, measured as the fraction of bars th...
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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).
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# VAMA: Volatility Adjusted Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | OHLCV bar (TBar) |
|
||||
| **Parameters** | `baseLength` (default 20), `shortAtrPeriod` (default 10), `longAtrPeriod` (default 50), `minLength` (default 5), `maxLength` (default 100) |
|
||||
| **Outputs** | Single series (Vama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | 1 bar |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- Most moving averages use a fixed lookback period.
|
||||
- Parameterized by `baselength` (default 20), `shortatrperiod` (default 10), `longatrperiod` (default 50), `minlength` (default 5), `maxlength` (default 100).
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
@@ -271,4 +288,4 @@ VAMA's ATR-based approach specifically responds to range expansion/contraction,
|
||||
## References
|
||||
|
||||
- Wilder, J.W. (1978). "New Concepts in Technical Trading Systems" - ATR and RMA foundations
|
||||
- PineScript reference implementation: `vama.pine`
|
||||
- PineScript reference implementation: `vama.pine`
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# VIDYA: Variable Index Dynamic Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Vidya) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `period` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- The Variable Index Dynamic Average (VIDYA) is an adaptive moving average that automatically adjusts its smoothing speed based on market volatility.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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.
|
||||
@@ -100,4 +117,4 @@ VIDYA is an IIR filter with CMO-driven adaptive alpha — not vectorizable acros
|
||||
|
||||
1. **Flatlining**: In extremely choppy, sideways markets, CMO can approach 0, causing VIDYA to flatline completely. This is a feature, not a bug.
|
||||
2. **Sensitivity**: VIDYA is highly sensitive to the period chosen for the CMO. A short period makes it jittery; a long period makes it sluggish.
|
||||
3. **Comparison**: Often compared to KAMA (Kaufman). KAMA uses Efficiency Ratio (ER); VIDYA uses CMO. They are conceptually similar but mathematically distinct.
|
||||
3. **Comparison**: Often compared to KAMA (Kaufman). KAMA uses Efficiency Ratio (ER); VIDYA uses CMO. They are conceptually similar but mathematically distinct.
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# YZVAMA: Yang-Zhang Volatility Adjusted Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | OHLCV bar (TBar) |
|
||||
| **Parameters** | `yzvShortPeriod` (default 3), `yzvLongPeriod` (default 50), `percentileLookback` (default 100), `minLength` (default 5), `maxLength` (default 100) |
|
||||
| **Outputs** | Single series (Yzvama) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | 1 bar |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- Most adaptive moving averages measure volatility using close-to-close changes (standard deviation) or high-low ranges (ATR).
|
||||
- Parameterized by `yzvshortperiod` (default 3), `yzvlongperiod` (default 50), `percentilelookback` (default 100), `minlength` (default 5), `maxlength` (default 100).
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
@@ -411,4 +428,4 @@ Percentile ranking solves both:
|
||||
|
||||
- Yang, D., & Zhang, Q. (2000). "Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices." *Journal of Business*, 73(3), 477-491.
|
||||
- Rogers, L.C.G., & Satchell, S.E. (1991). "Estimating Variance from High, Low and Closing Prices." *Annals of Applied Probability*, 1(4), 504-512.
|
||||
- PineScript reference implementation: `yzvama.pine`
|
||||
- PineScript reference implementation: `yzvama.pine`
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
# ZLDEMA: Zero-Lag Double Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Zldema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- ZLDEMA takes a standard DEMA and feeds it a **zero-lag signal**: current price minus a lagged price.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
|
||||
> "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."
|
||||
|
||||
ZLDEMA takes a standard DEMA and feeds it a **zero-lag signal**: current price minus a lagged price. This produces a smoother that responds faster than DEMA without going fully raw. The dual EMA cascade provides additional noise rejection while the zero-lag preprocessing maintains responsiveness.
|
||||
|
||||
@@ -146,4 +164,4 @@ ZLDEMA is validated against a PineScript reference implementation.
|
||||
|
||||
5. **DEMA vs ZLDEMA**
|
||||
|
||||
ZLDEMA is not simply DEMA with a different alpha. The zero-lag preprocessing fundamentally changes the input signal, making ZLDEMA more responsive but also more prone to overshoot than standard DEMA.
|
||||
ZLDEMA is not simply DEMA with a different alpha. The zero-lag preprocessing fundamentally changes the input signal, making ZLDEMA more responsive but also more prone to overshoot than standard DEMA.
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
# ZLEMA: Zero-Lag Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Zlema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- ZLEMA takes a standard EMA and feeds it a **zero-lag signal**: current price minus a lagged price.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
|
||||
> "ZLEMA does not erase lag. It predicts just enough to act early, then pays the price in overshoot."
|
||||
|
||||
ZLEMA takes a standard EMA and feeds it a **zero-lag signal**: current price minus a lagged price. This produces a smoother that responds faster than EMA without going fully raw. It is not magic. It shifts some lag into controlled overshoot.
|
||||
|
||||
@@ -125,4 +143,4 @@ ZLEMA is validated against a PineScript reference implementation.
|
||||
|
||||
4. **Non-finite data**
|
||||
|
||||
NaN or Infinity is replaced with the last valid value. Before the first valid sample, output is `NaN`.
|
||||
NaN or Infinity is replaced with the last valid value. Before the first valid sample, output is `NaN`.
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
# ZLTEMA: Zero-Lag Triple Exponential Moving Average
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Trend (IIR MA) |
|
||||
| **Inputs** | Source (close) |
|
||||
| **Parameters** | `period` |
|
||||
| **Outputs** | Single series (Zltema) |
|
||||
| **Output range** | Tracks input |
|
||||
| **Warmup** | `Math.Max(lag + 1, EstimateWarmupPeriod(beta))` bars |
|
||||
|
||||
### TL;DR
|
||||
|
||||
- ZLTEMA takes a standard TEMA and feeds it a **zero-lag signal**: current price minus a lagged price.
|
||||
- Parameterized by `period`.
|
||||
- Output range: Tracks input.
|
||||
- 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
|
||||
|
||||
> "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."
|
||||
|
||||
ZLTEMA takes a standard TEMA and feeds it a **zero-lag signal**: current price minus a lagged price. This produces a smoother that responds faster than TEMA without going fully raw. The triple EMA cascade provides maximum noise rejection in the exponential family while the zero-lag preprocessing maintains responsiveness.
|
||||
|
||||
@@ -155,4 +173,4 @@ ZLTEMA is validated against a PineScript reference implementation.
|
||||
|
||||
6. **ZLDEMA vs ZLTEMA**
|
||||
|
||||
ZLTEMA adds a third EMA stage over ZLDEMA. This provides additional smoothing at the cost of more overshoot during reversals. Use ZLDEMA when overshoot is more concerning than noise; use ZLTEMA when maximum smoothness is required.
|
||||
ZLTEMA adds a third EMA stage over ZLDEMA. This provides additional smoothing at the cost of more overshoot during reversals. Use ZLDEMA when overshoot is more concerning than noise; use ZLTEMA when maximum smoothness is required.
|
||||
|
||||
Reference in New Issue
Block a user