Accumulative Swing Index (Wilder, 1978) — the running total of
swingIndex:
${output}[i] =ΣSI[0..i]
Appends one column. Where the swing index is a per-bar reading, the ASI is
a level: Wilder's point is that it behaves like a smoothed price series
whose own trendlines and breakouts are cleaner than the price's, so it is
read for support/resistance breaks and for divergence against price.
It is the cumulative sum of that array, through cumulativeValues — not a second derivation of the same formula — so every
decision on swingIndex (the required limit, the R === 0 rule,
the one-bar warm-up) is inherited by construction rather than restated.
The running-sum asymmetry, inherited
cumulativeValues' two rules apply unchanged, and the second one
matters here:
A leading run of gaps shifts the start — the sum begins at the first
bar with a swing, which on clean input is bar 1.
An interior gap propagates to the end. Every level after an unknown
swing is a known sum plus an unknown. A halted two-bar stretch
(R === 0) is such a gap, so the ASI ends there rather than skipping
it. That is the same call OBV and the A/D line make, for the same
reason: a level that is silently short by a missing contribution is
worse than no level. Fill or drop the halted bars first if you need
continuity.
The ASI starts at the first swing's value, not at zero — Wilder's own
arrangement, and the one every cumulative study in this package uses.
Accumulative Swing Index (Wilder, 1978) — the running total of swingIndex:
Appends one column. Where the swing index is a per-bar reading, the ASI is a level: Wilder's point is that it behaves like a smoothed price series whose own trendlines and breakouts are cleaner than the price's, so it is read for support/resistance breaks and for divergence against price.
It is the cumulative sum of that array, through cumulativeValues — not a second derivation of the same formula — so every decision on swingIndex (the required
limit, theR === 0rule, the one-bar warm-up) is inherited by construction rather than restated.The running-sum asymmetry, inherited
cumulativeValues' two rules apply unchanged, and the second one matters here:
R === 0) is such a gap, so the ASI ends there rather than skipping it. That is the same call OBV and the A/D line make, for the same reason: a level that is silently short by a missing contribution is worse than no level. Fill or drop the halted bars first if you need continuity.The ASI starts at the first swing's value, not at zero — Wilder's own arrangement, and the one every cumulative study in this package uses.