mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 09:38:05 +00:00
feat(dynamics): add PlusDI, MinusDI, PlusDM, MinusDM indicators
Complete thin Dx-composition wrapper indicators with full test coverage: - PlusDi/MinusDi: Directional Indicator wrappers (DiPlus/DiMinus from Dx) - PlusDm/MinusDm: Directional Movement wrappers (DmPlus/DmMinus from Dx) - Individual validation tests per indicator directory (TALib, Skender, bounds) - Combined unit tests (DiDm.Tests.cs) and validation tests (DiDm.Validation.Tests.cs) - Quantower wrappers + tests for all 4 indicators - PineScript v6 implementations with compensated RMA - Normalized .md documentation for all indicators and categories - 182 tests passing, 0 failures
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# QSTICK: Qstick Indicator
|
||||
|
||||
> *The average candlestick body reveals the market's true conviction.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Dynamic |
|
||||
@@ -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 average candlestick body reveals the market's true conviction."
|
||||
|
||||
The Qstick indicator, developed by Tushar Chande, computes a moving average of the close-minus-open difference over a lookback period, quantifying whether bars are predominantly bullish or bearish. Positive values indicate closes above opens (buying pressure); negative values indicate closes below opens (selling pressure). It supports both SMA (O(N) space via ring buffer) and EMA (O(1) space) smoothing modes and requires TBar input for open/close access.
|
||||
|
||||
## Historical Context
|
||||
@@ -61,33 +61,6 @@ EMA mode uses O(1) space but weights recent bars more heavily than SMA.
|
||||
| period | int | 14 | > 0 | Lookback period for moving average |
|
||||
| useEma | bool | false | — | Use EMA (true) or SMA (false) |
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
QSTICK(bar, period=14, useEma=false):
|
||||
|
||||
diff = bar.Close - bar.Open
|
||||
|
||||
if useEma:
|
||||
// EMA mode
|
||||
alpha = 2.0 / (period + 1)
|
||||
if count == 0:
|
||||
ema_val = diff
|
||||
else:
|
||||
ema_val = FMA(alpha, diff - ema_val, ema_val) // alpha*(diff-ema)+ema
|
||||
result = ema_val
|
||||
|
||||
else:
|
||||
// SMA mode with ring buffer
|
||||
if buffer is full:
|
||||
running_sum -= buffer.oldest
|
||||
buffer.add(diff)
|
||||
running_sum += diff
|
||||
result = running_sum / min(count, period)
|
||||
|
||||
return result
|
||||
```
|
||||
|
||||
### Zero-Crossing Interpretation
|
||||
|
||||
| Condition | Meaning |
|
||||
|
||||
Reference in New Issue
Block a user