Data Analytic Investments
Price StructureBeginner

Fibonacci Retracement

Maps the natural pullback levels within a trend using mathematical ratios found throughout nature.

4H, Daily, Weekly
Crypto, Forex, Equities, Commodities
Pine Script v5

What is it?

Fibonacci retracement levels are horizontal lines drawn between a significant swing high and swing low (or vice versa) at the key Fibonacci ratios: 23.6%, 38.2%, 50%, 61.8% (the 'golden ratio'), and 78.6%. These levels represent potential support zones during a pullback in an uptrend (or resistance zones during a bounce in a downtrend). The 61.8% level is considered the most significant — it is derived from dividing a Fibonacci number by the next number in the sequence. The 50% level is not a true Fibonacci ratio but is widely watched because markets tend to retrace to the midpoint of a move.

When to use it

  • Identifying pullback entry levels in a trend: draw from the swing low to swing high in an uptrend; the 38.2%, 50%, and 61.8% levels are potential long entries on the pullback.
  • Setting profit targets: Fibonacci extension levels (127.2%, 161.8%, 261.8%) project where price may go after completing a retracement.
  • Confluence zones: a Fibonacci level that coincides with a prior support/resistance level, a moving average, or a VWAP level is a high-probability zone.
  • Stop placement: place stops just below the next Fibonacci level (e.g. below 61.8% if entering at 50%) to define risk precisely.
  • Multi-timeframe Fibonacci: draw Fibonacci on the weekly chart to find macro levels, then use the daily chart to time entries within those zones.

Common pitfalls

  • Fibonacci levels are self-fulfilling to a degree — they work partly because so many traders watch them. In low-liquidity altcoins, this effect is weaker.
  • The choice of swing high and swing low is subjective. Two traders drawing Fibonacci on the same chart will often get different levels depending on which pivots they choose.
  • Price rarely stops exactly at a Fibonacci level — it often overshoots by a few percent. Use Fibonacci zones (±1–2% around the level) rather than exact prices.
  • Fibonacci retracement only works in trending markets. In a sideways market, there is no meaningful swing to draw from.
  • Traders often draw too many Fibonacci levels from too many swings, creating a chart full of lines where every price level is 'significant.' Use only the most recent major swing.

Free code template

Paste directly into TradingView Pine Editor → Add to chart.

Pine Script v5
/indicator("Fibonacci Retracement — DAI Template", overlay=true)

// Auto-detect swing high/low over lookback period
lookback = input.int(50, "Lookback Period", minval=10)
showExt  = input.bool(true, "Show Extensions")

swingHigh = ta.highest(high, lookback)
swingLow  = ta.lowest(low, lookback)
range_    = swingHigh - swingLow

// Retracement levels
r236 = swingHigh - range_ * 0.236
r382 = swingHigh - range_ * 0.382
r500 = swingHigh - range_ * 0.500
r618 = swingHigh - range_ * 0.618
r786 = swingHigh - range_ * 0.786

// Extension levels
e1272 = swingLow  - range_ * 0.272
e1618 = swingLow  - range_ * 0.618
e2618 = swingLow  - range_ * 1.618

plot(swingHigh, "100% (Swing High)", color=color.new(#94a3b8, 30), linewidth=1, style=plot.style_linebr)
plot(r236,      "23.6%",             color=color.new(#f59e0b, 30), linewidth=1, style=plot.style_linebr)
plot(r382,      "38.2%",             color=color.new(#22c55e, 30), linewidth=1, style=plot.style_linebr)
plot(r500,      "50.0%",             color=color.new(#3b82f6, 50), linewidth=2, style=plot.style_linebr)
plot(r618,      "61.8% (Golden)",    color=color.new(#d97706, 50), linewidth=2, style=plot.style_linebr)
plot(r786,      "78.6%",             color=color.new(#ef4444, 30), linewidth=1, style=plot.style_linebr)
plot(swingLow,  "0% (Swing Low)",    color=color.new(#94a3b8, 30), linewidth=1, style=plot.style_linebr)

plot(showExt ? e1272 : na, "127.2% Ext", color=color.new(#a78bfa, 40), linewidth=1, style=plot.style_linebr)
plot(showExt ? e1618 : na, "161.8% Ext", color=color.new(#a78bfa, 50), linewidth=2, style=plot.style_linebr)
plot(showExt ? e2618 : na, "261.8% Ext", color=color.new(#a78bfa, 40), linewidth=1, style=plot.style_linebr)

// Alert when price enters golden ratio zone
nearGolden = math.abs(close - r618) / r618 < 0.01
alertcondition(nearGolden, "Near 61.8% Fib", "Price within 1% of 61.8% Fibonacci level")