The Jurik Composite Fractal Behavior (CFB) index measures the duration of a trend by analyzing the "fractal efficiency" of price movement across multiple time scales. It answers the question: "How long has the market been moving in a straight line?"
Most indicators assume a fixed period (e.g., RSI-14). CFB rejects this rigidity. It scans a massive array of lookback periods simultaneously (by default, from 2 to 192 bars) to find which timeframes are exhibiting efficient trending behavior. It then composites these valid timeframes into a single index representing the current trend's maturity.
Mark Jurik is the quiet giant of signal processing in finance. His work focuses on low-lag, adaptive algorithms that treat price series as noisy signals rather than accounting ledgers. CFB is designed to be a "modulator"—a signal used to tune other indicators.
A naive implementation of CFB is $O(N \times M)$, where $M$ is the number of lengths scanned (often ~100). This is prohibitively slow for real-time systems.
The QuanTAlib implementation uses a **running-sum algorithm** to maintain $O(1)$ complexity per update. Ninety-six parallel running sums of volatility are maintained, updating incrementally as new bars arrive and old bars drop off.
The implementation uses a fixed-size array for the running sums, allocated on the stack or as part of the object state. No dynamic memory allocation occurs during updates.
- **Not a Directional Signal**: CFB tells you *how long* a trend has lasted, not which way it is going. A high CFB can occur in a crash or a rally.
- **Modulation**: Its best use is to dynamically adjust the period of other indicators (e.g., `RSI(Period = CFB)`). Using it as a standalone crossover signal is usually a mistake.