Pattern
Fibonacci Signals: Anchors, Confirmation and Retracement Levels
Calculate retracement levels from confirmed swing anchors. Inspect pivot delay, changing ranges and a Pine Script example without claiming a golden-ratio win rate.
Fibonacci Retracement Signal Interpretation
Quick-reference guide to 5 signal types you will see on the chart.
| Signal Type | Indicator Condition | Market Meaning | Interpretation limits |
|---|---|---|---|
| 38.2% / 50% / 61.8% retracement | A fraction of the distance from a confirmed swing start A to end B, measured back from B | A geometric reference for the selected move. | Fifty percent is a midpoint convention, not a Fibonacci ratio; none proves support. |
| Close near the 61.8% level | Completed close lies within the chosen tick tolerance | A proximity event under this example’s exact definition. | Not a wick touch, reversal candle or buy/sell recommendation. |
| 61.8% upward cross | Close changes from at/below to above a stable 61.8% level | A change in relative price position. | Do not confuse a changed anchor with price crossing an unchanged line. |
| 61.8% downward cross | Close changes from at/above to below a stable 61.8% level | The opposite relative-position event. | Direction of the selected swing still matters. |
| 161.8% extension | A plus 1.618 times the signed A-to-B distance | A projected distance beyond B in the swing direction. | A chosen target calculation, not a forecast or exhaustion probability. |
Fibonacci Retracement Pine Script Signal Code
Educational indicator example. Review its exact rules and compare its plots with your intended calculation in TradingView. It does not place orders or establish profitability.
Pine Script v6
//@version=6
indicator("Confirmed-Swing Fib Reference Examples", overlay=true)
left = input.int(10, "Pivot Left Bars", minval=1, maxval=100)
right = input.int(5, "Pivot Right Bars", minval=1, maxval=100)
toleranceTicks = input.int(10, "Close Proximity Ticks", minval=0)
showExtension = input.bool(true, "Show 161.8% Extension")
ph = ta.pivothigh(high, left, right)
pl = ta.pivotlow(low, left, right)
var float lastHigh = na
var float lastLow = na
var int lastHighBar = na
var int lastLowBar = na
var float anchorA = na
var float anchorB = na
var int rangeKnownBar = na
pivotBar = bar_index - right
if barstate.isconfirmed
if not na(ph) and na(pl)
if not na(lastLow) and lastLowBar < pivotBar and ph > lastLow
anchorA := lastLow
anchorB := ph
rangeKnownBar := bar_index
lastHigh := ph
lastHighBar := pivotBar
else if not na(pl) and na(ph)
if not na(lastHigh) and lastHighBar < pivotBar and pl < lastHigh
anchorA := lastHigh
anchorB := pl
rangeKnownBar := bar_index
lastLow := pl
lastLowBar := pivotBar
move = anchorB - anchorA
fib382 = anchorB - move * 0.382
fib500 = anchorB - move * 0.5
fib618 = anchorB - move * 0.618
extension = anchorA + move * 1.618
stable = not na(rangeKnownBar) and bar_index > rangeKnownBar
upCross = ta.crossover(close, fib618)
downCross = ta.crossunder(close, fib618)
nearLevel = barstate.isconfirmed and stable and math.abs(close - fib618) <= toleranceTicks * syminfo.mintick
crossUp = barstate.isconfirmed and stable and upCross
crossDown = barstate.isconfirmed and stable and downCross
plot(fib382, "38.2% retracement", color=color.gray, style=plot.style_stepline)
plot(fib500, "50% midpoint", color=color.blue, style=plot.style_stepline)
plot(fib618, "61.8% retracement", color=color.orange, style=plot.style_stepline)
plot(showExtension ? extension : na, "161.8% extension from A", color=color.purple, style=plot.style_stepline)
plotshape(nearLevel, "Close near 61.8%", shape.circle, location.belowbar, color=color.orange, size=size.tiny)
alertcondition(nearLevel, "Close near 61.8%", "Confirmed close within selected tick tolerance of the current 61.8% level")
alertcondition(crossUp, "61.8% upward cross", "Confirmed close cross above a stable 61.8% level")
alertcondition(crossDown, "61.8% downward cross", "Confirmed close cross below a stable 61.8% level")Example settings for Fibonacci Retracement
Record the inputs used by the example. These settings are not an optimized trading recommendation.
| Parameter | Default | Description |
|---|---|---|
| Pivot Left / Right Bars | 10 / 5, examples | A pivot becomes known only after the right-side bars have completed. The script starts plotting the updated range at confirmation, with no backdated markers. |
| Close Proximity Ticks | 10, example | An absolute close-to-level tolerance using syminfo.mintick. It is not a universal ES/NQ range or proof the bar bounced. |
| Anchor selection | Latest earlier opposite pivot | A new isolated confirmed high pairs with the last earlier low, and vice versa. Simultaneous high/low confirmations are skipped as ambiguous. This is not the built-in Auto Fib algorithm. |
| Extension visibility | Enabled | Shows A + 1.618 × (B − A). The calculation is linear in price and does not match logarithmic Fib settings. |
Turn the condition into an explicit rule
Specify the calculation, confirmation time, entry and exit rules before asking Pineify to draft or revise Pine Script. Review the code and simulate realistic costs before evaluating a strategy.
Explore Pine Script codingRelated Resources
Fibonacci Retracement Pine Script ReferenceTradingView alert setup documentation
FAQ
Fibonacci Retracement Signals FAQ
Which retracement level is most reliable?
No ranking or bounce probability is established. The selected anchors determine the levels, and different reasonable swings can produce different references.
Do confirmed pivot levels never change?
The current range changes when a new qualifying pivot is confirmed. Five right bars means a five-bar confirmation delay, not a level known at the original swing. Historical plots are not shifted backward to imply earlier knowledge.
Does a break of 78.6% automatically invalidate a trade?
Only if a strategy explicitly defines that rule. A ratio is not a universal risk limit; stops, position size and execution assumptions must be set separately.
Can I use the built-in drawing tool instead?
Yes. Select two anchors with Fib Retracement and inspect the level direction, Reverse option and linear/log setting. TradingView also documents alerts on active drawing levels. The example here is a different confirmed-pivot implementation.
Does confluence prove higher probability?
Several levels can overlap, but choosing many swings after seeing the outcome creates selection bias. Define anchors and tolerance before evaluating later data; no 5/5 reliability is claimed.
How can I audit the code’s timing?
Record the pivot bar and its later confirmation bar. Confirm the range first appears when known, and that crossing alerts are suppressed on the update bar. Then check the level formula manually for an upward and a downward swing.