Bollinger low and high calculate the standard deviation as follows:
mstd = close.rolling(n, min_periods=0).std()
According to the Pandas documentation, std() uses (N - ddof) as the denominator, where ddof defaults to 1, unlike numpy std().
StockCharts has an example of Bollinger in Excel which, unsurprisingly, uses N as the denominator. Wikipedia explains that N - 1 is used if the sd is being calculated from a sample of the population, rather than the whole. As this is rolling, and a very small set of numbers, I assume Pandas is calculating the actual sd from all the data fed to it, therefore we should use N.
Bollinger low and high calculate the standard deviation as follows:
According to the Pandas documentation, std() uses (N - ddof) as the denominator, where ddof defaults to 1, unlike numpy std().
StockCharts has an example of Bollinger in Excel which, unsurprisingly, uses N as the denominator. Wikipedia explains that N - 1 is used if the sd is being calculated from a sample of the population, rather than the whole. As this is rolling, and a very small set of numbers, I assume Pandas is calculating the actual sd from all the data fed to it, therefore we should use N.
The high and low band Bollinger calcs should be:
The same applies to the Bollinger indicators.