Take a look at the recordings of the bollinger band function I've pieced together from different examples on this site. For the love of me, I cannot get the data to correspond to the values I get when using Interactive Brokers, Tradingview or Stockcharts.
I imagine talib has been tested and vetted to the max. So the error is obviously in my code. But what's wrong?
Here's a link to the same chart in stockcharts, in which I indicate on which days closing price ends above or below a bollinger band set at 2 standard deviations with a 14 day setting.
As you see, the price closed above bollingers 4 times and below 4 times over the period in question. The results in my Q program are quite different The price seems to only close above the bollinger once on March 29. I understand there will be slight deviations on how different programs report pricing on given days, but this should also cause the bollinger calculations to move proportionately, and therefore not affect the overall trigger decisions.
Also check out the upper bollinger on Jan 27. It reads around 112.68 at at time Stockcharts shows it to be 120! In percentage terms, these are enormous differences.
The resulting errors are so wide that a strategy that otherwise can make money becomes a losing one. Hopefully someone can solve this for me, and if not, at least others can be alerted to this problem and save themselves a lot of grief.
Thanks for any input or critiques.
|Returns||1 Month||3 Month||6 Month||12 Month|
|Alpha||1 Month||3 Month||6 Month||12 Month|
|Beta||1 Month||3 Month||6 Month||12 Month|
|Sharpe||1 Month||3 Month||6 Month||12 Month|
|Sortino||1 Month||3 Month||6 Month||12 Month|
|Volatility||1 Month||3 Month||6 Month||12 Month|
|Max Drawdown||1 Month||3 Month||6 Month||12 Month|