Refactor documentation to remove "Zero-Allocation Design" sections across various trend indicators and implement a PowerShell script for automated cleanup

- Updated mathematical foundations and performance profiles where necessary to maintain clarity and coherence.
This commit is contained in:
Miha Kralj
2025-12-21 14:37:44 -08:00
parent 54c309e5cf
commit a7b7207801
65 changed files with 1766 additions and 482 deletions
+1 -14
View File
@@ -14,7 +14,7 @@ A naive WMA implementation is $O(N)$, requiring a full loop over the history win
### The O(1) Algorithm
We maintain two sums:
Two sums are maintained:
1. `Sum`: The simple sum of values (like SMA).
2. `WSum`: The weighted sum.
@@ -38,19 +38,6 @@ The denominator is the sum of the weights (triangular number).
## Performance Profile
### Zero-Allocation Design
WMA uses a pre-allocated `RingBuffer` and maintains dual running sums (`Sum` and `WSum`) in a struct. This design ensures that the hot path is entirely allocation-free.
| Metric | Score | Notes |
| :--- | :--- | :--- |
| **Throughput** | High | O(1) algorithm |
| **Complexity** | O(1) | Constant time update |
| **Accuracy** | 6/10 | Linearly weighted to recent data |
| **Timeliness** | 6/10 | Reduced lag compared to SMA (Lag ≈ N/3) |
| **Overshoot** | 8/10 | Stable, minimal overshoot |
| **Smoothness** | 5/10 | Less smoothing than SMA |
## Validation
Validated against TA-Lib (`TA_WMA`) and Skender.Stock.Indicators.