Skip to content
StatePath
Tool Atlasmarket.fibonacci_levels

Tool

Auto Fibonacci Levels

market.fibonacci_levels

MarketFibonacci

Inputs

No typed inputs.

Outputs

Bundle (untagged)

A bundle with a per-bar validity gate plus one stepped price series per enabled level — each line re-anchors when a new pivot becomes visible. Chart them directly, or gate conditions on price touching a level; for TP/SL prices use the Anchor + Retracement pair instead.

Auto Fibonacci Levels draws the classic retracement ladder by itself: it finds the swings with a ZigZag scan of the chart, anchors on the latest impulse or pullback leg, and paints up to 12 percent levels as stepped lines that re-anchor whenever a new swing prints — TradingView’s “Auto Fib Retracement” as a chartable node.

Auto Fibonacci Levels overview diagram023.638.25061.878.6100

How it works

A MetaTrader-style ZigZag pass (depth / deviation_points / backstep / point_value) turns the chart’s own highs and lows into alternating swing pivots. At each bar the tool looks only at the pivots visible so far, selects the anchoring leg with the exact same rules as Fibonacci Anchor (mode decides confirmed vs still-forming, leg_select picks the impulse or the pullback), and broadcasts every configured percent level as price = end + (start − end) × (pct / 100), held constant until the next pivot becomes visible. 0% sits at the leg’s end (the most recent extreme), 100% at its start. The levels are per-bar series meant for charting and gating; to wire fixed level PRICES into order TP/SL slots, use Fibonacci Anchor plus Fibonacci Retracement instead.

Modes

Mode options

Confirmed legconfirmed

Anchors only on the last CLOSED pivot pair — the trailing provisional pivot is dropped, so the drawn levels stay put as new bars print.

Confirmed leg diagram023.638.25061.878.6100

When to use: The stable default for backtests and live gating: the ladder never shifts under your feet.

Latest leglatest

Also admits the still-forming trailing leg, so the ladder re-draws while the newest swing keeps extending (it repaints, honestly).

Latest leg diagram023.638.25061.878.6100

When to use: Live-chart reading when you want the freshest anchor and accept moving levels.

Leg select options

Impulse legimpulse

Anchors on the older, driving leg of the trailing swing pair — the displacement most traders stretch their fib over.

Impulse leg diagram023.638.25061.878.6100

When to use: The classic auto-fib behavior: measure the pullback against the move that caused it.

Retrace legretrace

Anchors on the newer leg — the pullback itself — so the levels project off the correction instead of the drive.

Retrace leg diagram023.638.25061.878.6100

When to use: Continuation setups: watch how far price re-traces the pullback, not the impulse.

Level count options

11
22
33
44
55
66
77
88
99
1010
1111
1212

Configuration

modeenum

Which legs qualify as anchors. confirmed uses only closed pivot pairs (stable); latest also tracks the leg still forming (repaints).

Choices:confirmedlatest
leg_selectenum

Which leg of the trailing swing pair to stretch the ladder over: impulse = the older, driving leg; retrace = the newer pullback.

Choices:impulseretrace
depthscalar

ZigZag: the minimum number of bars a swing must span before a new pivot can form — higher values keep only the larger swings.

deviation_pointsscalar

ZigZag: the minimum reversal, in points, required to register a new pivot. Converted to a price distance via point_value.

backstepscalar

ZigZag: the minimum number of bars between two consecutive pivots, preventing pivots from clustering on adjacent bars.

point_valuescalar

The price size of one point for this symbol, used to convert deviation_points into an actual price distance (e.g. 0.0001 for a 5-digit FX pair).

level_countenum

How many level lines to draw, from 1 up to 12. The default 10 is MT5’s classic preset plus the TradingView/ICT-standard 78.6. Only the first level_count of the level_N_pct percents are used.

Choices:123456789101112
level_count diagram023.638.25061.878.6100
level_0_pctscalar

Percent for level #0: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 0.

level_1_pctscalar

Percent for level #1: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 23.6.

level_2_pctscalar

Percent for level #2: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 38.2.

level_3_pctscalar

Percent for level #3: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 50.

level_4_pctscalar

Percent for level #4: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 61.8.

level_5_pctscalar

Percent for level #5: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 78.6.

level_6_pctscalar

Percent for level #6: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 100.

level_7_pctscalar

Percent for level #7: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 161.8.

level_8_pctscalar

Percent for level #8: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 261.8.

level_9_pctscalar

Percent for level #9: 0 = the leg’s end, 100 = its start, values above 100 project beyond the start. Default 423.6.

level_10_pctscalar

Percent for level #10. Default 0 (an extra slot — raise it to add your own level).

level_11_pctscalar

Percent for level #11. Default 0 (an extra slot — raise it to add your own level).

Connects to

Feeds into

Examples

  • Drop it on any chart to get TradingView-style auto fib levels — no wiring: it detects the swings itself.
  • Gate longs to bars where close dips under the 61.8% line of the latest confirmed up-impulse (wire level_4 into a threshold condition).

Common mistakes

  • Expecting the level outputs to plug into order TP/SL slots — they are per-bar series; the SCALAR path is Fibonacci Anchor + Fibonacci Retracement.
  • Using mode=latest in a backtest and mistaking its repainting ladder for the stable confirmed one.

See also