My first attempt at moving average cross overs using t statistic of regression slope to affirm trend.
My first attempt at moving average cross overs using t statistic of regression slope to affirm trend.
After playing around with your code a bit I would suggest removing the (if p_value > .01) part out of the exit condition. I believe this could cause a breakout to exit the trade. Also a 5% stop loss doesn't hurt either. I have been trying to work with linear regression models also, but I never though to use the t-statistic. That was really smart. Thanks for sharing.