fib anchors Fibonacci retracement and extension levels on the most recent significant ATR-zigzag impulse leg, highlighting the 0.618–0.65 Golden Pocket and reporting premium/discount equilibrium state.
Parameters
| Parameter | Default | Range | Type | Timeframe overrides |
|---|---|---|---|---|
window |
500 |
60..2000 |
integer | — |
zigzagAtr |
3 |
1..12 |
number | — |
minLegAtr |
5 |
1..40 |
number | — |
extensions |
1 |
0..1 |
integer (0 or 1) |
— |
Algorithm & Nuances
- ATR zigzag (
zigzag): Tracks running swing extremes and confirms a leg reversal whenever price retraces more thanatr[i] * zigzagAtr. Tracks true opposite extremes continuously so shifting ATR cannot skip a wick extreme. Appends the active unconfirmed extreme as the latest leg. - Minimum leg filter: Walks backward from the newest leg to pick the first leg whose range satisfies
size >= minLegAtr * atr[n - 1]. When the selected leg is unconfirmed,facts.lastConfirmedalso exposes the most recent confirmed leg. - Retracement & extension ratios:
- Retracements (
to + (from - to) * r):0.236,0.382,0.5,0.618,0.65,0.786. - Extensions (
extensions = 1):-0.272(labeled1.272) and-0.618(labeled1.618). - Golden Pocket:
[min(0.618, 0.65), max(0.618, 0.65)]. - OTE (Optimal Trade Entry):
[min(0.618, 0.786), max(0.618, 0.786)].
- Retracements (
- Leg quality & zone state:
efficiency = min(1, size / sum(|c[j] - c[j - 1]|))measures how straight the impulse moved (1.0= zero pullback noise).zoneclassifies the current close as'extended'(retracedNow < 0),'premium'(pos > 0.55),'discount'(pos < 0.45), or'equilibrium'.
Drawings & Facts
- Drawings:
0or1fiboverlay drawing the dashed swing leg, solid0/1bounds, shaded0.618–0.65Golden Pocket band, dashed retracement lines, and optional1.272/1.618extension lines. - Facts (
FibFacts):leg(dir,from,to,size,sizeAtr,bars,confirmed,efficiency,levels,extensions,goldenPocket,ote,retracedNow,zone,inGoldenPocket,inOte) andlastConfirmed.
Activation
- Studies menu:
Fibonacci on the last swing(Fib) - Slash command:
/fib - Chat phrases:
fib,fibs,fibo,fibonacci,retracement,retrace