OPEN-SOURCE SCRIPT
CPR by Subash

CPR — Central Pivot Range with Multi-Timeframe Pivots
This indicator plots the Central Pivot Range (CPR) along with standard floor-trader pivot levels across four timeframes — daily, weekly, monthly and yearly — on a single chart. It also plots the previous period's high and low for each timeframe, and can optionally project the next period's CPR forward.
**What the Central Pivot Range is**
The CPR is a three-line zone derived from the previous period's high, low and close:
- Pivot (PP) = (High + Low + Close) / 3
- Bottom Central (BC) = (High + Low) / 2
- Top Central (TC) = Pivot − BC + Pivot
The width of the band between TC and BC reflects how balanced the previous period was. A narrow CPR indicates the prior period closed near the middle of a tight range; a wide CPR indicates a broader distribution. Traders commonly use the relationship between successive CPR bands, and price's position relative to them, as context for the session.
**Support and resistance levels**
Standard pivot-derived levels R1–R4 and S1–S4 are calculated for each timeframe using the conventional floor-trader formulas. These are geometric projections from the previous period's range, not predictions.
**Timeframe visibility**
Each set of levels only renders on chart timeframes below its own period, so the chart does not fill with irrelevant lines:
- Daily levels — intraday charts only
- Weekly levels — intraday and daily
- Monthly levels — intraday, daily and weekly
- Yearly levels — intraday through monthly
**Settings**
Every timeframe group has independent toggles for its pivot, its support/resistance set, its CPR band, and its previous-period high and low. Daily, weekly and monthly pivots plus support/resistance are enabled by default; yearly levels and all CPR bands beyond the daily one are off by default to keep the initial chart readable. A single line-width input controls all plots.
**Next CPR projection (off by default)**
The "Show Next CPR" option projects the upcoming period's CPR and pivot levels forward on the chart by a configurable bar offset. Choose the projection period — daily, weekly, monthly or yearly — with the resolution input.
**Important — this section repaints by design.** It reads the current, still-incomplete period's high, low and close in order to compute where the next period's levels would fall. Those values change as the current period develops, so the projected lines move until the period closes. This is inherent to what a forward projection is; it is not a bug, but it does mean these particular lines must not be used for signal generation, backtesting, or alerts. All other levels in the script are calculated from completed prior periods and do not repaint.
**Notes on use**
These are reference levels, not entry signals. The script produces no buy or sell markers and makes no directional claims. How useful any given level is depends entirely on the instrument, the timeframe, and the volatility regime — verify the behaviour on your own instrument before relying on it.
This indicator plots the Central Pivot Range (CPR) along with standard floor-trader pivot levels across four timeframes — daily, weekly, monthly and yearly — on a single chart. It also plots the previous period's high and low for each timeframe, and can optionally project the next period's CPR forward.
**What the Central Pivot Range is**
The CPR is a three-line zone derived from the previous period's high, low and close:
- Pivot (PP) = (High + Low + Close) / 3
- Bottom Central (BC) = (High + Low) / 2
- Top Central (TC) = Pivot − BC + Pivot
The width of the band between TC and BC reflects how balanced the previous period was. A narrow CPR indicates the prior period closed near the middle of a tight range; a wide CPR indicates a broader distribution. Traders commonly use the relationship between successive CPR bands, and price's position relative to them, as context for the session.
**Support and resistance levels**
Standard pivot-derived levels R1–R4 and S1–S4 are calculated for each timeframe using the conventional floor-trader formulas. These are geometric projections from the previous period's range, not predictions.
**Timeframe visibility**
Each set of levels only renders on chart timeframes below its own period, so the chart does not fill with irrelevant lines:
- Daily levels — intraday charts only
- Weekly levels — intraday and daily
- Monthly levels — intraday, daily and weekly
- Yearly levels — intraday through monthly
**Settings**
Every timeframe group has independent toggles for its pivot, its support/resistance set, its CPR band, and its previous-period high and low. Daily, weekly and monthly pivots plus support/resistance are enabled by default; yearly levels and all CPR bands beyond the daily one are off by default to keep the initial chart readable. A single line-width input controls all plots.
**Next CPR projection (off by default)**
The "Show Next CPR" option projects the upcoming period's CPR and pivot levels forward on the chart by a configurable bar offset. Choose the projection period — daily, weekly, monthly or yearly — with the resolution input.
**Important — this section repaints by design.** It reads the current, still-incomplete period's high, low and close in order to compute where the next period's levels would fall. Those values change as the current period develops, so the projected lines move until the period closes. This is inherent to what a forward projection is; it is not a bug, but it does mean these particular lines must not be used for signal generation, backtesting, or alerts. All other levels in the script are calculated from completed prior periods and do not repaint.
**Notes on use**
These are reference levels, not entry signals. The script produces no buy or sell markers and makes no directional claims. How useful any given level is depends entirely on the instrument, the timeframe, and the volatility regime — verify the behaviour on your own instrument before relying on it.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。