OPEN-SOURCE SCRIPT

Pivot Points [KrisWaters] vX by DGT

Updated
What is a Pivot Point?

A pivot point is a technical analysis indicator used to determine the overall trend of the market over different time frames. A pivot point is calculated based on the high, low, and closing prices of previous trading session/day and support and resistance levels that are projected based on the pivot point calculation as well as type of the pivot point

All these levels help traders see where the price could experience support or resistance, these support and resistance levels can be used by traders to determine entry and exit points, as well as define stop-losses.

This study's skeleton is inherited from Kris Waters' Pivot Points, also I kept the description of different pivot definitions as in his study, thanks kriswaters for granting permission. Also thanks to Yashwanth45 who pointed out Kris Waters' Pivot Points study

What have changed and what is new

Firstly, removed security() function calls to get higher time frame price values and instead performed calculations within the study
Added ability to auto select the resolution thanks to Pine Wizard LonesomeTheBlue, used defined resolution is also possible

Secondly, which is the exiting part for me, added calculations for the subsequent session/day, Subsequent Pivot Points
Unlike pivot points, which are static and remain at the same prices throughout the session/day, it is extremely important to note that subsequent pivot points will be changing till the time the higher time frame price change is completed and by the time the study will be presenting probable subsequent pivot points, calculated based on current price values for the subsequent session/day

Finally, the study is enriched with some custom interpreted indicators (as listed below) with the aim to increase the ability to interpret pivot points and subsequent pivots points.

A label is included to present some important values, comparisons of the indicators introduced as add on and as well as when hovered over the label numerical values of pivot points will be observed

snapshot


Pivot Point included within this study

Floor Pivot Points:
 The floor pivot points are the most basic and popular type of pivots . The pivot point is interpreted as the primary support/resistance level - the point at which the main trend is determined. First-third level resistance and support points serve as additional indicators of possible trend reversal or continuation.

Woodie Pivot Points:
 Woodie's pivot points are similar to floor pivot points , the difference being is that more weight is given to the Close price of the previous period.

Camarilla Pivot Points:
 Camarilla pivot points are a set of eight very probable levels which resemble support and resistance values for a current trend. The most important is that these pivot points work for all traders and help in setting the right stop-loss and profit-target orders.

DM's Pivot Points:
 Another popular method of calculating the pivots to forecast the future of the trend is DM's pivot points , which are not pivot points exactly, but are the predicted lows and highs of the period.

Fibonacci Pivot Points:
 Fibonacci pivot point levels are determined by first calculating the floor pivot points . Next, multiply the previous day's range with its corresponding Fibonacci level. Most traders use the 38.2%, 61.8% and 100% retracements in their calculations. Finally, add or subtract the figures you get to the pivot point and you've got your Fibonacci pivot point levels!

Swing Pivot Points:
 The only difference with Fibonacci pivot point is that Swing pivots assumes day open as floor pivot point level and support and resistance levels calculated the same way

Add-Ons

1-ADX Colored Directional Movement Line

Directional Movement (DMI) (created by J. Welles Wilder ) consists of the Average Directional Index ( ADX ), to define whether or not there is a trend present, and Plus Directional Indicator (+D I) and Minus Directional Indicator (-D I) serve the purpose of determining trend direction

ADX Colored Directional Movement Line is custom interpretation of Directional Movement (DMI) with aim to present all 3 DMI indicator components with SINGLE line and ability to be added on top of the price chart (main chart)

How to interpret :
 * triangle shapes:
  ▲- bullish : diplus >= diminus
  ▼- bearish : diplus < diminus
* colors:
  green - bullish trend : adx >= strongTrend and di+ > di-
  red - bearish trend : adx >= strongTrend and di+ < di-
  gray - no trend : weekTrend < adx < strongTrend
  yellow - week trend : adx < weekTrend

* color density:
  darker : adx growing
  lighter : adx falling


2- Volatility Colored Price/MA Line

Custom interpretation of the idea “Prices high above the moving average (MA) or low below it are likely to be remedied in the future by a reverse price movement”. Further details can be found under study “Price Distance to its MA by DGT”

How to interpret :
 -▲ – Bullish, Price Action above Moving Average
 -▼ – Bearish, Price Action below Moving Average
 -Gray/Black - Low Volatility
 -Green/Red – Price Action in Threshold Bands
 -Dark Green/Red – Price Action Exceeds Threshold Bands

