FractalHigh — Fractal High
תוכן זה אינו זמין עדיין בשפה שלך.
Williams’ five-bar fractal: a high with two lower highs on each side. Confirmed two bars late
by construction — the same honest lag as PivotHigh, at a fixed width.
Signature
FractalHigh(window, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
window |
int Param | Yes | Pinned at 5 — a Williams fractal is five bars by definition. Bounds 5–5. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads the high. |
Formula
The third bar of five is strictly higher than the two before and the two after.
Warmup
5 bars; 0 until then.
Reading the value
fh.valuefh > 0The flag refers to the bar two bars ago.
Example
class FractalBreak(Strategy): """Enter above a confirmed fractal high.""" trade = Symbol() sizing = FixedCapital()
def execute(self): fh = FractalHigh(5, on=self.trade) dh = DonchianHighTrue(10, on=self.trade) if fh.value > 0 and self.trade.close >= dh.value_at(1) and self.trade.is_flat: self.buy(self.trade, reason="Fractal high broken") if self.trade.close < dh.value * 0.95 and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Stop")Notes
- Bill Williams, Trading Chaos (1995). The
windowparameter exists only so theSeriescapacity can reference aParam; five is the definition. - Identical to
PivotHigh(5); both ship because members search for both names. - Proven by an assert-via-trade run on SPY daily (agreed with the independent pivot reference on every bar; zero alarm trades).