FractalDimensionIndex
FractalDimensionIndex[period](price) in ProBuilder measures price complexity between 1 and 2, showing whether a market is trending or stuck in a range.
Syntax
FractalDimensionIndex[period](price)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
period | integer | 30 | Number of bars used to estimate the fractal dimension. Shorter windows react faster but flip regime more often. |
price | price source | close | Series analyzed, for example close, open, high, or low. |
Formula
FDI = estimated fractal dimension D of the price path over the last period bars
1 <= FDI <= 2The fractal dimension describes how completely a curve fills the space it moves through. A straight line has dimension 1, a curve so jagged it behaves like a filled plane approaches 2. The index estimates this dimension for the normalized price path inside the lookback window.
How it works
The concept comes from fractal geometry: a cleanly trending market traces a path that is close to a straight line, so its measured dimension stays near 1. A market that oscillates back and forth inside a range traces a far more convoluted path, and its dimension climbs toward 2. The indicator condenses that geometric property into a single regime gauge.
The conventional dividing line is 1.5. Values below it classify the window as trending, and the lower the reading the more one-directional the movement has been. Values above 1.5 classify it as ranging, with movement dominated by noise and mean reversion.
The index is direction-blind. A strong uptrend and a strong downtrend both produce low readings. It is therefore used as a filter that decides which kind of strategy to run, trend-following logic when the reading is low, range or mean-reversion logic when it is high, rather than as a signal generator on its own.
Examples
Example 1, Regime gauge with the 1.5 threshold (Indicator)
// Fractal dimension of the close over 30 bars
FDIValue = FractalDimensionIndex[30](close)
RETURN FDIValue AS "FDI", 1.5 AS "Trend threshold"Plots the 30-period Fractal Dimension Index against the standard 1.5 boundary that separates trending from ranging behavior.
Example 2, Breakouts only in trending regimes (ProOrder)
// Take channel breakouts only when the market is classified as trending
fdi = FractalDimensionIndex[30](close)
upBand = Highest[20](high)
IF NOT LongOnMarket THEN
IF fdi < 1.5 AND close > upBand[1] THEN
BUY 1 CONTRACT AT MARKET
ENDIF
ELSE
IF close < Average[20](close) THEN
SELL AT MARKET
ENDIF
ENDIFUses the index as a regime filter: 20-bar breakouts are only traded while the fractal dimension confirms trending conditions, filtering out breakouts inside choppy ranges.
Example 3, Screening for strongly trending markets (ProScreener)
fdi = FractalDimensionIndex[30](close)
// Low fractal dimension marks near-linear price paths
SCREENER[fdi < 1.4](fdi AS "FDI 30")Returns instruments whose 30-bar price path is close to linear, candidates for trend-following approaches regardless of direction.
Interpretation
| Reading | Market character |
|---|---|
| Close to 1 | Nearly linear path, strong trend in one direction. |
| Below 1.5 | Trending. The lower the value, the cleaner the trend. |
| Around 1.5 | Transitional, no clear classification. |
| Above 1.5 | Ranging, price movement is dominated by back-and-forth noise. |
The practical use is strategy selection and filtering. Combining the index with a directional tool, such as a moving average slope or ADX with DI lines, supplies the direction that the fractal dimension deliberately omits. Readings hovering near 1.5 are ambiguous and often best treated as no-signal territory.
Common errors and gotchas
- Reading direction into it. A value of 1.2 says the market is trending, not which way. Pairing the index with a directional measure is mandatory before placing directional trades.
- Wrong bracket type. The period goes in square brackets, the price source in parentheses:
FractalDimensionIndex[30](close).FractalDimensionIndex(30, close)raises a syntax error. - Lagging regime changes. The estimate describes the whole lookback window, so a fresh breakout from a long range keeps the reading above 1.5 for several bars. Expect the classification to trail the actual regime shift.
- Over-short periods. Small windows make the dimension estimate unstable and the regime label flips frequently. The default of 30 bars is a reasonable floor for most timeframes.
Related instructions
ADX, trend strength measure, also direction-blind.R2, coefficient of determination, how well price fits a straight line.LinearRegressionSlope, directional slope to pair with the regime filter.Volatility, alternative activity measure.STD, standard deviation of price.Supertrend, directional trend-following overlay.RSI, bounded oscillator suited to the ranging regime.Average, moving average for direction and exits.