3- Volume Weighted Bars
Volume Weighted Bars, a study of Kıvanç Özbilgiç, aims to present whether volume supports price movements. Volume Weighted Bars are calculated based on volume moving average.

How to interpret :
 -Volume high above the volume moving average be displayed with darker red/green colors
 -Average volume values will remain as they are and
 -Volume low below the volume moving average will be indicated with lighter colors

note : please be aware that this functionality is subject to re-paint whereas it does not affect the main idea of this study, Pivot Points

4-Ichimoku Cloud

The Ichimoku Cloud , developed by Goichi Hosoda and published in the late 1960s, is a collection of technical indicators that give it a unique capacity to show support and resistance levels, momentum and trend direction. The overall trend is up when price is above the cloud, known as Kumo Cloud, down when price is below the Kumo Cloud, and trendless or transitioning when price is in the Kumo Cloud

Traders often use the Kumo Cloud as an area of support and resistance depending on the relative location of the price. The Kumo Cloud provides support/resistance levels that can be projected into the future. This sets the Ichimoku Cloud apart from many other technical indicators that only provide support and resistance levels for the current date and time

Crossovers, also known as TK Cross among Ichimoku Cloud traders, are another way the indicator can be used


snapshot
Release Notes
minor addition

the standard deviation is a measure of the amount of variation or dispersion of a set of values. A low standard deviation indicates that the values tend to be close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the values are spread out over a wider range

the 68–95–99.7 rule, also known as the empirical rule, is a shorthand used to remember the percentage of values that lie within a band around the mean. more precisely, 68.27%, 95.45% and 99.73% of the values lie within one, two and three standard deviations of the mean, respectively

All the above are the basics of the Bollinger Bands, where build-in BB displays the area of two standard deviations of the mean.

This update will display all three areas
1- From mean to one standard deviations of the mean, background no color filled
2- Area between one and two standard deviations of the mean, background colored
3- Area between two and three standard deviations of the mean, background colored with different color
Release Notes
major update

* code completely reworked by introducing arrays especially with recently added new array types (with this case array.new_line and array.new_string)

  ⮩ @TradingView thanks a lot for continuous feature updates and additions, makes coding even easier as well as increases script preformances 🙏

* added previous high and low levels as well as projected ones

* Logistic EMA (LEMA) added as another add-on :

Logistic EMA w/ Signals by DGT


future plan is to enrich statistical pannel similar to
Technical Analyst by DGT
Release Notes
panel enrichments, as promised earlier ;-)

* added most commonly used oscilator evualtion results - RSI, STOCH and MACD

* added Fear & Greed index value, this is custom interpretaion of mine using technical anlysis approach calculated based on :
 ⮩1 - Price Momentum : Price Distance to its Moving Average
 ⮩2 - Strenght : Rate of Return, price movement over a period of time
 ⮩3 - Money Flow : Chaikin Money Flow, quantify changes in buying and selling pressure. CMF calculations is based on Accumulation/Distribution
 ⮩4 - Market Volatility : CBOE Volatility Index ( VIX ), the Volatility Index, or VIX , is a real-time market index that represents the market's expectation. It provides a measure of market risk and investors' sentiments
 ⮩5 -Safe Haven Demand: in this study GOLD demand is assumed

ps: Fear & Greed index presents only daily time frame calculation values regardless of the time frame the user is

finally a request from MeTu2018, thnaks for the comment 🙏

* added ability to move panel
Release Notes
Update : added Central Pivot Range (CPR)

Central Pivot Range (CPR)

The fundamental idea behind this indicator is that the particular day’s trading range captures everything about the market sentiment, and hence this range can be used to predict the price movement of the following days

The previous day’s high, low, and close prices are used to calculate the CPR levels for the current day. And these levels remain constant throughout the day

Unlike traditional pivot points CPR consists of 3 levels, a central pivot point (pivot), top central level (TC), and bottom central level (BC)

How to use it for Trading?

CPR Breakout
Any breakout above or below the TC and BC lines respectively indicates a high probability that the movement will continue. And if the breakout candle has higher volume than the preceding candles, than it gives an extra confirmation

CPR Width
The width of the CPR lines very accurately gives an idea of the expected price movement. If CPR width is narrow, that is the distance between TC and BC lines of CPR is very low, then it indicates a trending market.
While if the distance between TC and BC lines is relatively higher it indicates sideways market.

CPR as Support and Resistance
CPR lines can also act as support and resistance. When used judiciously, it can help you decide your stop loss level. Any of the 3 CPR lines can be used for this purpose

Reference : tradingtuitions.com

sincerely thanks for your suggestion Gunslinger2005 and MartinWeb 🙏


Release Notes
typo correction plus added colored circle shapes
Release Notes
update

a meter tool added to display the sentiment of the market

in its calculation its assumes Central Pivot Range and S/R lines of Pivot Point selected

Price action above CPR - neutral bullish,
Price action above CPR and R1 of Pivot Point selected - bullish,
Price action above CPR and R3 of Pivot Point selected - strong bullish,

same approach applied for bearins sentiment.

please be aware that indicators included in statistical panel are not taken into account they are available there for further confirmation

thanks a lot rumpypumpydumpy for your inspiring idea 🙏
Release Notes
spelling correction
Release Notes
slight visualization change

Made Previous HTF OHLC able to be plotted along with a selected Pivot
* Plotting will be from previous HTF
* Color : red if previous htf open is grater than close, and green otherwise
Release Notes
update

* updated Auto HFT selection, now when Monthly chart selected Yearly Pivots will be calculated

* bollinger band's lines added, fill background made optional

* NEW - added Range Meter : will display Low and High of the selected Higher Time Frame, pointer to Current Price

Happy New Year!
Release Notes
quick update : also added previous day/htf session range meter
Release Notes
Major Update

Special thanks to Gunslinger2005 and Rotzeod, experienced and expert pivot traders, for their highly valuable contributions

* Added ability of plotting Weekly and/or Monthly Pivot support & resistance Levels, which is a way to identify Pivot Confluence Zones

Daily pivot level acts as a support or resistance but has limited strength. Weekly pivot level has a better strength than daily pivot level in terms of acting as a support and resistance and the power increases as the pivot timeframe increases to monthly, quarterly and yearly. This is because at daily pivot the participants are short term traders only. In weekly pivots, the category of participants also include swing traders apart from short term traders and hence the impact on price is more prominent. In monthly pivots , you might as well have positional traders apart from swing traders and short term traders thereby the impact on price is even more prominent….. and so on and so forth

* Added ability to plot Historical Pivots, Interpreting overall trend through Pivots

* Added ATR to be displayed along with Range Meter

* Added Option to plot Volume Weighted Average Price (VWAP)

Additionally,
Now the Pivot S&R lines will extends all the way to where the higher time frame would end

To reduce the load, removed the tooltip from statistical panel where numerical values of Pivot S&R used to be presented

Release Notes
minor update

* instead of just ATR(length) value added ATR Range on top of the Higher Time Frame's Price Range Indicator

* statistical panel position limitation removed

* added build-in Linear Regression Indicator
Release Notes
quick update

added Pivot Support and Resistance Labels with their corresponding values in the tooltip. Thanks to Pine Team for their new array label addition
Release Notes
made the code more readable

statistical panel made by default enabled
Release Notes
minor update

bollinger deviation bands made customizable by users,
added an additional 4th level
default settings made same as the BB study of the popular trader WyckoffMode with suggestion of @sandyrindal. Thanks Sandy for the suggestion
Release Notes
Cycling Between Expansion and Contraction is one of the most well-known theories in regards to Bollinger Bands is that volatility typically fluctuates between periods of expansion (Bands Widening : surge in volatility and price breaks through the BB Cloud) and contraction (Bands Narrowing : low volatility and price is moving relatively sideways).

This updates will add the option to be able to plot the Bollinger Bands by default with the length identified by the input "Plotting Length and Historical Pivots Length" and hence add the ability to identify Cycles Between Expansion and Contraction

More with regards to Bollinger Bands you are invited to check BB+ by DGT

Others:
Linear Regression Deviation Lines are colored green or red based on the slope
Ichimoku Kumo Cloud default display changed to extended
Release Notes
a minor bug that was reported is corrected with this update

besides the bug fix :

* linear regression deviation chanel plotting is by default performed for both upper/lower and standard deviation

short description for some options is added in the input dialog box

slightly re-arranged inputs benefiting from the new pine feature

for atr range calculation default rma smoothing is assumed and the option for other moving averages are removed
Release Notes
update requirement after recent Pine changes applied on built-in functions (such as round() function)

functionally only Fear & Greed Index calculations changed from Daily only to the time frame of the chart (current time frame)
Release Notes
Major Update

Added Alerts ability
  - All Pivot Support & Resistance Levels, including Weekly and Monthly Levels (not Central Pivot Range)
  - Linear Regression Line and both Upper and Lower Standard Deviation Lines
  - Previous Higher Timeframe High/Low Levels
  - Bollinger Band’s Standard Deviation 3rd and 4th Bands
  - Logistic EMA (LEMA)

