Monday, September 2, 2019

Finally some correlation results


Finally, the first correlation results. Recall, I’m trying to answer the following question. Do recent prices predict future ones? I want to address this question before moving on to specific buy and sell indicators. If the answer to is no, then the entire project may have no value. I’ve decided to look at the correlation between past and future prices. This won’t provide a clear answer. But it will be an indicator that will impact my enthusiasm. So, how to see if the correlations are good enough? To echo US Supreme Court Justice Potter Stewart on pornography, “but I know it when I see it”.

It has proven to be more difficult than I thought. That’s either because (1) it’s the more complex code than I thought, (2) I’ve finally reached the age where my abilities are declining, or (3) trying to do this while in a nursing home is a hinderance. I tend to believe it’s (3) because of the interruptions and/or effects of the pain medication.

I written code that starts with January 1st, 2019 and steps through one day at a time. For each day, it picks a previous day as a starting point and a future day as the ending date. Initially these 2 limits are set at 9 days before and 9 days after the specific day. Then the code loops through all possible combinations down to 1 day before and 1 day after. That’s 81 combinations per day. For each combination the code computes the correlation of BTC prices over the selected period. I also compute the growth rate (Slope in linear regression) and Trend (2nd derivative in quadratic regression) over each period. The correlations for specific period end points were analyzed (average, minimum, and maximum).

Following is a sample of some end points. For each combination of end points, there were 201 days. The end points were sorted by their average correlation. The 1st 5 lines have the highest average, while the last 3 have the lowest average .

Day1
 Day2
 Day3
Num Corr
Ave Corr
Min Corr
Max Corr
Num Var
Slope
Trend
Last Date
-9
0
9
201
0.308
-0.871
0.956
9
-180.57
54.57
2019-07-20
-9
0
8
201
0.304
-0.867
0.966
9
-180.57
54.57
2019-07-20
-9
0
7
201
0.299
-0.870
0.973
9
-180.57
54.57
2019-07-20
-8
0
9
201
0.299
-0.867
0.966
8
-183.70
102.65
2019-07-20
-8
0
8
201
0.295
-0.870
0.973
8
-183.70
102.65
2019-07-20











-1
0
3
201
0.201
-0.916
0.991
1
418.39
0.00
2019-07-20
-2
0
1
201
0.199
-0.975
1.000
2
418.39
0.00
2019-07-20
-1
0
2
201
0.194
-0.975
1.000
1
418.39
0.00
2019-07-20


This has led to some observations and questions.

·       The highest observed correlations were slightly above 0.3. Not high enough to make me confident. Is there anyway this can be enhanced?
·       The lowest correlations were also positive. Well that would generally be good news. But, what does that say about sell signals?
·       Most unsettlingly is the fact that the best correlations are clustered around the extreme end points (9 days before and 9 days after). These limits were arbitrarily assigned. What does this mean?

I’ll start addressing these issues in my next post. Since the complex code is finished, the posts should come more regularly. Follow me on Twitter, @billlanke, to know when I post. If you have questions or comments, contact me at ole44bill@gmail.com.

No comments:

Post a Comment