Advanced Fractal Dimension Index [DW]

This is an experimental study based on Benoit Mandelbrot's fractal dimension concepts.

Fractal 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 fractal 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 volume, based on the number of axes being occupied.
However, by taking a fractal 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 fractal 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 fractal, this scaling of self-similar measurements would continue infinitely.
However, unlike true fractals, most real world phenomena exhibit limited fractal 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 fractal properties.
Consequently, we can estimate fractal dimension from this data to get an approximate measure of how rough or convoluted the data stream is.

Financial data's fractal 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.

Fractal 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!


General Disclaimer:
Trading stocks, futures, 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, futures, 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, futures, 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.

For my full list of premium tools, check the blog:

Reach out on Telegram:
초대 전용 스크립트

이 스크립트에 대한 접근은 작성자가 승인한 사용자로 제한되며, 일반적으로 지불이 필요합니다. 즐겨찾기에 추가할 수 있지만 권한을 요청하고 작성자에게 권한을 받은 후에만 사용할 수 있습니다. 자세한 내용은 DonovanWall에게 문의하거나 아래의 작성자의 지시사항을 따르십시오.

트레이딩뷰는 당신이 스크립트 작성자를 100% 신뢰하고 스크립트의 작동 방식을 이해할 때까지 스크립트 비용을 지불하고 사용할 것을 권장하지 않습니다. 대부분의 경우 트레이딩뷰의 커뮤니티 스크립트 에서 무료로 좋은 오픈 소스 대안을 찾을 수 있습니다.


이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?

경고: 액세스를 요청하기 전에 읽으십시오 .