Indicator · Pine Script v6 · On the chart

Pivot Points (Fibonacci)

by mihakralj

This indicator plots Fibonacci pivot levels on the price chart.

View on GitHub

GitHub stars99on the repository
Pine versionv6current
Lines of code50
Settings11inputs
LicenceApache-2.0
Last update4 weeks ago27 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

50 lines of Pine Script v6 from lib/reversals/pivotfib/pivotfib.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

pivotfib.pine
// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Pivot Points (Fibonacci)", "PIVOTFIB", overlay=true)

//@function Calculates Fibonacci pivot points using Fibonacci ratios
//@param tf Timeframe for pivot calculation ("D", "W", "M")
//@returns Tuple [pp, r1, r2, r3, s1, s2, s3] with pivot levels
//@references Fibonacci retracement levels applied to pivot points
pivotfib(simple string tf) =>
    [hi, lo, cl] = request.security(syminfo.tickerid, tf, [high[1], low[1], close[1]], lookahead=barmerge.lookahead_on)
    if na(hi) or na(lo) or na(cl)
        [na, na, na, na, na, na, na]
    else
        float pp = (hi + lo + cl) / 3.0
        float hl_range = hi - lo
        float r1 = pp + 0.382 * hl_range
        float s1 = pp - 0.382 * hl_range
        float r2 = pp + 0.618 * hl_range
        float s2 = pp - 0.618 * hl_range
        float r3 = pp + 1.000 * hl_range
        float s3 = pp - 1.000 * hl_range
        [pp, r1, r2, r3, s1, s2, s3]

// ---------- Main loop ----------

// Inputs
i_timeframe = input.timeframe("D", "Pivot Timeframe", options=["D", "W", "M"])
i_show_pp = input.bool(true, "Show Pivot Point")
i_show_r1 = input.bool(true, "Show R1 (38.2%)")
i_show_r2 = input.bool(true, "Show R2 (61.8%)")
i_show_r3 = input.bool(true, "Show R3 (100%)")
i_show_s1 = input.bool(true, "Show S1 (38.2%)")
i_show_s2 = input.bool(true, "Show S2 (61.8%)")
i_show_s3 = input.bool(true, "Show S3 (100%)")
i_color_pp = input.color(color.yellow, "PP Color")
i_color_r = input.color(color.red, "Resistance Color")
i_color_s = input.color(color.green, "Support Color")

// Calculation
[pp, r1, r2, r3, s1, s2, s3] = pivotfib(i_timeframe)

// Plot
plot(i_show_pp ? pp : na, "PP", color=i_color_pp, linewidth=2, style=plot.style_stepline)
plot(i_show_r1 ? r1 : na, "R1", color=i_color_r, linewidth=1, style=plot.style_stepline)
plot(i_show_r2 ? r2 : na, "R2", color=i_color_r, linewidth=1, style=plot.style_stepline)
plot(i_show_r3 ? r3 : na, "R3", color=i_color_r, linewidth=1, style=plot.style_stepline)
plot(i_show_s1 ? s1 : na, "S1", color=i_color_s, linewidth=1, style=plot.style_stepline)
plot(i_show_s2 ? s2 : na, "S2", color=i_color_s, linewidth=1, style=plot.style_stepline)
plot(i_show_s3 ? s3 : na, "S3", color=i_color_s, linewidth=1, style=plot.style_stepline)

Overview

Pivot Points (Fibonacci) takes the previous completed bar's high, low, and close from a daily, weekly, or monthly timeframe and sets the pivot as their average. Resistance and support sit at 38.2 percent, 61.8 percent, and 100 percent of that bar's high-low range. Users can show or hide the pivot and each level and choose colors. Lines use a step style. It does not generate trade entries or exits.

Details

Published by

mihakralj on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingcsharpdotnetpinescriptpythonquantitative-financesimdta-libtechnical-analysistechnical-indicators

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Pivot TimeframetimeframeDi_timeframe
Show Pivot Pointbooltruei_show_pp
Show R1 (38.2%)booltruei_show_r1
Show R2 (61.8%)booltruei_show_r2
Show R3 (100%)booltruei_show_r3
Show S1 (38.2%)booltruei_show_s1
Show S2 (61.8%)booltruei_show_s2
Show S3 (100%)booltruei_show_s3
PP Colorcolorcolor.yellowi_color_pp
Resistance Colorcolorcolor.redi_color_r
Support Colorcolorcolor.greeni_color_s
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

948 stars

Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us

Indicator v4 Moving averagesSupport & resistance
Updated 10 days ago · GPL-3.0 GitHub repository of Moving Average Channel

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

BZ-tracker

by Allen1212
303 stars

The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on

Indicator v4 Support & resistanceScreeners & dashboards
Updated 2 years ago · None stated GitHub repository of BZ-tracker

Function - Linear Regression

by ricardosantos79
261 stars

This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up

Indicator v5 TrendSupport & resistance
Updated 4 years ago · None stated GitHub repository of Function - Linear Regression

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers