fibRetracement
The Fibonacci Retracement is one of the most popular tools in trading. You pick two points (usually a swing high and a swing low), and the tool automatically draws the Fibonacci levels between them (23.6%, 38.2%, 50%, 61.8%, etc.).
Traders use these levels to guess where price might pause, bounce, or reverse during a pullback.
Syntax
fibRetracement(originPoint, targetPoint, styles?)
Parameters
originPoint The starting point of the retracement, often a swing high or swing low. Build with
newPoint(time, price).targetPoint: The second anchor, usually the opposite swing. Example:
newPoint(time(10), high(10))- Styles (FibRetracementLineToolOverrides)
Use these root options:
showPrices: boolean– show price labels on each level.showCoeffs: boolean– show % ratios (23.6, 38.2, 61.8…).showText: boolean– show your customtextif you add it to a level.coeffsAsPercents: boolean– display ratios as percents.fillBackground: boolean– shade between levels.transparency: number(0–100) – higher = more transparent shading.reverse: boolean– flip direction of levels.extendLines: boolean,extendLinesLeft: boolean– extend level lines.labelFontSize: number– label size (if labels are visible).horzLabelsAlign,vertLabelsAlign,horzTextAlign,vertTextAlign– fine‑tune label alignment.trendline: { linewidth?: number; linestyle?: number; color?: ... }– style for the baseline (the anchor‑to‑anchor reference line), if your build shows it.
Per‑level overrides (this is where you set colors and optional text):
level1 … level24: { coeff?: number; color?: RGBA | BaseColor; visible?: boolean; text?: string }coeff: the Fib ratio (e.g.,0.236,0.382,0.5,0.618,0.786,1,1.618, …)color: color for this specific linevisible: show/hide this linetext: your custom label for this line (works whenshowText: true)
Return Value
string — A unique drawing
idyou can use later for update or delete.
Example
This script draws a Fibonacci retracement every 50 candles, using an old low as the base and a more recent high as the target.
This creates a yellow Fibonacci retracement with shaded levels, showing both prices and % values.
Result

Tips
Use swing highs/lows that stand out — the cleaner the anchors, the more reliable the levels.
The 38.2%, 50%, and 61.8% levels are the most watched. Keep an eye on price action around them.
Combine with trendlines or moving averages to confirm important levels.
Warning
If your origin and target points are too close together, the levels won’t be meaningful.
Fibonacci tools are guides, not guarantees — don’t rely on them alone for entries.
Good Practice
Color-code your retracements (e.g., yellow for short-term, blue for long-term) to avoid confusion.
Use
updateDrawingByIdif you want to keep the same retracement updated instead of stacking new ones.Always check the bigger trend — retracements work best when used in context, not randomly.
Last updated