Closed neilsmurphy closed 4 years ago
Suggested solution by @rafaeltg:
Removing self.p.prepend_constant in order to avoid invalid result parameters order. With prepend = True intercept is the first parameter and slope the second.
There is a pull request for this in mementum/backtrader. I have asked the creator of the PR to issue it here.
Merged in mementum/backtrader.
Andre Tavares posted this question in the community:
The code in question can be found in the indicators/ols.py module at line 58.
My cursory look at statsmodel documentation suggests that the backtrader implementation is incorrect and backwards. \
Here are a few helpful links. https://www.statsmodels.org/devel/generated/statsmodels.regression.linear_model.OLS.html https://www.statsmodels.org/stable/examples/notebooks/generated/ols.html
Thoughts?