mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 17:48: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 @@
|
||||
# TYPPRICE: Typical Price
|
||||
|
||||
> *Typical price weights high, low, and close equally — a three-point summary that drops the open and keeps the essential.*
|
||||
|
||||
| Property | Value |
|
||||
| ---------------- | -------------------------------- |
|
||||
| **Category** | Core |
|
||||
@@ -59,23 +61,6 @@ $O(1)$ per bar. One addition, one FMA. No memory allocation. Always hot after th
|
||||
|
||||
Division by a non-power-of-two constant is 4-5x more expensive than multiplication on modern x86 CPUs (~15 cycles vs ~3 cycles). Precomputing $\frac{1}{3}$ as a `const double` and multiplying eliminates the division entirely. The compiler constant-folds `1.0 / 3.0` to the IEEE 754 double `0x3FD5555555555555` at compile time, so the hot path sees only multiply/FMA operations.
|
||||
|
||||
### Pseudo-code
|
||||
|
||||
```text
|
||||
function TYPPRICE(bar):
|
||||
const OneThird ← 1.0 / 3.0 // compile-time constant
|
||||
|
||||
o, h, l ← bar.Open, bar.High, bar.Low
|
||||
|
||||
// Substitute last-valid for non-finite inputs
|
||||
if !finite(o): o ← lastValidOpen
|
||||
if !finite(h): h ← lastValidHigh
|
||||
if !finite(l): l ← lastValidLow
|
||||
|
||||
result ← FMA(o, OneThird, (h + l) × OneThird)
|
||||
return result
|
||||
```
|
||||
|
||||
### Output Interpretation
|
||||
|
||||
| Context | Meaning |
|
||||
|
||||
Reference in New Issue
Block a user