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.
Release Note
Updated CPR Strategy by VickyBobbyRelease Note
Update the CPR tools with Next Day CPR Release Note
Updated CPR by VickyBobbyRelease Note
Updated version with CPR Strategyสคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน