Indicator · Pine Script v4 · On the chart

Daily Pivot Points

by tistaharahap· code credited to tista

Daily Pivot Points calculates standard daily pivot levels along with four resistance levels, four support levels, and intermediate mid-pivot levels using the previous day's high, low, and close values.

View on GitHub

Repaints

GitHub stars25on the repository
Pine versionv4older, still runs
Lines of code135
Settings0inputs
LicenceNone statedfile: MPL-2.0
Last update6 years ago29 Jun 2020

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

135 lines of Pine Script v4 from pivots/dailypivots.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

dailypivots.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tista

//@version=4
study("Daily Pivot Points", shorttitle="DailyPivots", overlay=true)

ret() => [high[1], low[1], close[1]]
[h, l, c] = security(syminfo.tickerid, "D", ret(), lookahead=true)

pp = (h + l + c) / 3

r4 = pp + (h - l) * 3
r3 = pp + (h - l) * 2
r2 = pp + (h - l)
r1 = 2 * pp - l
mpr0 = (pp + r1) / 2
mpr1 = (r1 + r2) / 2
mpr2 = (r2 + r3) / 2
mpr3 = (r3 + r4) / 2

s1 = 2 * pp - h
s2 = pp - (h - l)
s3 = pp - (h - l) * 2
s4 = pp - (h - l) * 3
mps0 = (pp + s1) / 2
mps1 = (s1 + s2) / 2
mps2 = (s2 + s3) / 2
mps3 = (s3 + s4) / 2

var line ppline = na
var line r1line = na
var line r2line = na
var line r3line = na
var line r4line = na
var line mpr0line = na
var line mpr1line = na
var line mpr2line = na
var line mpr3line = na
var line s1line = na
var line s2line = na
var line s3line = na
var line s4line = na
var line mps0line = na
var line mps1line = na
var line mps2line = na
var line mps3line = na

