mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 02:28:05 +00:00
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
Deep review of all indicator categories verified .md headers against .cs WarmupPeriod, parameters, inputs, and outputs. Fixes include warmup corrections, parameter documentation, output type accuracy, and Pine Script alignment.
This commit is contained in:
@@ -137,18 +137,18 @@ $$
|
||||
|
||||
### Operation Count (Streaming Mode)
|
||||
|
||||
AFIRMA chains AR model estimation with IIR/FIR filtering — O(p) per bar where p = AR order.
|
||||
Windowed FIR convolution — O(P) per bar where P = period (window length).
|
||||
|
||||
| Operation | Count | Cost (cycles) | Subtotal |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| AR coefficient estimation (p terms) | p | 4 cy | ~4p cy |
|
||||
| FIR forward pass (p multiplies) | p | 1 cy | ~p cy |
|
||||
| IIR feedback pass (p multiplies) | p | 1 cy | ~p cy |
|
||||
| Output computation via FMA | 1 | 1 cy | ~1 cy |
|
||||
| NaN guard + state update | 1 | 2 cy | ~2 cy |
|
||||
| **Total (p=8)** | **O(p)** | — | **~49 cy** |
|
||||
| RingBuffer write | 1 | ~2 cy | ~2 cy |
|
||||
| FIR convolution (P FMA ops) | P | ~1 cy | ~P cy |
|
||||
| Weight normalization | 1 | ~1 cy | ~1 cy |
|
||||
| LS regression (if enabled) | n | ~2 cy | ~2n cy |
|
||||
| NaN guard + state update | 1 | ~2 cy | ~2 cy |
|
||||
| **Total (P=20)** | **O(P)** | — | **~25 cy** |
|
||||
|
||||
O(p) per bar where p = AR order. AR coefficient estimation dominates; FMA-fused filter passes are cheap. Streaming mode maintains p state variables.
|
||||
O(P) per bar where P = window length. FMA-fused dot product dominates; LS regression adds O(n) where n = min(⌊(P−1)/2⌋, 50).
|
||||
|
||||
| Metric | Value | Notes |
|
||||
| :--- | :---: | :--- |
|
||||
|
||||
@@ -7,7 +7,7 @@ indicator("Autoregressive FIR Moving Average (AFIRMA)", "AFIRMA", overlay=true)
|
||||
//@param source Series to calculate AFIRMA from
|
||||
//@param period Lookback period - window size
|
||||
//@param windowType Window function type (1:Hanning, 2:Hamming, 3:Blackman, 4:Blackman-Harris)
|
||||
//@param leastSquares Apply least squares cubic polynomial fitting for autoregressive prediction
|
||||
//@param leastSquares Apply least squares linear regression fitting for autoregressive prediction
|
||||
//@returns AFIRMA value, calculates from first bar using available data
|
||||
//@optimized Uses windowing functions with O(n) complexity; least squares adds O(n) for polynomial fitting
|
||||
afirma(series float src, simple int period, simple int windowType=4, simple bool leastSquares=false) =>
|
||||
@@ -111,7 +111,7 @@ afirma(series float src, simple int period, simple int windowType=4, simple bool
|
||||
i_period = input.int(20, "Period", minval=1)
|
||||
i_source = input.source(close, "Source")
|
||||
i_windowType = input.int(4, "Window Function", minval=1, maxval=4, tooltip="1:Hanning, 2:Hamming, 3:Blackman, 4:Blackman-Harris")
|
||||
i_leastSquares = input.bool(false, "Least Squares Method", tooltip="Enable cubic polynomial fitting for autoregressive prediction")
|
||||
i_leastSquares = input.bool(false, "Least Squares Method", tooltip="Enable linear regression fitting for autoregressive prediction")
|
||||
|
||||
// Calculation
|
||||
afirma_value = afirma(i_source, i_period, i_windowType, i_leastSquares)
|
||||
|
||||
Reference in New Issue
Block a user