mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 10:08: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:
+2
-42
@@ -1,5 +1,7 @@
|
||||
# CCOR: Ehlers Correlation Cycle
|
||||
|
||||
> *Correlation cycles reveal hidden periodicities by measuring how well price correlates with a rotating reference wave.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Cycle |
|
||||
@@ -94,48 +96,6 @@ Where:
|
||||
- Real: $y_k = \cos(2\pi k / N)$
|
||||
- Imaginary: $y_k = -\sin(2\pi k / N)$
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```
|
||||
function CCOR(source, period, threshold):
|
||||
// Real correlation
|
||||
Sx_r = Sy_r = Sxx_r = Sxy_r = Syy_r = 0
|
||||
for k = 0 to period-1:
|
||||
x = source[k]
|
||||
y = cos(2π * k / period)
|
||||
Sx_r += x; Sy_r += y
|
||||
Sxx_r += x*x; Sxy_r += x*y; Syy_r += y*y
|
||||
denom_r = (N*Sxx_r - Sx_r²) * (N*Syy_r - Sy_r²)
|
||||
real = denom_r > 0 ? (N*Sxy_r - Sx_r*Sy_r) / √denom_r : 0
|
||||
|
||||
// Imaginary correlation (same accumulators for x, different y)
|
||||
Sx_i = Sy_i = Sxx_i = Sxy_i = Syy_i = 0
|
||||
for k = 0 to period-1:
|
||||
x = source[k]
|
||||
y = -sin(2π * k / period)
|
||||
Sx_i += x; Sy_i += y
|
||||
Sxx_i += x*x; Sxy_i += x*y; Syy_i += y*y
|
||||
denom_i = (N*Sxx_i - Sx_i²) * (N*Syy_i - Sy_i²)
|
||||
imag = denom_i > 0 ? (N*Sxy_i - Sx_i*Sy_i) / √denom_i : 0
|
||||
|
||||
// Phasor angle
|
||||
angle = 0
|
||||
if imag ≠ 0: angle = 90 + atan(real/imag) * (180/π)
|
||||
if imag > 0: angle -= 180
|
||||
|
||||
// Monotonic constraint
|
||||
angle = max(angle, prev_angle)
|
||||
prev_angle = angle
|
||||
|
||||
// State detection
|
||||
Δθ = |angle - saved_prev_angle|
|
||||
state = 0
|
||||
if Δθ < threshold and angle ≥ 0: state = +1
|
||||
if Δθ < threshold and angle ≤ 0: state = -1
|
||||
|
||||
return [real, imag, angle, state]
|
||||
```
|
||||
|
||||
### Output Interpretation
|
||||
|
||||
| Output | Range | Meaning |
|
||||
|
||||
Reference in New Issue
Block a user