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
-9
View File
@@ -18,15 +18,6 @@ The "physics" of ALMA are defined by three parameters:
2. **Offset**: Determines where the peak of the Gaussian curve sits. An offset of 0.85 (default) pushes the weight towards the most recent data, reducing lag significantly while maintaining smoothness.
3. **Sigma**: The standard deviation of the bell curve. A higher sigma (e.g., 6.0) makes the curve sharper, focusing weights tightly around the offset.
### Zero-Allocation Design
Our implementation is a study in memory discipline.
- **Precomputed Weights**: The Gaussian weights are calculated once in the constructor.
- **RingBuffer**: We use a circular buffer to store the price window, avoiding array shifts.
- **SIMD Optimization**: The weighted sum calculation uses `Vector<double>` dot products where possible, or optimized loop unrolling.
- **Stack Allocation**: For the static `Calculate` method, we use `stackalloc` for small periods to avoid heap pressure entirely.
## Mathematical Foundation
The weight $W_i$ for the $i$-th element in the window is calculated as: