backtrader.mathsupport module¶
Math Support Module - Mathematical functions for indicator calculations.
This module provides mathematical utility functions for calculating statistics used in technical indicators, such as average, variance, and standard deviation.
- Functions:
average: Calculate arithmetic mean with optional Bessel’s correction. variance: Calculate variance from a sequence. standarddev: Calculate standard deviation with Bessel’s correction option.
Note
These functions are primarily used for indicator calculations. For large datasets, numpy-based implementations would provide better performance.
- backtrader.mathsupport.is_finite_real(value)[source]¶
Check if a value is a finite real number (not complex, not NaN, not inf).
- Parameters:
value – The value to check.
- Returns:
True if value is a finite real number, False otherwise.
- Return type:
- backtrader.mathsupport.average(x, bessel=False)[source]¶
:param : param x: iterable with len :param : param bessel: default False, reduces the length of the array for the
division.
- Returns:
A float with the average of the elements of x