OPEN-SOURCE SCRIPT
已更新 CPR by VickyBobby

CPR by VickyBobby
A complete Central Pivot Range (CPR) indicator designed for intraday and positional traders. This script plots Daily, Weekly, and Monthly CPR levels along with the full classical floor pivot system (R1 to R4, S1 to S4), previous day reference levels, and an automated CPR width classifier - delivering a unified view of the most actionable support and resistance zones on the chart.
WHAT THIS INDICATOR PLOTS
Central Pivot Range (CPR):
- Pivot (P)
- Top Central (TC)
- Bottom Central (BC)
Floor Pivot Levels:
- Resistance: R1, R2, R3, R4
- Support: S1, S2, S3, S4
Previous Day Reference Levels:
- Previous Day High (PDH)
- Previous Day Low (PDL)
- Previous Day Close (PDC)
Higher Timeframe CPR (Optional):
- Weekly CPR
- Monthly CPR
FORMULAS USED
Pivot (P) = (High + Low + Close) / 3
Bottom Central = (High + Low) / 2
Top Central = (Pivot - BC) + Pivot
R1 = (2 x P) - Low
R2 = P + (High - Low)
R3 = High + 2 x (P - Low)
R4 = R3 + (R2 - R1)
S1 = (2 x P) - High
S2 = P - (High - Low)
S3 = Low - 2 x (High - P)
S4 = S3 - (S1 - S2)
All values are derived from the previous period's High, Low, and Close.
KEY FEATURES
- Day-by-day segmented lines: each trading session displays its own discrete horizontal levels that automatically reset at the start of a new day.
- Forward-extended live levels for the current trading day, making active zones easy to spot.
- Independent toggles for every level (R1 to R4, S1 to S4, PDH, PDL, PDC).
- Multi-timeframe CPR with separate colors for daily, weekly, and monthly.
- Optional CPR Width Classifier: automatically labels the day as Narrow (likely trending), Normal, or Wide (likely sideways) based on customizable thresholds.
- Optional info table showing current Pivot, TC, BC, CPR width percentage, and day type.
- Full styling controls: line width, line style (Solid, Dashed, Dotted), individual colors, label visibility, and price display options.
- Built-in alerts for price crossing Pivot, TC, BC, R1, and S1.
- Clean status line: no input arguments cluttering the indicator title.
HOW TO USE
Interpreting CPR Width:
- Narrow CPR (low previous-day range) often signals a trending day with directional follow-through.
- Wide CPR (high previous-day range) often signals consolidation or range-bound action.
- Higher CPR than the previous day suggests a bullish bias.
- Lower CPR than the previous day suggests a bearish bias.
- Overlapping CPRs across multiple days suggest a sideways accumulation phase.
Trading Approach:
- A sustained move above TC indicates buyer control; upside targets become R1, R2, R3.
- A sustained move below BC indicates seller control; downside targets become S1, S2, S3.
- The pivot itself often acts as the day's mean - price tends to revert to it during consolidation.
- PDH and PDL serve as critical short-term reference points; a break and hold beyond either often defines the day's direction.
- Virgin CPR levels (untouched in the previous session) tend to act as strong magnets and have a higher probability of being tested.
RECOMMENDED SETTINGS
Indian Index Trading (Nifty / Bank Nifty):
- Timeframe: 5m, 15m, or 30m
- Enable: Daily CPR, PDH, PDL, R1, R2, S1, S2
- Line width: CPR = 2, Pivots = 1
Swing Trading / Forex / Crypto:
- Timeframe: 1H to 4H
- Enable: Daily and Weekly CPR
- Adjust width thresholds to suit the asset's volatility profile
NOTES
- Works on any symbol and any timeframe.
- CPR calculations are based on the previous daily session by default.
- Optimized for intraday timeframes (1m to 1H) where CPR levels are most actionable.
- All calculations use standard, widely accepted floor pivot and CPR formulas.
DISCLAIMER
This indicator is provided for educational and informational purposes only. It does not constitute financial advice or a recommendation to trade. Always perform your own analysis and apply proper risk management before making any trading decisions.
A complete Central Pivot Range (CPR) indicator designed for intraday and positional traders. This script plots Daily, Weekly, and Monthly CPR levels along with the full classical floor pivot system (R1 to R4, S1 to S4), previous day reference levels, and an automated CPR width classifier - delivering a unified view of the most actionable support and resistance zones on the chart.
WHAT THIS INDICATOR PLOTS
Central Pivot Range (CPR):
- Pivot (P)
- Top Central (TC)
- Bottom Central (BC)
Floor Pivot Levels:
- Resistance: R1, R2, R3, R4
- Support: S1, S2, S3, S4
Previous Day Reference Levels:
- Previous Day High (PDH)
- Previous Day Low (PDL)
- Previous Day Close (PDC)
Higher Timeframe CPR (Optional):
- Weekly CPR
- Monthly CPR
FORMULAS USED
Pivot (P) = (High + Low + Close) / 3
Bottom Central = (High + Low) / 2
Top Central = (Pivot - BC) + Pivot
R1 = (2 x P) - Low
R2 = P + (High - Low)
R3 = High + 2 x (P - Low)
R4 = R3 + (R2 - R1)
S1 = (2 x P) - High
S2 = P - (High - Low)
S3 = Low - 2 x (High - P)
S4 = S3 - (S1 - S2)
All values are derived from the previous period's High, Low, and Close.
KEY FEATURES
- Day-by-day segmented lines: each trading session displays its own discrete horizontal levels that automatically reset at the start of a new day.
- Forward-extended live levels for the current trading day, making active zones easy to spot.
- Independent toggles for every level (R1 to R4, S1 to S4, PDH, PDL, PDC).
- Multi-timeframe CPR with separate colors for daily, weekly, and monthly.
- Optional CPR Width Classifier: automatically labels the day as Narrow (likely trending), Normal, or Wide (likely sideways) based on customizable thresholds.
- Optional info table showing current Pivot, TC, BC, CPR width percentage, and day type.
- Full styling controls: line width, line style (Solid, Dashed, Dotted), individual colors, label visibility, and price display options.
- Built-in alerts for price crossing Pivot, TC, BC, R1, and S1.
- Clean status line: no input arguments cluttering the indicator title.
HOW TO USE
Interpreting CPR Width:
- Narrow CPR (low previous-day range) often signals a trending day with directional follow-through.
- Wide CPR (high previous-day range) often signals consolidation or range-bound action.
- Higher CPR than the previous day suggests a bullish bias.
- Lower CPR than the previous day suggests a bearish bias.
- Overlapping CPRs across multiple days suggest a sideways accumulation phase.
Trading Approach:
- A sustained move above TC indicates buyer control; upside targets become R1, R2, R3.
- A sustained move below BC indicates seller control; downside targets become S1, S2, S3.
- The pivot itself often acts as the day's mean - price tends to revert to it during consolidation.
- PDH and PDL serve as critical short-term reference points; a break and hold beyond either often defines the day's direction.
- Virgin CPR levels (untouched in the previous session) tend to act as strong magnets and have a higher probability of being tested.
RECOMMENDED SETTINGS
Indian Index Trading (Nifty / Bank Nifty):
- Timeframe: 5m, 15m, or 30m
- Enable: Daily CPR, PDH, PDL, R1, R2, S1, S2
- Line width: CPR = 2, Pivots = 1
Swing Trading / Forex / Crypto:
- Timeframe: 1H to 4H
- Enable: Daily and Weekly CPR
- Adjust width thresholds to suit the asset's volatility profile
NOTES
- Works on any symbol and any timeframe.
- CPR calculations are based on the previous daily session by default.
- Optimized for intraday timeframes (1m to 1H) where CPR levels are most actionable.
- All calculations use standard, widely accepted floor pivot and CPR formulas.
DISCLAIMER
This indicator is provided for educational and informational purposes only. It does not constitute financial advice or a recommendation to trade. Always perform your own analysis and apply proper risk management before making any trading decisions.
版本注释
Updated CPR Strategy by VickyBobby版本注释
Update the CPR tools with Next Day CPR 版本注释
Updated CPR by VickyBobby版本注释
Updated version with CPR Strategy开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。