Hey WO gang!
Had some free time today, so I decided to fire up MATLAB and try to create some BTC/USD polar (a.k.a. spiral) price chart visualizations. This is a type of chart that is essentially a polar plot, with the angle representing time and the radius representing price. Depending on the amount of time per degree of angle, and the corresponding price at each point, cycles (or spirals) are formed, that have specific properties that can be very helpful in analyzing and detecting patterns in historical price data.
Warning: LONG post follows. For the impatient, tl;dr-type readers, at the end of the post there is a link to a cool animation that visually captures the entirety of this post!On to the juicy bits:
VISUALIZATION SETUPData source: | Bitstamp BTC/USD historical price data |
Data time span: | 28/11/2014 ~ 07/06/2022 (2749 days, or ~7.5 years) |
Granularity: | Daily (high/low price) |
Radius scale: | Logarithmic (base 10) |
Line colors: | Green = Daily High price | Red = Daily Low price |
Endpoints: | Trajectories begin near the center (2014 --> $$$) and end near the edge (2022 --> $$$$$) |
CASE 1: CHAOS! — CYCLE PERIOD = 4 WEEKS (~ 1 MONTH)Spirals? Where are they? I just see a blob! Each cycle is only
4 weeks long, and as a result of this, the entire polar chart is filled with
98 cycles spanning the entire 7.5 years of price data. There is no discernible pattern here, and the spirals cross each other wildly, due to price volatility and short cycle period.
Day-traders --> You are here!CASE 2: A PATTERN EMERGES — CYCLE PERIOD = 26 WEEKS (6 MONTHS)In this case, each cycle lasts
6 months, so the locus trajectory is now 6 times more compressed than in Case 1. This is somewhat equivalent to zooming out in a conventional x/y-type chart. Now the entire 7.5 years of historical price data forms only
15 full cycles. Notice how the spirals are now more spread apart and an outward pattern begins to emerge (outward = profit, inward = loss). It is still not very clear whether 6 months of HoDLing are enough for a decent chance of profiting, because there is still heavy overlapping between spirals, meaning that there are cases where the outer spirals "sink" inwards, resulting in a loss. However, the overall trend is noticeably profitable.
CASE 3: SPIRALS SPREAD — CYCLE PERIOD = 52 WEEKS (1 YEAR)Zooming out even more (with each spiral now spanning
1 year), we see that the spirals are now beginning to occupy more distinct, more regular loci, and are more evenly spread out in the chart. Only
7 full spirals (plus the tail) are needed to contain 7.5 years' worth of price data. A clear pattern now emerges: by HoDLing BTC for 1 year, there is a very good chance that the next spiral will begin further out (thus ending up in profit). There are still cases where the spirals are intertwined, and this means that HoDLers should be prepared to wait for a little while longer, if they are unlucky enough to end up in those regions.
CASE 4: THE BIG PICTURE — CYCLE PERIOD = 104 WEEKS (2 YEARS)Bitcoin's long-term upward trend is now apparent. HoDLing BTC for 2 years is a near-winning strategy. Each spiral now takes
2 years to complete, and it takes
just under 4 full cycles to contain the entire set of historical price data. Still, there are a few cases where the spirals cross, and this can be a deadly trap for some weak HoDLers.
mindrust fell right into one such trap, when he sold his 10 coins at the
red-shaded region in the above chart.
CASE 5: A SINGLE, OUTWARD SPIRAL! — CYCLE PERIOD = 208 WEEKS (4 YEARS)This is the most important of the 5 cases, as it clearly demonstrates that the entire 7.5 years of historical price data forms a single, continuous, monotonically outward spiral, taking
just under 2 full cycles in the chart.
Note that the spiral loci of each 4-year cycle NEVER CROSS! This means that anyone who decided to buy BTC and HoDL it for a period of 4 years, at any time point from the end of 2014 up to now (2022) would be in profit! There is no continuous 4-year period in that chart that has resulted in a loss. How much profit? By observing the distances of the adjacent (same-angle) loci (i.e., those belonging to adjacent cycles), we see that they are roughly one order of magnitude apart. This means that HoDLing BTC for 4 years within the data set has resulted in
an average profit of 10x of the investment value. This is a very powerful result that gives us a taste of what's to come. Nothing is guaranteed, obviously, but 7.5 years of price data is a big enough set to paint a pretty clear picture of the future.
Strong Hands/HoDLers --> You are here!RELATIONSHIP WITH WEEKLY MOVING AVERAGE INDICATORSAlthough it is tempting to equate the above analysis/visualization with the familiar x-WMA indicators (particularly, the 208-, 104- and 52-WMA), it should be stressed that there is absolutely
no averaging whatsoever taking place in the above polar plots. What is actually happening is an
angular compression of the huge 7.5-year-long spiral, but
without averaging any part of the data. In other words, if there was even a single one-day-wide spike in the spiral trajectory, it would clearly show up in the graphs with a line thick enough to fill several pixels (MATLAB has an extremely precise visualization engine that correctly handles such cases). I have, nonetheless, verified this, by deliberately adding a single one-sample outlier to the data, and it appeared very clearly and as expected (see
here for proof). To recap: we are talking about daily high/low prices here, not averages which could filter/smooth out fast-changing elements in the data set. Having said that, the observed similarity between the above polar plots and the corresponding x-WMA charts is interesting, and, IMHO, strengthens the validity of both.
WRAPPING IT UP: COMPRESSING THE SPIRAL — VIDEO ANIMATIONFor some cool eye-candy, here is an animation I created, which shows the entire process of "compressing the spiral", from 4 weeks all the way up to 4 years! Everything in this animation is generated by MATLAB code and is a result of numerical calculations. Nothing has been added after the fact. Kudos to MathWorks for creating such a powerful and efficient numerical analysis tool—always a pleasure to use.
Bitstamp BTC/USD Polar Chart Animation | 28/11/2014 ~ 07/06/2022 (2749 days)Enjoy!
__________
"If you are going to invest in #bitcoin, a short time horizon is four years, a mid time horizon is ten years, & the right time horizon is #forever." — Michael Saylor
Edit:MATLAB SOURCE CODENote: In order to be able to execute the following code, a "MATLAB Workspace" file needs to be available, named bitstamp_btc_usd.mat, that contains Bitstamp's BTC/USD historical price data. This file must contain a matrix called data, whose 3rd and 4th column must contain daily high and low price data, respectively, in descending time. Alternatively, this data can be provided in vectors r_high and r_low, respectively, with the appropriate scaling and logarithmic conversion, as shown in the code.% MATLAB code written by AlcoHoDL --- Wall Observer / BitcoinTalk Forum
% Date: Tuesday, 7 June 2022
% Post: https://bitcointalksearch.org/topic/m.60310898
% Initialize environment
clc
close all
clear variables
% Load Bitstamp BTC/USD historical price data
load bitstamp_btc_usd
% Start video recording engine
v = VideoWriter('btc_usd_spiral.avi');
open(v);
% Out-of-loop variables
i = 1:size(data,1);
r_high = log10(data{i,3}/10);
r_low = log10(data{i,4}/10);
dim1 = [0.02 0.08 0 0];
dim2 = [0.98 0.08 0 0];
% Loop
for c = 28:365.25*4
% Generate polar plot figure
th = 2*pi*(i-1)/c+pi/2;
polarplot(th,r_low,th,r_high,'LineWidth',3)
% Set position & title
set(gcf,'Position',[620 300 680 560])
title('Bitstamp BTC/USD Polar Chart | 28/11/2014 ~ 07/06/2022 (2749 days)','FontSize',14)
% Set axes labels
for t = 1:12
ttl{mod(t+2,12)+1,1} = ['{\itt} - ' num2str(floor((t-1)*c/12))];
end
ttl{4} = ['{\bfNow} (' ttl{4} ' days/cycle)'];
ax = gca;
ax.FontSize = 12;
ax.ThetaTickLabel = ttl;
ax.RTickLabel = {'';'$100';'$1k';'$10k';'$100k'};
ax.Children(1).Color = [0.0 0.7 0.0];
ax.Children(2).Color = [1.0 0.0 0.0];
% Add/update left annotation
if exist('an1','var'), delete(an1); end
wks = num2str(floor(c/7));
yrs = num2str(c/365.25,'%.1f');
if str2double(yrs) == 1, tail = ''; else, tail = 's'; end
str = ['{\bf1} cycle = {\bf' wks '} weeks ({\bf' yrs '} year' tail ')'];
an1 = annotation('textbox',dim1,'String',str,'FitBoxToText','on');
an1.FontSize = 12;
% Add/update right annotation
if exist('an2','var'), delete(an2); end
str = ['Number of full cycles: {\bf' num2str(floor(size(data,1)/c)) '}'];
an2 = annotation('textbox',dim2,'String',str,'FitBoxToText','on');
an2.FontSize = 12;
an2.HorizontalAlignment = 'right';
% Force figure drawing
drawnow
% Capture & record current frame
f = getframe(gcf);
writeVideo(v,f);
end
% Close video file
close(v);
Edit 2:Some further analysis and interesting results based on the above visualization can be found in
my reply to a question posted by Hueristic.