Friday, September 6, 2019

Filter by slope and trend


The next and final topic I want to look at is using 2 regression results to filter the correlation results in order to finally answer the questionDo recent prices predict future ones? “. The previous results were unsatisfactory in my mind. All along I’ve included 2 regression calculations in my code, linear and quadratic. My correlation analysis starts by looking at BTC prices over a past number of days, let’s use the previous 7 days. We then use linear regression to fit a straight line through these 7 data points. The slope of the resulting equation indicates a growing price (positive slope) or a declining price (negative slope). We then did quadratic regression on the same 7 data points. The result is an equation that is curved. The 2nd co-efficient indicates the curve is bending upward (positive number) or downward (negative number). I refer to this as “Trend”. I first discussed regression (with plots) on this blog back in July.

After fooling around with several parameters, I decided to put limits on several items. Ultimately, I selected a range from 7 days before and 7 days after a given day. I also created 2 indicators. The 1st represented the slope and the 2nd represented the trend. Each is a single letter, B-buy because the value is positive, N-neutral because value was not computed, or S-sell because value is negative. Following is a table of values from the analysis.

Indicator
Ave Corr 2018
Ave Corr 2019

Description
2018
2019
BB
0.390
0.382

Total days
365
201
BN
0.062
0.089

Both slope and trend non-negative
241
128
BS
0.165
0.147

Both positive (no Day1 -1, -2, or -3)
208
110
SB
-0.332
-0.316

Range -7 to 7 BB
132
78
SN
-0.213
-0.188

Range -7 to 7 SS
153
83
SS
-0.559
-0.564




Grand Total
-0.099
-0.077





There was a clear difference in the average correlations. The best positive correlation occurred when both indicators were “B-buy”. The most negative was when both signaled “S-sell”. Clearly the use of factors enhanced the results of the analysis. The right columns of numbers counted the number of days that had clear buy or sell signals. More good news, it appears as though there are enough days with good indicators to make active trading a worthwhile project.

Finally, I’ve answered the question “Do recent prices predict future ones? “. The answer is yes. I’ll continue with the project and include these factors in my studies. Next up, the use of Bollinger Bands to predict BTC prices. I’ll tweet, @billlanke, when I post on the blog.

No comments:

Post a Comment