Following up my earlier post on fractional dimensions, I wrote a Python script to automate the technique. It does the measurements on various scales, runs the regression, and produces a chart. This will allow me to analyze more stocks, and over varying timeframes. It also surfaced a computational problem that will be important for developing an indicator.
Shown here is the result for AAPL daily closes in 2016. It matches, approximately, my hand calculation from before – and with a higher R-square.
The computational problem is that, when you are measuring over scale S, there are actually S distinct series to measure. For example, when S = 2, you can measure across all the even-numbered observations, or all the odd ones. The two results will be different, making any kind of trailing indicator erratic. Plus, it seems like a waste of good data.
So, as you can see from the code, I take all the measurements of scale S, average them, and then multiply by N/S, where N is the total number of observations. This gives an idealized L(S) using all the data.
The practical problem is that the Hausdorff dimension describes the entire sample period, like a Volume by Price chart, and it yields a single number. In theory, this tells how much noise to expect on lower timeframes, between moves of a given size on the higher timeframe. That would be handy to know when setting stops.