PROTECTED SOURCE SCRIPT
Fibonacci extension overlay

A lightweight Fibonacci extension overlay that anchors to the most recent confirmed swing (two pivots) and plots one clean set of levels. Built for Pine v5 with no external libraries, it’s stable, fast, and easy to customize.
How it works
Detects pivots using ta.pivothigh/ta.pivotlow.
Uses the last two confirmed pivots (previous → latest) to define the swing.
Computes signed distance of the swing and draws extension levels anchored to the last pivot.
Lines extend to the right by default so levels stay visible as new bars print.
Inputs & options
Depth – sensitivity of pivot detection (smaller = more swings, larger = fewer).
Reverse – flip extension direction.
Extend Left / Right – control how far lines extend past the swing.
Show Levels / Show Prices – toggle text formatting on labels.
Labels Position – left or right of the swing.
Fill between levels (optional) – background fill between adjacent levels.
Background Transparency – opacity of any fills.
Tips
If nothing appears, reduce Depth or wait for two confirmed pivots on the current timeframe.
Works on any market and timeframe; lower TFs usually benefit from smaller Depth.
Because pivots are confirmed, plotted levels do not repaint once shown (they update only when a new pivot confirms).
Included levels
-0.65, -0.618, -0.382, -0.236, 0, 0.236, 0.382, 0.5, 0.618, 0.65, 0.786, 1, 1.272, 1.414, 1.618, 1.65, 2.618, 2.65, 3.618, 3.65, 4.236, 4.618
(Visibility, values, and colors are fully configurable.)
Notes
This script avoids duplicate drawings by updating persistent line/label objects instead of recreating them every bar.
Designed to be overlay-friendly and scale with the chart’s price axis.
How it works
Detects pivots using ta.pivothigh/ta.pivotlow.
Uses the last two confirmed pivots (previous → latest) to define the swing.
Computes signed distance of the swing and draws extension levels anchored to the last pivot.
Lines extend to the right by default so levels stay visible as new bars print.
Inputs & options
Depth – sensitivity of pivot detection (smaller = more swings, larger = fewer).
Reverse – flip extension direction.
Extend Left / Right – control how far lines extend past the swing.
Show Levels / Show Prices – toggle text formatting on labels.
Labels Position – left or right of the swing.
Fill between levels (optional) – background fill between adjacent levels.
Background Transparency – opacity of any fills.
Tips
If nothing appears, reduce Depth or wait for two confirmed pivots on the current timeframe.
Works on any market and timeframe; lower TFs usually benefit from smaller Depth.
Because pivots are confirmed, plotted levels do not repaint once shown (they update only when a new pivot confirms).
Included levels
-0.65, -0.618, -0.382, -0.236, 0, 0.236, 0.382, 0.5, 0.618, 0.65, 0.786, 1, 1.272, 1.414, 1.618, 1.65, 2.618, 2.65, 3.618, 3.65, 4.236, 4.618
(Visibility, values, and colors are fully configurable.)
Notes
This script avoids duplicate drawings by updating persistent line/label objects instead of recreating them every bar.
Designed to be overlay-friendly and scale with the chart’s price axis.
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
受保護腳本
此腳本以閉源形式發佈。 不過,您可以自由且不受任何限制地使用它 — 在此處了解更多資訊。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。