DFA Pass Node

Detrended Fluctuation Analysis — Series Input

StatisticalFractalPass

Overview

Detrended Fluctuation Analysis (DFA) quantifies the long-range correlation structure of a time series by computing a scaling exponent α. It avoids spurious correlations from non-stationarity by detrending integrated series in windows before measuring fluctuations.

The DFA exponent α is related to but distinct from the Hurst exponent and provides a complementary view of fractal market structure.

Formula

DFA Scaling Exponent:
1. Integrate: Y(k) = Σᵢ[x(i) − mean(x)] for k = 1…N
2. Divide into non-overlapping windows of size s
3. Detrend each window by fitting a linear trend
4. Compute RMS of residuals F(s)
5. Fit: log F(s) ~ α × log(s)
α > 0.5 = persistent (trending); α < 0.5 = anti-persistent (mean-reverting); α ≈ 0.5 = random walk

Parameters

ParameterDefaultDescription
period30Rolling window in bars. Larger values give more reliable scaling estimates.

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any upstream numeric series
valuesOutput(number | null)[]DFA scaling exponent α per bar; nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Market Regime Detection

Switch between trending and mean-reversion strategies based on whether α is above or below 0.5.

Complement to Hurst Exponent

DFA handles non-stationary series more robustly than R/S analysis (Hurst). Use both for confirmation.

Trend Filter

Only enter trend-following trades when α > 0.6, filtering out choppy, random-walk conditions.

Tips & Best Practices

Use Larger Windows

DFA requires multiple sub-windows. A period of at least 30 bars is recommended; 50–100 is better for reliable estimates.

Log Returns as Input

Feed log returns for a more stationary input that produces cleaner DFA scaling estimates.

Compare to Hurst

DFA α and Hurst H should agree directionally. Divergence may indicate non-stationarity in the data.

Related Indicators