Added ability to customize Levels
  - Pivot Support & Resistance Levels, line style, line color, line width, enable/disable option all at once or individually
  - Previous HTF Levels, line style
  - Central Pivot Range Levels, line style, color

Added Camarilla Level 6 Support & Resistance Lines

Enlarged Labels with Tooltips

Improved Price Range Meter, also enlarged Price Range Meter

Programmatically improved the flow and internal functions
Release Notes
Volume Weighted Colored Bars color code correction
Release Notes
Update

- Replaced VWAP with the updated build-in version
- Added additional Woodie levels + corrected Woodie pivot calculation (issue used to be observed only on markets with gaps)
- Added ability to disable Subsequent Pivot Support and Resistance levels, and/or schedule them to be displayed only during the last hours of the trading session (duration is customizable)
- Price can be added to the pivot support and resistance levels labels (price used to be displayed only as tooltip)

Ps : have not replaced statistical panel with new tables, for more detailed statistical panel, benefiting from new tables features, you may refer to Technical Analyst
Release Notes
slight improvements

* ability to select quarterly and yearly pivots (used to be available only with auto tf selection now available with user defined selection)

* improved statistical data within range meter (tooltip, available when you hover over the label)

* slight color changes with vwap (aimed to made more visable when ichi cloud is enabled)
Release Notes
pine error fixed, probable cause of the error is likely pine core update by pine team may have affected the scripts behaviour
Release Notes
converted to pine v5 along with some tiny additions and improvements
Release Notes
update : indicator optimization and fulfilling user requests

* Pivot Points Timeframe AUTO resolution determination made same as TV's build-in
The indicator resolution is set by the input of the Pivots Timeframe. If the Pivots Timeframe is set to AUTO (the default value), then the increased resolution is determined by the following algorithm:
- for intraday resolutions up to and including 15 min, DAY (1D) is used
- for intraday resolutions more than 15 min, WEEK (1W) is used
- for daily resolutions MONTH is used (1M)
- for weekly and monthly resolutions, 12-MONTH (12M) is used

PS : Auto Pivots Timeframe selection is available for the folowing chart timeframes : 1m, 3m, 5m, 15m, 30m, 45m, 1H, 2H, 3H, 4H, 1D, 1W, 1M. chart timeframes such as 2D, 3D requires users to specify Pivots Timeframe maunally

Besides the Auto Pivots Timeframe selection users may set Pivots Timeframe based on thier needs (available in the options)

PS : For intraday chart the difference between Session and Daily
- Daily will take into account extended hours (if present on the chart) during pivot calculations, whereas
- Session will assume only regular trading hours. Session is default value for AUTO pivot timeframe

* Enhanced customization options
- Pivot S&R Level Lables
- Linear Regression Channel
- Previous OHLC


Other Pivot Studies :
Fibonacci-Extension-Retracement-Pivot-Points
FibFans-and-Pivots
Support and Resistance :
Support-Resistance and Volume-Profile

Release Notes
correction with pivot manual timeframe selection
thanks for the warning rajivdangar007
Release Notes
Update covering some of the User requests
- Specific for Indian Users : Start Trading Week from Specific Day option added, default option is Monday
- Display Middle Pivot S&R Level Lines option added, default value set to false
- Individual color option for each Pivot S&R Level Line added. Disabling a specific pivot level option removed, instead color transparency can be adjusted or remove the line display
- Pivot Points types extended to include 'Classic' and 'Traditional' pivot points
- Slight aesthetic changes
Release Notes
Update

- customized pivot points high low indicator addition

snapshot


- new statistical panel, label replaced with a table

snapshot


- slight aesthetic changes with historical pivots (had to remove BB background fill)

thanks to everyone who presented their valuable suggestions
Release Notes
Update ;

* Pivot points high low improvments
- a temporary pivot point high low detection added (3 bars)
- pivot point high low label customization

* OHLC data selection option added, besides internally calculated data now fetching data with security() function option is available

* Displying both Selected Pivots and CPR historical levels at the same time is made available

* Moving thr location of Market Sentiment Meter and Price Range Meter is now possible with horizontal and vertical offset options
Camarilla Pivot PointscentralpivotrangeDGTDirectional Movement Index (DMI)fearandgreedfloorIchimoku CloudPivot PointsswingtradingTechnical Analysistechnicalindicators

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer