dimension is a ratio providing a statistical measure of complexity comparing how detail in a pattern changes with the scale at which it's measured.
The concept of a fractional or dimension was derived from an unconventional approach to standard geometric definitions.
We all know the standard geometric rules of dimension: D=0 is a point, D=1 is a line, D=2 is a plane, and D=3 is a , based on the number of axes being occupied.
However, by taking a geometric approach, we can define dimension like so:
N = s^-D , where N is the number of measurement segments, s is the scale factor, and D is the dimension of the object being measured.
This approach typifies conventional knowledge of dimensions as well. Here are some basic examples:
If we divide a line segment into 4 equal line segments, then we'd get 4 = (1/4)^-D. Solving for D, we get D=1, which is what we'd expect from a line.
If we divide a square into 16 equal squares, we'd be separating each line on the square into 4 pieces, so 16 = (1/4)^-D. Solving for D, we get D=2, which is what we'd expect from a square.
If we divide a cube into 64 equal cubes, we'd be separating each line on the cube into 4 pieces, so 64 = (1/4)^-D. Solving for D, we get D=3, which is what we'd expect from a cube.
The same approach can be applied to objects, although admittedly it's less intuitive.
Let's say you use a stick to measure a curve, then you divide the stick into 3 equal segments and re-measure the length.
But rather than the re-measured curve showing a length of 3 of the smaller segments, it is actually 4 segments long.
This irregularity means that detail has increased as you scaled your measurement down, so the curve is dimensionally higher than the space it resides in.
In this example: 4 = (1/3)^-D. Solving for D, we get D=1.2619.
For a true , this scaling of self-similar measurements would continue infinitely.
However, unlike true fractals, most real world phenomena exhibit limited properties, in which they can be scaled down to some limited quantity.
Many forms of time series data (seismic data, ECG data, financial data, etc.) have been theoretically shown to have limited properties.
Consequently, we can estimate dimension from this data to get an approximate measure of how rough or convoluted the data stream is.
Financial data's dimension is limited to between 1 and 2, so it can be used to roughly approximate the Hurst Exponent by the relationship H = 2 - D.
When D=1.5, data statistically behaves like a random walk. D above 1.5 can be considered more rough or "mean reverting" due to the increase in complexity of the series.
D below 1.5 can be considered more prone to trending due to the decrease in complexity of the series.
In this study, you are given the option to apply equalization (EQ) to the dataset before estimating dimension.
This enables you to transform your data and observe how its complexity changes as well.
Whether you want to give emphasis to some frequencies, isolate specific bands, or completely alter the shape of your waveform, EQ filtration makes for an interesting experience.
The default EQ preset in this script removes the low shelf, then attenuates low end and high end oscillations.
The dominant cyclical components (bands 3 - 5 on default settings) are passed at 100%, keeping emphasis on 8 to 64 sample per cycle oscillations.
In addition, if you're wanting a simpler filter process, or if you want a little extra, there are options included to pre and post smooth the data with 2 pole Butterworth LPFs.
The dimension estimation in this script works by measuring changes in detail using source's maximum range over a given lookback length.
In essence, it recursively updates its length parameter based on changes in range compared to the maximum over the lookback period, then uses the data to solve for D.
The FDI algorithm works on any length greater than 1. However, I didn't notice any particularly meaningful results with lookback lengths of 15 or less.
A custom color scheme is included in this script as well for FDI fill and bar colors.
The color scheme in this script is a multicolored thermal styled gradient.
The scale of gradient values is determined by the designated high and low dimension thresholds. These thresholds determine what range of values the gradient will focus on.
Values at the high threshold are the coolest and darkest, and values at the low threshold are the warmest and brightest.
Basically, the "trendier" the data is, the brighter and warmer the color will be.
Signals and alerts are included as well for crossovers on the high and low dimension thresholds.
These signals can also be externally linked to another script.
The output format is 1 for the trigger, and 0 otherwise. Basic boolean logic.
To integrate these signals with your script, simply use a source input and select the signal output from this script that you wish to use from the dropdown menu.
dimension is a powerful tool that can give valuable insight about the complexity and persistence / anti-persistence of price movements.
When used in conjunction with other analytical methods, it can prove to be a surprisingly beneficial tool to have in the arsenal.
This is a premium script, and access is granted on an invite-only basis.
To gain access, get a copy of the indicator overview, or for additional inquiries, send me a direct message.
I look forward to hearing from you!
Trading stocks, , Forex, options, ETFs, cryptocurrencies or any other financial instrument has large potential rewards, but also large potential risk.
You must be aware of the risks and be willing to accept them in order to invest in stocks, , Forex, options, ETFs or cryptocurrencies.
Don’t trade with money you can’t afford to lose.
This is neither a solicitation nor an offer to Buy/Sell stocks, , Forex, options, ETFs, cryptocurrencies or any other financial instrument.
No representation is being made that any account will or is likely to achieve profits or losses of any kind.
The past performance of any trading system or methodology is not necessarily indicative of future results.
This script is an index reflecting complexity of the series. Fractal dimension does not give directional information, nor does it necessarily indicate tops and bottoms. But low fractal dimension values often correlate with time series peaks and valleys.
In really simplistic terms, it is a descriptor of how linear price is behaving. Dimension values closer to 1 will behave more like a straight line, thus being perceived as more "trendy". And dimension values closer to 2 will behave more like a plane, thus being perceived as more choppy or "mean reverting".
I hope that makes sense.
And the color scheme is customizable, so you could make the whole thing a single color if you really wanted to.
The bright color indicates a Zen stroke, while darker color indicates a Zen hub, they are two basic forms of markets in Zen theory.
It is similar in nature to other volatility measures in the fact that it does not give any directional information, but also very different since we're measuring how complex the data stream is rather than the range price is fluctuating within like with ATR.
To really make the most out of using fractal dimension in your analysis, I would recommend pairing it up with tools that do give direction information, as I did in my FTTS script.