talib.ACCBANDS
Calculates the Acceleration Bands and returns the upper band, middle band and lower band.
talib.ACCBANDS(inPriceHLC)
talib.ACCBANDS(inPriceHLC, optInTimePeriod)Examples
Compute the Acceleration Bands from the latest K-lines.
javascript
function main() {
var records = exchange.GetRecords()
if (!records) return
var ret = talib.ACCBANDS(records)
// Output: [upper band array, middle band array, lower band array]
Log(ret)
}
python
import talib
def main():
records = exchange.GetRecords()
if not records:
return
upper, middle, lower = talib.ACCBANDS(records.High, records.Low, records.Close)
# Output: (upper band array, middle band array, lower band array)
Log(upper, middle, lower)Returns
| Type | Description |
array | Two-dimensional array: [upper band array, middle band array, lower band array] (a tuple in the same order in Python). |
Arguments
| Name | Type | Required | Description |
inPriceHLC |
| Yes | K-line array; the high, low and close fields are used. In Python, pass |
optInTimePeriod | number | No | Calculation period. Default |
See Also
Remarks
TA-Lib equivalent: ACCBANDS(Records[High,Low,Close],Time Period = 20) = [Array(outRealUpperBand),Array(outRealMiddleBand),Array(outRealLowerBand)].
The upper band is the simple moving average of High * (1 + 4 * (High - Low) / (High + Low)), the middle band is the simple moving average of the close price, and the lower band is the simple moving average of Low * (1 - 4 * (High - Low) / (High + Low)), all over optInTimePeriod bars.
In Python, TA-Lib provides this function from version 0.6 (both the C library and the Python package must be 0.6 or later); older versions raise an attribute error.