OPEN-SOURCE SCRIPT
Pivot Pro - CPR PDH/PDL EMA by Sani

═══════════════════════════════════════════════
PIVOT POINTS PRO — CPR + PDH/PDL + EMA
Full Historical | No Repaint | All Customizable
═══════════════════════════════════════════════
A professional all-in-one indicator combining the
Standard Pivot Point system with CPR (Central Pivot Range),
Previous Day High/Low, and dual EMAs — all non-repainting,
fully customizable per level, and drawn across complete
chart history.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔷 PIVOT POINTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Supports all 6 types: Traditional, Fibonacci,
Woodie, Classic, DM, Camarilla
- Timeframe anchoring: Auto, Daily, Weekly, Monthly,
Quarterly, Yearly, and multi-year periods
- Every level (P, R1–R5, S1–S5) has its own
independent Color, Line Style, and Line Width
- Lines extend to the right edge of the chart
- Historical pivot count controlled by "Number of Pivots Back"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔶 CPR — CENTRAL PIVOT RANGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Calculated from previous day OHLC (non-repainting)
- Draws CPR Pivot, BC (Bottom Central), TC (Top Central)
- Visible across ALL historical sessions — not just today
- Each line has its own Color, Style (Solid/Dashed/Dotted),
and Width
- Current session extends to right edge automatically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔹 PDH / PDL — PREVIOUS DAY HIGH & LOW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Previous day High and Low plotted per session
- Full chart history — every completed day visible
- Independent Show/Hide, Color, Style, and Width
for PDH and PDL separately
- Current session extends to right edge automatically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 EMA — FAST & SLOW WITH TREND COLORING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Dual EMA (default 10 / 20) with dynamic color:
→ Green when Fast > Slow (bullish)
→ Red when Fast < Slow (bearish)
→ Yellow when flat
- Optional EMA Band background highlight (purple)
when price is between the two EMAs
- EMA Touch + 2-Candle confirmation alerts included
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ SETTINGS OVERVIEW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Pivot Type & Timeframe
- Labels: Show/Hide, position (Left or Right), prices
- Per-level: P, R1–R5, S1–S5 — Color, Style, Width
- CPR: Master toggle + individual Pivot / BC / TC controls
- PDH/PDL: Master toggle + individual PDH / PDL controls
- EMA: Lengths, Width, Band background
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ NO REPAINT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All values fetched using:
request.security(..., lookahead=barmerge.lookahead_on)
with [1] shift on daily OHLC — values are locked to
the previous completed day and never change on the
current bar.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 BEST USED ON
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Intraday timeframes: 1m, 3m, 5m, 15m, 30m, 1H
Works on any market: Stocks, Forex, Crypto, Futures
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔔 BUILT-IN ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- EMA Bullish Cross
- EMA Bearish Cross
- Price Touched PDH
- Price Touched PDL
- Price Near CPR Pivot
PIVOT POINTS PRO — CPR + PDH/PDL + EMA
Full Historical | No Repaint | All Customizable
═══════════════════════════════════════════════
A professional all-in-one indicator combining the
Standard Pivot Point system with CPR (Central Pivot Range),
Previous Day High/Low, and dual EMAs — all non-repainting,
fully customizable per level, and drawn across complete
chart history.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔷 PIVOT POINTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Supports all 6 types: Traditional, Fibonacci,
Woodie, Classic, DM, Camarilla
- Timeframe anchoring: Auto, Daily, Weekly, Monthly,
Quarterly, Yearly, and multi-year periods
- Every level (P, R1–R5, S1–S5) has its own
independent Color, Line Style, and Line Width
- Lines extend to the right edge of the chart
- Historical pivot count controlled by "Number of Pivots Back"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔶 CPR — CENTRAL PIVOT RANGE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Calculated from previous day OHLC (non-repainting)
- Draws CPR Pivot, BC (Bottom Central), TC (Top Central)
- Visible across ALL historical sessions — not just today
- Each line has its own Color, Style (Solid/Dashed/Dotted),
and Width
- Current session extends to right edge automatically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔹 PDH / PDL — PREVIOUS DAY HIGH & LOW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Previous day High and Low plotted per session
- Full chart history — every completed day visible
- Independent Show/Hide, Color, Style, and Width
for PDH and PDL separately
- Current session extends to right edge automatically
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 EMA — FAST & SLOW WITH TREND COLORING
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Dual EMA (default 10 / 20) with dynamic color:
→ Green when Fast > Slow (bullish)
→ Red when Fast < Slow (bearish)
→ Yellow when flat
- Optional EMA Band background highlight (purple)
when price is between the two EMAs
- EMA Touch + 2-Candle confirmation alerts included
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ SETTINGS OVERVIEW
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Pivot Type & Timeframe
- Labels: Show/Hide, position (Left or Right), prices
- Per-level: P, R1–R5, S1–S5 — Color, Style, Width
- CPR: Master toggle + individual Pivot / BC / TC controls
- PDH/PDL: Master toggle + individual PDH / PDL controls
- EMA: Lengths, Width, Band background
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ NO REPAINT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All values fetched using:
request.security(..., lookahead=barmerge.lookahead_on)
with [1] shift on daily OHLC — values are locked to
the previous completed day and never change on the
current bar.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 BEST USED ON
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Intraday timeframes: 1m, 3m, 5m, 15m, 30m, 1H
Works on any market: Stocks, Forex, Crypto, Futures
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔔 BUILT-IN ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- EMA Bullish Cross
- EMA Bearish Cross
- Price Touched PDH
- Price Touched PDL
- Price Near CPR Pivot
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.