Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does Bollinger Bands use ddof=0 instead of the default ddof=1? #307

Open
matt-seaton opened this issue Oct 29, 2022 · 1 comment
Open

Comments

@matt-seaton
Copy link

This is not the standard calculation. It does not match the bb calculated from any other charting software I use, and the bands are now biased. What is the reasoning here?

@QGB
Copy link

QGB commented Jul 4, 2023

The Bollinger Bands use ddof=0 instead of the default ddof=1 in order to calculate the standard deviation.

In statistics, there are two common methods for calculating the standard deviation: sample standard deviation and population standard deviation. The difference between these methods lies in the degrees of freedom, which is the denominator in the calculation.

By default, many statistical software and functions use the sample standard deviation (ddof=1) as it is often more appropriate for estimating population parameters from sample data. This method subtracts 1 from the degrees of freedom in the denominator to better reflect the variability in the sample data.

However, when it comes to calculating the Bollinger Bands, using ddof=0 is more common. This is because the purpose of the Bollinger Bands is to assess price volatility and determine the positioning of the upper and lower bands based on the measurement of standard deviation. In this case, using ddof=0 ensures that the calculation of the standard deviation is based on the sum of squared deviations of the entire dataset, providing a more comprehensive estimate of volatility.

In summary, the Bollinger Bands use ddof=0 to consider the entire dataset when calculating the standard deviation, in order to more accurately assess price volatility. This choice aligns with the specific goals and purposes of the Bollinger Bands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants