MAVP
Summary
Moving average whose period varies per bar, driven by a companion period series. For each bar it computes an MA of the selected type over the (clamped) period given by inPeriods.
Formula
p_i = clamp((int)inPeriods[startIdx+i], optInMinPeriod, optInMaxPeriod); outReal[i] = MA(inReal, p_i, optInMAType) at bar startIdx+i
Notes
- Fractional per-bar periods are truncated to whole numbers before being clamped to the minimum and maximum period.
- Period values of 1 perform no smoothing (the bar's output equals its input); the minimum allowed period is 1 since 0.6.5.
Inputs
inReal— series to be averagedinPeriods— per-bar desired MA period
Outputs
outReal— variable-period moving average
Parameters
optInMinPeriod— lower clamp for per-bar periodoptInMaxPeriod— upper clamp for per-bar periodoptInMAType— moving-average type applied
Implementation
TA-Lib Definition: mavp.c · mavp.yaml
| Native | File |
|---|---|
| C | ta_MAVP.c |
| Rust | mavp.rs |
| Java | Core.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Moving Average Variable Period, Variable Period Moving Average