A drawing tool that marks proportional levels between a chosen swing high and swing low.
Fibonacci Retracement is a charting tool, not a calculated indicator like a moving average. You pick two points — usually a swing high and a swing low — and the tool draws horizontal lines at fixed percentages of that range: commonly 23.6%, 38.2%, 50%, 61.8%, and 78.6%. The 0% line sits at one end of the move and 100% at the other. Traders use these lines as reference areas to watch how price behaves after a move. The percentages come from ratios associated with the Fibonacci number sequence (the 50% line is a common addition that is not actually a Fibonacci ratio). It is educational and descriptive only — it does not predict price, it is not a buy or sell signal, and no indicator removes the risk of loss.
First you identify a price move you care about — a rally from a low to a high, or a drop from a high to a low. The tool measures the vertical distance between those two anchor points and places lines at set fractions of that distance. For an upmove, 0% is at the high and 100% at the low, so the levels show how far price has pulled back from the high toward the starting low. The math is simple: each level is the high minus the chosen percentage of the high-low range (or, for a downmove, the low plus that percentage). Because the result depends entirely on which two points you select, the same chart can produce very different levels for different traders. Nothing about the tool reacts to volume, momentum, or future bars — it only reflects the two anchors you chose, so the levels stay fixed until you re-anchor them.
Standard levels are 23.6%, 38.2%, 50%, 61.8%, and 78.6%, with 0% and 100% at the anchors. Some traders add 88.6% or extension levels like 161.8% beyond the original move. The only real 'setting' is which swing high and swing low you anchor to.
//@version=6
indicator("Fib Retracement (auto swing)", overlay = true)
length = input.int(100, "Swing lookback (bars)", minval = 2)
// Anchor to the highest high and lowest low over the lookback window
hi = ta.highest(high, length)
lo = ta.lowest(low, length)
rng = hi - lo
// Levels measured down from the swing high (common upmove convention)
level(ratio) => hi - rng * ratio
plot(level(0.0), "0%", color = color.gray)
plot(level(0.236), "23.6%", color = color.teal)
plot(level(0.382), "38.2%", color = color.teal)
plot(level(0.5), "50%", color = color.orange)
plot(level(0.618), "61.8%", color = color.teal)
plot(level(0.786), "78.6%", color = color.teal)
plot(level(1.0), "100%", color = color.gray)Pro tip: Pick your two anchor points before you have an opinion about direction. If you find yourself re-dragging the tool until the levels line up with where you already wanted price to react, you are fitting the tool to your bias rather than reading the chart.
Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.