# Williams Fractal

Also known as: fractal chaos bands/oscillator.
A Market Structure concept (Swing grammar) in the LuxAlgo Library, with 2 indicator implementations.

## What is a Williams Fractal?

A Williams Fractal is a five-bar swing marker popularized by Bill Williams in his Trading Chaos work. An up fractal prints on a bar whose high stands above the highs of the two bars on each side; a down fractal prints where a bar's low sits below the two lows on each side. It is among the simplest widely used objective definitions of a [swing high or low](https://www.luxalgo.com/library/concept/swing-high-low/): no subjective drawing, just a local extreme over five bars. Implementations differ slightly on how ties are handled, with strict inequality the common default.

Two properties define how fractals behave in practice. First, confirmation lags by two bars: the pattern cannot exist until the two right-hand bars have closed, so the marker always appears in the past. Second, fractals are frequent, since a two-bar flank is a low hurdle; in Williams' own system they were therefore filtered by the [Alligator](https://www.luxalgo.com/library/concept/alligator/) and traded only as breakouts in the trend direction. Beyond that origin, the fractal has become a general-purpose building block: a mechanical swing definition feeding structure logic, trailing stops, and support and resistance levels.

## How to identify a Williams Fractal

The definition is mechanical, which is exactly its appeal. A standard fractal needs five completed bars.

1. Take a candidate bar plus the two bars before it and the two bars after it.
2. Up fractal: the candidate's high is higher than all four neighboring highs. Down fractal: the candidate's low is lower than all four neighboring lows. A single bar can qualify as both.
3. Wait for confirmation: the two right-hand bars must close first, so a fractal is only known two bars after the extreme actually printed. Anything drawn earlier is provisional.
4. Adjust conventions as needed: some versions accept equal highs or lows on the flanks, and widening the flanks beyond two bars produces fewer, more significant swings at the cost of later confirmation (this is the [pivot strength](https://www.luxalgo.com/library/concept/pivot-strength/) parameter).

## How it's calculated

Marks a local turning point: a bar whose high (or low) exceeds the highs (lows) of the n bars on each side of it.

```
Up fractal at bar t: H_t > H_{t-i} and H_t > H_{t+i} for every i = 1..n
Down fractal at bar t: L_t < L_{t-i} and L_t < L_{t+i} for every i = 1..n
A fractal at bar t is confirmed only after the n later bars have closed, so it prints with an n-bar delay
Fractal chaos bands: UpperBand_t = high of the most recent confirmed up fractal, held flat until a new up fractal confirms
Fractal chaos bands: LowerBand_t = low of the most recent confirmed down fractal, held flat until a new down fractal confirms

  H: bar high
  L: bar low
  t: index of the candidate bar
  i: offset in bars from the candidate bar
  n: bars required on each side (default 2, a 5-bar pattern)
```

Bill Williams' original definition uses n = 2.

Tie handling varies: many implementations require strict inequality against every neighbor, others allow equal highs on the older side.

The fractal chaos oscillator prints +1 on bars forming an up fractal, -1 on bars forming a down fractal, and 0 elsewhere.

## How traders use it

- As the swing vocabulary for structure logic: the most recent up and down fractals define the swing points that [break of structure](https://www.luxalgo.com/library/concept/break-of-structure/) and change-of-character rules are evaluated against. Many structure tools are fractal detection under the hood.
- As breakout triggers, the original use: Williams placed buy stops just above the latest up fractal when it formed above the Alligator's teeth, ignoring fractal signals on the wrong side of that line. Later tools generalize the idea into a stair-stepped breakout channel built from successive fractal levels.
- As trailing stop anchors: in an uptrend, trail the stop under each newly confirmed down fractal, a mechanical form of the [structure stop](https://www.luxalgo.com/library/concept/structure-stop/).
- As resting-liquidity markers: untouched fractal highs and lows are local extremes where stops tend to accumulate, so some traders track which fractals have been swept and which remain open as potential targets.

## Williams Fractal vs related concepts

- **Swing High/low** (https://www.luxalgo.com/library/concept/swing-high-low/): Swing high/low is the general idea of a local price extreme; the Williams Fractal is one specific parameterization of it: two bars on each side, confirmed at the close of the fifth. Every fractal is a swing point, but a swing point can be defined in other ways.
- **Pivot Strength** (https://www.luxalgo.com/library/concept/pivot-strength/): Pivot strength generalizes the flank count: a strength-N pivot needs N lower highs on each side of a high. A standard Williams Fractal is simply a strength-2 pivot, so the two concepts differ only in whether the width is fixed or a tunable parameter.
- **Zigzag Structure** (https://www.luxalgo.com/library/concept/zigzag-structure/): Zigzag filters swings by magnitude, requiring a minimum percent or ATR move between pivots, while fractals filter only by local bar geometry. A zigzag leg keeps redrawing while it extends; a confirmed fractal is fixed once its two right-hand bars close.

## FAQ

### Do Williams Fractals repaint?

A fractal cannot be evaluated until the two bars to its right have closed, so markers appear with a two-bar delay, and any fractal suggested on the live bar is provisional and can vanish. Once those two bars close, an honestly coded fractal is fixed. The practical cost is not repainting but lag: price has often moved by the time the marker prints.

### What is the best setting for Williams Fractals?

The classic definition is fixed at two bars per side and has no settings. Variants expose the flank width: wider flanks yield fewer, more significant fractals that confirm later, while tighter logic yields more markers and more noise. No value is best across markets; the width simply sets where you sit on that trade-off.

### How did Bill Williams use fractals in Trading Chaos?

As breakout triggers filtered by trend. The signal was a stop order placed just beyond the most recent fractal, taken only when the fractal sat on the correct side of the Alligator's teeth (buy fractals above, sell fractals below), with opposing fractal signals ignored. The fractal supplied objective swing points; the Alligator supplied the directional filter.

## Implementations in the Library

- Market Structure CHoCH/BOS (Fractal) (LuxAlgo): https://www.luxalgo.com/library/indicator/market-structure-choch-bos-fractal/
- Williams Fractal (LuxAlgo, the standard build of the classic formula): https://www.luxalgo.com/library/indicator/williams-fractal/

## Related concepts

- Swing High/low: https://www.luxalgo.com/library/concept/swing-high-low/
- Swing Structure Grammar: https://www.luxalgo.com/library/concept/swing-structure-grammar/
- Zigzag Structure: https://www.luxalgo.com/library/concept/zigzag-structure/
- Multi-timeframe Structure Alignment: https://www.luxalgo.com/library/concept/multi-timeframe-structure-alignment/
- Pivot Strength: https://www.luxalgo.com/library/concept/pivot-strength/
- Swing Magnitude Filters: https://www.luxalgo.com/library/concept/swing-magnitude-filters/
- Fractal Nesting: https://www.luxalgo.com/library/concept/fractal-nesting/

---

Source: https://www.luxalgo.com/library/concept/williams-fractal/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/