Indicator · Pine Script v6 · On the chart

Pivot Points (Camarilla)

by mihakralj

The Pivot Points (Camarilla) indicator calculates eight pivot levels based on the previous bar's high, low, and close.

View on GitHub

Repaints

GitHub stars99on the repository
Pine versionv6current
Lines of code56
Settings13inputs
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

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

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

//@function Calculates Camarilla pivot points with 8 levels for short-term trading
//@param tf Timeframe for pivot calculation ("D", "W", "M")
//@returns Tuple [pp, r1, r2, r3, r4, s1, s2, s3, s4] with pivot levels
//@references Nick Scott, Camarilla equation
pivotcam(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, na, na]
    else
        float pp = (hi + lo + cl) / 3.0
        float hl_range = hi - lo
        float r1 = cl + hl_range * 1.0833 / 12.0
        float s1 = cl - hl_range * 1.0833 / 12.0
        float r2 = cl + hl_range * 1.1666 / 12.0
        float s2 = cl - hl_range * 1.1666 / 12.0
        float r3 = cl + hl_range * 1.2500 / 12.0
        float s3 = cl - hl_range * 1.2500 / 12.0
        float r4 = cl + hl_range * 1.5000 / 12.0
        float s4 = cl - hl_range * 1.5000 / 12.0
        [pp, r1, r2, r3, r4, s1, s2, s3, s4]

// ---------- 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")
i_show_r2 = input.bool(true, "Show R2")
i_show_r3 = input.bool(true, "Show R3")
i_show_r4 = input.bool(true, "Show R4")
i_show_s1 = input.bool(true, "Show S1")
i_show_s2 = input.bool(true, "Show S2")
i_show_s3 = input.bool(true, "Show S3")
i_show_s4 = input.bool(true, "Show S4")
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, r4, s1, s2, s3, s4] = pivotcam(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_r4 ? r4 : na, "R4", 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)
plot(i_show_s4 ? s4 : na, "S4", color=i_color_s, linewidth=1, style=plot.style_stepline)

Overview

Pivot Points (Camarilla) derives the central pivot point PP and resistance (R1-R4) and support (S1-S4) levels using the Camarilla equation. Users select a pivot calculation timeframe from daily, weekly, or monthly via input. The script plots these levels as steplines on the price chart: PP in yellow, resistances in red, and supports in green. Toggle individual levels on or off and adjust their colors through settings. It draws purely on the main price chart with no separate pane. The calculation uses request.security with lookahead enabled, which may cause signals to update on the live bar.

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

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

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 R1booltruei_show_r1
Show R2booltruei_show_r2
Show R3booltruei_show_r3
Show R4booltruei_show_r4
Show S1booltruei_show_s1
Show S2booltruei_show_s2
Show S3booltruei_show_s3
Show S4booltruei_show_s4
PP Colorcolorcolor.yellowi_color_pp
Resistance Colorcolorcolor.redi_color_r
Show all 13 settings
SettingTypeDefaultVariable
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