mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 05:28:05 +00:00
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:
+1
-14
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user