Summary
AccelerationBands is RTTA's streaming Price Headley acceleration bands: upper
and lower envelopes formed by simple averages of range-scaled highs and lows,
with a middle SMA of close.
Update API
result = rtta.AccelerationBands(window=20, factor=4.0, fillna=True).update(close, high, low)
| Parameter | Default | Meaning |
|---|---|---|
window |
20 |
SMA length for upper, lower, and middle |
factor |
4.0 |
Range-scale factor \(f\) |
fillna |
True |
If False, NaN until window samples |
update(...) returns a result with fields middle, upper, lower.
advance(close, high, low) updates state; last() returns the cached result.
Theory Of Operation
Each bar's high and low are expanded or contracted by a fraction of the bar range relative to the bar's mid-range \(h+l\):
The upper source is \(h_t(1+s_t)\) and the lower source is \(l_t(1-s_t)\). Wide range bars push the sources farther apart (more "acceleration"); quiet bars pull them in. Independent SMAs of those sources form the plotted bands; the middle band is a plain SMA of close for reference.
Breaks above the upper band or below the lower band are often read as momentum extremes; tags of the middle can act as mean-reversion context.
Recurrence
Let \(c_t,h_t,l_t\) be close, high, low; \(n\) the window; \(f\) the factor.
(division is safe-divided in C++ when \(h_t+l_t=0\)).
Result: middle \(= M_t\), upper \(= U_t\), lower \(= L_t\).
When fillna=False and fewer than \(n\) samples have been seen, all three
fields are NaN. Upper/lower SMAs always use fillna=True internally so their
partial averages exist; the outer fillna gate controls the returned struct.
Implementation Notes
- Implemented in
src/rtta/indicator.cppinclass AccelerationBands. - Result type:
AccelerationBandsResult(middle,upper,lower). - Three independent
SMAinstances:upper_sma_,lower_sma_,middle_sma_. - Batch helper:
batch_acceleration_bands.
