mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-12 23:58:04 +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 @@
|
||||
# Oscillators
|
||||
|
||||
> "Oscillators tell you when to act, not which direction to trade." Unknown
|
||||
|
||||
Oscillators fluctuate above and below a centerline or within bounded ranges. Useful for identifying overbought/oversold conditions, momentum shifts, and divergences. Best in ranging markets; trend-following indicators work better in trending markets.
|
||||
|
||||
| Indicator | Full Name | Description |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# AC: Accelerator Oscillator
|
||||
|
||||
> "Momentum tells you which way the wind is blowing. Acceleration tells you whether the wind is picking up." -- Bill Williams, paraphrased
|
||||
> *Momentum tells you which way the wind is blowing. Acceleration tells you whether the wind is picking up.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# AO: Awesome Oscillator
|
||||
|
||||
> "Awesome is a marketing term. The math is just a moving average crossover. But sometimes, simple is all you need." -- Bill Williams, paraphrased
|
||||
> *Awesome is a marketing term. The math is just a moving average crossover. But sometimes, simple is all you need.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# APO: Absolute Price Oscillator
|
||||
|
||||
> "Percentages are for analysts. Traders pay bills in cash. APO tells you the cash value of the trend."
|
||||
> *Percentages are for analysts. Traders pay bills in cash. APO tells you the cash value of the trend.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# BBB: Bollinger %B
|
||||
|
||||
> "Price oscillates, but %B tells you where it lives inside the band." -- John Bollinger, paraphrased
|
||||
> *Price oscillates, but %B tells you where it lives inside the band.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# BBI: Bulls Bears Index
|
||||
|
||||
> *Average four moving averages of doubling periods and you get a single line that votes on whether bulls or bears own the tape. It is a committee of trends, each watching a different time horizon, forced to agree on one number.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `Math.Max(Math.Max(p1, p2), Math.Max(p3, p4))` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Average four moving averages of doubling periods and you get a single line that votes on whether bulls or bears own the tape. It is a committee of trends, each watching a different time horizon, forced to agree on one number."
|
||||
|
||||
BBI (Bulls Bears Index) computes the arithmetic mean of four Simple Moving Averages with geometrically spaced periods (3, 6, 12, 24 by default). The result is a price-overlay line that captures trend consensus across ultra-short, short, medium, and long timeframes simultaneously. Price above BBI signals bullish dominance; price below BBI signals bearish control. The crossover point marks the regime boundary between long and short markets.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# BBS: Bollinger Band Squeeze
|
||||
|
||||
> "Volatility contraction precedes expansion. The squeeze tells you when to watch." -- John Carter, paraphrased
|
||||
> *Volatility contraction precedes expansion. The squeeze tells you when to watch.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# BRAR: Bull-Bear Power Ratio
|
||||
|
||||
> *The open is the amateur's price. The close is the professional's price. The distance between them is where the money hides.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The open is the amateur's price. The close is the professional's price. The distance between them is where the money hides."
|
||||
|
||||
BRAR is a dual-output sentiment oscillator from the Japanese technical analysis tradition that decomposes market pressure into two independent ratios: BR (Buying Ratio), which measures upside thrust relative to the previous close, and AR (Atmosphere Ratio), which measures intraday range asymmetry relative to the open. Both outputs oscillate around an equilibrium of 100, where values above 100 signal dominance of the measured pressure and values below 100 signal weakness. The default lookback of 26 bars (one Japanese trading month) produces stable readings with 4 additions per bar in streaming mode.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# CFO: Chande Forecast Oscillator (also known as FOSC)
|
||||
|
||||
> "The distance between where you are and where regression says you should be tells you everything about momentum." -- Tushar Chande, paraphrased
|
||||
> *The distance between where you are and where regression says you should be tells you everything about momentum.*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# COPPOCK: Coppock Curve
|
||||
|
||||
> *The Coppock Curve sums two rates of change through a weighted average, designed to spot the start of long-term bull markets.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# CRSI: Connors RSI
|
||||
|
||||
> *Connors RSI blends classic RSI with streak length and percentile rank, creating a multi-dimensional momentum snapshot.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# CTI: Correlation Trend Indicator
|
||||
|
||||
> *Correlation trend indicator measures the linear correlation between price and a perfect trend line — how orderly is the move.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DECO: Ehlers Decycler Oscillator
|
||||
|
||||
> *Ehlers' decycler oscillator removes the trend and isolates residual oscillation — what remains when the drift is subtracted.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DEM: DeMarker Oscillator
|
||||
|
||||
> *The trend is your friend — right up until DeMark starts counting against it.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The trend is your friend — right up until DeMark starts counting against it."
|
||||
|
||||
DEM (DeMarker Oscillator) is a bounded [0, 1] momentum oscillator that measures sequential demand pressure by comparing each bar's high and low against the previous bar's high and low. It isolates bullish demand momentum in the numerator and bearish supply pressure in the denominator, then normalizes their ratio with SMA smoothing over a configurable period. Values near 0.7 signal overbought exhaustion; values near 0.3 signal oversold exhaustion. Neither external library in common use (TA-Lib, Skender, Tulip, Ooples) implements DeMarker, so self-consistency tests against batch/streaming/span modes serve as the primary validation.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DOSC: Derivative Oscillator
|
||||
|
||||
> *The derivative oscillator takes the derivative of a smoothed RSI, catching momentum shifts at their earliest inflection.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# DPO: Detrended Price Oscillator
|
||||
|
||||
> "Strip the trend and what remains is the cycle." — William Blau
|
||||
> *Strip the trend and what remains is the cycle.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# DYMOI: Dynamic Momentum Index
|
||||
|
||||
> *The market is not a fixed-frequency oscillator. Why would you analyze it with one?*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -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 is not a fixed-frequency oscillator. Why would you analyze it with one?" — Tushar Chande & Stanley Kroll, *The New Technical Trader*, 1994
|
||||
|
||||
DYMOI is a volatility-adaptive RSI: when recent price swings are large relative to longer-term swings, the RSI period shortens and the indicator becomes more responsive; when price action tightens, the period extends and the output smooths. The result is an oscillator that self-adjusts its sensitivity to the market's current state, avoiding both the lag of long fixed-period RSIs in trending regimes and the noise of short-period RSIs in ranging ones.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ER: Efficiency Ratio
|
||||
|
||||
> *The best trades move in a straight line. The worst ones wander. ER tells you which kind you're looking at.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- It is core component of KAMA (Kaufman's Adaptive Moving Average), where ER dynamically adjusts the smoothing constant.
|
||||
- Not available and therefore not validated against any other TA library
|
||||
|
||||
> "The best trades move in a straight line. The worst ones wander. ER tells you which kind you're looking at." -- Perry Kaufman
|
||||
|
||||
## Historical Context
|
||||
|
||||
Perry Kaufman introduced the Efficiency Ratio in *Trading Systems and Methods* (1995) as part of his Adaptive Moving Average (KAMA) framework. The idea was straightforward: an ideal trend indicator should react quickly in trending markets and slowly in choppy ones. ER provides the adaptive signal that tells KAMA how to behave.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# ERI: Elder Ray Index
|
||||
|
||||
> "The job of the indicator is to separate the bulls from the bears. If you can measure their power independently, you can see who is winning before the trend changes." -- Alexander Elder
|
||||
> *The job of the indicator is to separate the bulls from the bears. If you can measure their power independently, you can see who is winning before the trend changes.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FI: Force Index
|
||||
|
||||
> "Volume is the steam that makes the locomotive run. Price shows direction; volume shows conviction." -- Alexander Elder
|
||||
> *Volume is the steam that makes the locomotive run. Price shows direction; volume shows conviction.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FISHER: Ehlers Fisher Transform
|
||||
|
||||
> "The Fisher Transform turns price into a well-behaved Gaussian — because sometimes, the best way to see a reversal is to force the data to confess."
|
||||
> *The Fisher Transform turns price into a well-behaved Gaussian — because sometimes, the best way to see a reversal is to force the data to confess.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# FISHER04: Ehlers Fisher Transform (2004 Cybernetic Analysis)
|
||||
|
||||
> "The Fisher Transform provides clear, unambiguous turning points that make it possible to identify trend reversals." — John Ehlers, *Cybernetic Analysis for Stocks and Futures* (2004)
|
||||
> *The Fisher Transform provides clear, unambiguous turning points that make it possible to identify trend reversals.*
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# GATOR: Williams Gator Oscillator
|
||||
|
||||
> *The alligator tells you the trend exists. The gator tells you whether the alligator is hungry or full.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `Math.Max(jawPeriod + jawShift, Math.Max(teethPeriod + teethShift, lipsPeriod + lipsShift))` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The alligator tells you the trend exists. The gator tells you whether the alligator is hungry or full."
|
||||
|
||||
The Williams Gator Oscillator is a dual-histogram visualization of the Alligator indicator's convergence and divergence. It strips the Alligator's three SMMA lines down to two absolute differences: upper (Jaw minus Teeth) and lower (negative of Teeth minus Lips). The result is a zero-centered oscillator where expanding bars signal trend acceleration and contracting bars signal trend exhaustion. Because it operates on pre-computed SMMA values, the Gator adds zero computational overhead beyond two subtractions, two absolute values, and one sign flip per bar.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# IMI: Intraday Momentum Index
|
||||
|
||||
> *Intraday momentum index applies RSI logic to candle bodies — bullish closes accumulate strength, bearish closes accumulate weakness.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -64,39 +66,6 @@ When both sums are zero (all doji bars in window), IMI defaults to 50.0 (neutral
|
||||
|--------|-----------|---------|------------|
|
||||
| $N$ | period | 14 | $N \geq 1$ |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
Initialize:
|
||||
gainBuf = RingBuffer(period)
|
||||
lossBuf = RingBuffer(period)
|
||||
gainSum = lossSum = 0
|
||||
bar_count = 0
|
||||
|
||||
On each bar (open, close, isNew):
|
||||
if !isNew: restore previous state
|
||||
|
||||
// Classify bar
|
||||
diff = close - open
|
||||
gain = diff > 0 ? diff : 0
|
||||
loss = diff < 0 ? -diff : 0
|
||||
|
||||
// Update rolling sums
|
||||
if gainBuf is full:
|
||||
gainSum -= gainBuf.Oldest
|
||||
lossSum -= lossBuf.Oldest
|
||||
gainBuf.Add(gain)
|
||||
lossBuf.Add(loss)
|
||||
gainSum += gain
|
||||
lossSum += loss
|
||||
|
||||
// IMI calculation
|
||||
total = gainSum + lossSum
|
||||
IMI = total > 0 ? 100 × gainSum / total : 50.0
|
||||
|
||||
output = IMI
|
||||
```
|
||||
|
||||
### IMI vs RSI Comparison
|
||||
|
||||
| Property | RSI | IMI |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# INERTIA: Inertia Oscillator
|
||||
|
||||
> "Price tends to keep doing what it's been doing — until it doesn't. Inertia measures the gap between reality and the regression's expectations."
|
||||
> *Price tends to keep doing what it's been doing — until it doesn't. Inertia measures the gap between reality and the regression's expectations.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# KDJ: Enhanced Stochastic Oscillator
|
||||
|
||||
> "K leads, D confirms, J exaggerates — three perspectives on momentum condensed into one indicator."
|
||||
> *K leads, D confirms, J exaggerates — three perspectives on momentum condensed into one indicator.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# KRI: Kairi Relative Index
|
||||
|
||||
> "The simplest measure of overextension is the oldest: how far has price strayed from its average? The Japanese knew this before anyone had a computer." -- Anonymous
|
||||
> *The simplest measure of overextension is the oldest: how far has price strayed from its average? The Japanese knew this before anyone had a computer.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# KST: Know Sure Thing Oscillator
|
||||
|
||||
> *Know Sure Thing layers four smoothed rates of change at different periods, weighting longer cycles more heavily.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# LRSI: Laguerre RSI
|
||||
|
||||
> *The Laguerre transform lets you trade off between lag and smoothness using a single parameter.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `4` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The Laguerre transform lets you trade off between lag and smoothness using a single parameter." — John Ehlers
|
||||
|
||||
Laguerre RSI is an adaptive oscillator invented by John Ehlers that replaces standard RSI's Wilder-smoothed gain/loss averages with a 4-stage cascaded Laguerre filter. A single γ (gamma) parameter controls the entire responsiveness-smoothness trade-off. Output is dimensionless, always in [0, 1]. No period selection required.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MARKETFI: Market Facilitation Index
|
||||
|
||||
> *Price moves in an empty room; volume tells you how many people showed up.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `> 1` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "Price moves in an empty room; volume tells you how many people showed up."
|
||||
|
||||
The Market Facilitation Index answers a single question with arithmetic directness: how much price moved per unit of volume traded? One division. No lookback period. No smoothing. No parameter to debate. What you get is raw market efficiency — the price range a market delivers for each unit of liquidity consumed.
|
||||
|
||||
Bill Williams introduced BW MFI in *Trading Chaos* (1995) as part of his Profitunity trading system, alongside the Awesome Oscillator and Accelerator Oscillator. His central insight was that price and volume carry independent signals, and only their *combination* reveals whether a trend has genuine participation. A wide range bar on thin volume suggests ease of movement but not conviction. A narrow range bar on heavy volume suggests absorption — large players defending a level.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# MSTOCH: Ehlers MESA Stochastic
|
||||
|
||||
> *MESA Stochastic applies Ehlers' cycle measurement to stochastic normalization, binding the oscillator to the dominant market rhythm.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# PGO: Pretty Good Oscillator
|
||||
|
||||
> "Good enough to trade, honest enough not to pretend otherwise."
|
||||
> *Good enough to trade, honest enough not to pretend otherwise.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# PSL: Psychological Line
|
||||
|
||||
> "Markets are crowds, and crowds have moods. Count the up days; you will know the mood." -- Japanese proverb (adapted)
|
||||
> *Markets are crowds, and crowds have moods. Count the up days; you will know the mood.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# QQE: Quantitative Qualitative Estimation
|
||||
|
||||
> *QQE smooths RSI and wraps it in dynamic trailing bands, quantifying both the quality and magnitude of momentum.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# REFLEX: Ehlers Reflex Indicator
|
||||
|
||||
> *John Ehlers measured how much a filtered price deviates from its own linear extrapolation. The result is a zero-lag oscillator that catches reversals before they happen, because the deviation is largest precisely when the trend is bending.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "John Ehlers measured how much a filtered price deviates from its own linear extrapolation. The result is a zero-lag oscillator that catches reversals before they happen, because the deviation is largest precisely when the trend is bending."
|
||||
|
||||
REFLEX is a zero-lag oscillator that measures the reversal tendency of price by comparing a Super-Smoother-filtered price against a linear extrapolation from $N$ bars ago. The filter computes the slope of the filtered series over the lookback window, projects a straight line, and sums the deviations of the actual filtered values from this projected line. The sum is normalized by an exponential RMS estimate to produce values in roughly $\pm \sigma$ scale. Values above 0 indicate uptrend, below 0 indicate downtrend; crossovers signal potential reversals.
|
||||
|
||||
## Historical Context
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# REVERSEEMA: Ehlers Reverse EMA
|
||||
|
||||
> *The best way to remove lag is to understand where it comes from.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,6 @@
|
||||
- Requires `period` bars of warmup before first valid output (IsHot = true).
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
> "The best way to remove lag is to understand where it comes from." — John F. Ehlers
|
||||
|
||||
## Introduction
|
||||
|
||||
The Reverse EMA applies an 8-stage cascaded Z-transform inversion to a compensated EMA, progressively extracting and subtracting the accumulated lag component. Where standard EMA smoothing introduces phase delay proportional to the filter order, the reverse cascade reconstructs the lag error through successively doubled power coefficients of the decay factor, producing a signal with dramatically reduced latency. O(1) per bar, zero allocation, 8 FMA operations in the critical path.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# RVGI: Relative Vigor Index
|
||||
|
||||
> *Relative Vigor Index compares the close-open range to the high-low range, measuring conviction in each bar's direction.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# SMI: Stochastic Momentum Index
|
||||
|
||||
> "The stochastic tells you where price is in the range. The SMI tells you how enthusiastically it got there." — William Blau
|
||||
> *The stochastic tells you where price is in the range. The SMI tells you how enthusiastically it got there.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# SQUEEZE: Squeeze Momentum
|
||||
|
||||
> *Squeeze momentum detects compression inside Bollinger-Keltner overlap and then measures the explosive release when bands expand.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# STC: Schaff Trend Cycle
|
||||
|
||||
> *Schaff Trend Cycle applies double stochastic smoothing to MACD, compressing a trend indicator into an oscillator's bounded range.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -91,54 +93,6 @@ Smoothing options:
|
||||
| $s$ | slowLength | 50 | $s > f$ |
|
||||
| — | smoothing | EMA | None / EMA / Sigmoid / Digital |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
Initialize:
|
||||
ema_fast = ema_slow = first price
|
||||
α_f = 2 / (fastLength + 1)
|
||||
α_s = 2 / (slowLength + 1)
|
||||
α_d = 2 / (dPeriod + 1)
|
||||
macd_buf = RingBuffer(kPeriod)
|
||||
d1_buf = RingBuffer(kPeriod)
|
||||
%D₁ = 0
|
||||
bar_count = 0
|
||||
|
||||
On each bar (price, isNew):
|
||||
if !isNew: restore previous state
|
||||
|
||||
// Step 1: MACD
|
||||
ema_fast = FMA(ema_fast, 1 - α_f, α_f × price)
|
||||
ema_slow = FMA(ema_slow, 1 - α_s, α_s × price)
|
||||
macd = ema_fast - ema_slow
|
||||
|
||||
// Step 2: First Stochastic
|
||||
macd_buf.Add(macd)
|
||||
macd_max = Max(macd_buf)
|
||||
macd_min = Min(macd_buf)
|
||||
range1 = macd_max - macd_min
|
||||
%K₁ = range1 > 0 ? 100 × (macd - macd_min) / range1 : prev_%K₁
|
||||
|
||||
// Step 3: First Smoothing
|
||||
%D₁ = FMA(%D₁, 1 - α_d, α_d × %K₁)
|
||||
|
||||
// Step 4: Second Stochastic
|
||||
d1_buf.Add(%D₁)
|
||||
d1_max = Max(d1_buf)
|
||||
d1_min = Min(d1_buf)
|
||||
range2 = d1_max - d1_min
|
||||
%K₂ = range2 > 0 ? 100 × (%D₁ - d1_min) / range2 : prev_%K₂
|
||||
|
||||
// Step 5: Final Smoothing
|
||||
switch smoothing:
|
||||
None: STC = %K₂
|
||||
EMA: STC = FMA(prev_STC, 1 - α_d, α_d × %K₂)
|
||||
Sigmoid: STC = 100 / (1 + exp(-0.1 × (%K₂ - 50)))
|
||||
Digital: STC = %K₂ ≥ 50 ? 100 : 0
|
||||
|
||||
output = Clamp(STC, 0, 100)
|
||||
```
|
||||
|
||||
### Signal Characteristics
|
||||
|
||||
| Condition | Output Behavior |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# STOCH: Stochastic Oscillator
|
||||
|
||||
> "The Stochastic Oscillator doesn't follow price. It follows the speed, or momentum, of price. Momentum changes direction before price." -- George C. Lane
|
||||
> *The Stochastic Oscillator doesn't follow price. It follows the speed, or momentum, of price. Momentum changes direction before price.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# STOCHF: Stochastic Fast Oscillator
|
||||
|
||||
> "Speed kills in traffic. In markets, it merely whipsaws." -- Anonymous
|
||||
> *Speed kills in traffic. In markets, it merely whipsaws.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# STOCHRSI: Stochastic RSI Oscillator
|
||||
|
||||
> "RSI tells you whether momentum is overbought. Stochastic RSI tells you whether RSI itself is overbought. It's turtles all the way down." -- Anonymous quant
|
||||
> *RSI tells you whether momentum is overbought. Stochastic RSI tells you whether RSI itself is overbought. It's turtles all the way down.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# TD_SEQ: TD Sequential
|
||||
|
||||
> *TD Sequential counts consecutive closes relative to a prior bar, mapping exhaustion through the simple act of counting.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# TRENDFLEX: Ehlers Trendflex Indicator
|
||||
|
||||
> *The trend is your friend until it bends.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Oscillator |
|
||||
@@ -16,8 +18,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 your friend until it bends." — Ed Seykota, but Ehlers actually measures the bending.
|
||||
|
||||
## Introduction
|
||||
|
||||
The Trendflex indicator combines a 2-pole Butterworth low-pass pre-filter (Super Smoother) with an O(1) cumulative slope measurement and exponential RMS normalization to produce a zero-centered oscillator that quantifies trend strength. Unlike conventional slope or momentum indicators that suffer from noise amplification or lag, Trendflex pre-smooths via the Super Smoother, computes the least-squares slope of the filtered signal over a lookback window in constant time, then normalizes by a running RMS estimate. The result: a bounded oscillator where values above zero indicate uptrend, below zero indicate downtrend, and magnitude reflects trend conviction.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# TRIX: Triple Exponential Average Oscillator
|
||||
|
||||
> "Smooth it once, smooth it twice, smooth it thrice, then ask: is it still moving?" -- Jack Hutson, probably
|
||||
> *Smooth it once, smooth it twice, smooth it thrice, then ask: is it still moving?*
|
||||
|
||||
| Property | Value |
|
||||
|--------------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# TTM_WAVE: TTM Wave Indicator
|
||||
|
||||
> "The market speaks in waves. Most traders only hear the ripples." -- John Carter
|
||||
> *The market speaks in waves. Most traders only hear the ripples.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# ULTOSC: Ultimate Oscillator
|
||||
|
||||
> "Why use one timeframe when three can save you from yourself?"
|
||||
> *Why use one timeframe when three can save you from yourself?*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# WILLR: Williams %R
|
||||
|
||||
> "The market tells you where it closed relative to where it traded. That single fact contains more information than most traders realize." -- George Lane
|
||||
> *The market tells you where it closed relative to where it traded. That single fact contains more information than most traders realize.*
|
||||
|
||||
| Property | Value |
|
||||
|----------|-------|
|
||||
|
||||
Reference in New Issue
Block a user