if pp[1] != pp
    line.set_x2(ppline, bar_index)
    line.set_x2(r1line, bar_index)
    line.set_x2(r2line, bar_index)
    line.set_x2(r3line, bar_index)
    line.set_x2(r4line, bar_index)
    line.set_x2(mpr0line, bar_index)
    line.set_x2(mpr1line, bar_index)
    line.set_x2(mpr2line, bar_index)
    line.set_x2(mpr3line, bar_index)
    line.set_x2(s1line, bar_index)
    line.set_x2(s2line, bar_index)
    line.set_x2(s3line, bar_index)
    line.set_x2(s4line, bar_index)
    line.set_x2(mps0line, bar_index)
    line.set_x2(mps1line, bar_index)
    line.set_x2(mps2line, bar_index)
    line.set_x2(mps3line, bar_index)
    line.set_extend(ppline, extend.none)
    line.set_extend(r1line, extend.none)
    line.set_extend(r2line, extend.none)
    line.set_extend(r3line, extend.none)
    line.set_extend(r4line, extend.none)
    line.set_extend(mpr0line, extend.none)
    line.set_extend(mpr1line, extend.none)
    line.set_extend(mpr2line, extend.none)
    line.set_extend(mpr3line, extend.none)
    line.set_extend(s1line, extend.none)
    line.set_extend(s2line, extend.none)
    line.set_extend(s3line, extend.none)
    line.set_extend(s4line, extend.none)
    line.set_extend(mps0line, extend.none)
    line.set_extend(mps1line, extend.none)
    line.set_extend(mps2line, extend.none)
    line.set_extend(mps3line, extend.none)
    r4line := line.new(bar_index, r4, bar_index, r4, width=1, extend=extend.right, color=#ffffff80)
    r3line := line.new(bar_index, r3, bar_index, r3, width=1, extend=extend.right, color=#ffffff80)
    r2line := line.new(bar_index, r2, bar_index, r2, width=1, extend=extend.right, color=#ffffff80)
    r1line := line.new(bar_index, r1, bar_index, r1, width=1, extend=extend.right, color=#ffffff80)
    mpr3line := line.new(bar_index, mpr3, bar_index, mpr3, width=1, extend=extend.right, color=#ffffff40)
    mpr2line := line.new(bar_index, mpr2, bar_index, mpr2, width=1, extend=extend.right, color=#ffffff40)
    mpr1line := line.new(bar_index, mpr1, bar_index, mpr1, width=1, extend=extend.right, color=#ffffff40)
    mpr0line := line.new(bar_index, mpr0, bar_index, mpr0, width=1, extend=extend.right, color=#ffffff40)
    ppline := line.new(bar_index, pp, bar_index, pp, width=2, extend=extend.right, color=color.blue)
    mps0line := line.new(bar_index, mps0, bar_index, mps0, width=1, extend=extend.right, color=#ffffff40)
    mps1line := line.new(bar_index, mps1, bar_index, mps1, width=1, extend=extend.right, color=#ffffff40)
    mps2line := line.new(bar_index, mps2, bar_index, mps2, width=1, extend=extend.right, color=#ffffff40)
    mps3line := line.new(bar_index, mps3, bar_index, mps3, width=1, extend=extend.right, color=#ffffff40)
    s1line := line.new(bar_index, s1, bar_index, s1, width=1, extend=extend.right, color=#ffffff80)
    s2line := line.new(bar_index, s2, bar_index, s2, width=1, extend=extend.right, color=#ffffff80)
    s3line := line.new(bar_index, s3, bar_index, s3, width=1, extend=extend.right, color=#ffffff80)
    s4line := line.new(bar_index, s4, bar_index, s4, width=1, extend=extend.right, color=#ffffff80)
    label.new(bar_index, r4, "R4", style=label.style_none, textcolor=color.white)
    label.new(bar_index, r3, "R3", style=label.style_none, textcolor=color.white)
    label.new(bar_index, r2, "R2", style=label.style_none, textcolor=color.white)
    label.new(bar_index, r1, "R1", style=label.style_none, textcolor=color.white)
    label.new(bar_index, mpr3, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mpr2, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mpr1, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mpr0, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, pp, "PP", style=label.style_none, textcolor=color.white)
    label.new(bar_index, mps0, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mps1, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mps2, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, mps3, "MP", style=label.style_none, textcolor=#ffffff40)
    label.new(bar_index, s1, "S1", style=label.style_none, textcolor=color.white)
    label.new(bar_index, s2, "S2", style=label.style_none, textcolor=color.white)
    label.new(bar_index, s3, "S3", style=label.style_none, textcolor=color.white)
    label.new(bar_index, s4, "S4", style=label.style_none, textcolor=color.white)

if not na(ppline) and line.get_x2(ppline) != bar_index
    line.set_x2(r4line, bar_index)
    line.set_x2(r3line, bar_index)
    line.set_x2(r2line, bar_index)
    line.set_x2(r1line, bar_index)
    line.set_x2(mpr3line, bar_index)
    line.set_x2(mpr2line, bar_index)
    line.set_x2(mpr1line, bar_index)
    line.set_x2(mpr0line, bar_index)
    line.set_x2(ppline, bar_index)
    line.set_x2(mps0line, bar_index)
    line.set_x2(mps1line, bar_index)
    line.set_x2(mps2line, bar_index)
    line.set_x2(mps3line, bar_index)
    line.set_x2(s1line, bar_index)
    line.set_x2(s2line, bar_index)
    line.set_x2(s3line, bar_index)
    line.set_x2(s4line, bar_index)

Overview

The indicator draws horizontal line objects directly on the main price chart, updating dynamically at the start of each new daily trading session. It provides structural key levels for identifying intraday support and resistance zones. Note that the script uses a higher-timeframe security call with lookahead enabled to retrieve daily session data.

Details

Published by

tistaharahap on GitHub

Code credit

tista, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Support & resistance

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time
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