OPEN-SOURCE SCRIPT
POC MONTHLY + PIVOT

POC Monthly + Pivot — Code Explanation
This is a Pine Script v5 TradingView indicator that combines two powerful concepts: Monthly Volume Profile (with POC/VAH/VAL) and Swing Support & Resistance levels. Here's a breakdown: 1. User Inputs
pinerows = 48 // How many price rows to split the month into
va_pct = 70 // Value Area = 70% of total volume
lookback = 10 // How many bars to look back for swing highs/lows
rs_len = 8 // Visual length of S/R lines (in bars)
Plus color and style settings for boxes, POC line, and volume bars.
📐 2. Support & Resistance (Swing High/Low)
pineswingHigh = ta.pivothigh(high, lookback, lookback)
swingLow = ta.pivotlow (low, lookback, lookback)
Detects pivot highs (Resistance) and pivot lows (Support) using TradingView's built-in functions.
For each detected swing, it draws:
A horizontal line centered on that bar
A label showing "R 1234.56" (above) or "S 1234.56" (below)
Red = Resistance, Green = Support
📊 3. Monthly Volume Profile — Data Collection
This is the heart of the indicator. It tracks volume per price row within each month.
New Month Detection
pineis_new_month = ta.change(time("M")) != 0
When a new month begins:
The previous month's data is saved (prev_high, prev_low, prev_vol[], prev_start)
Current month arrays are reset to zero
Volume Distribution
Each candle's volume is distributed across the price rows it spans:
pinerow_size = (month_high - month_low) / rows
candle_vol = volume / number_of_rows_spanned
This spreads each candle's volume proportionally across all rows it touches — a simplified but effective TPO-style volume profile.
🎨 4. draw_profile() — The Drawing Function
This function does all the visual work for a given month's data:
Step 1 — Find the POC (Point of Control)
pine// Row with the highest volume = POC
The POC is the price level where the most volume was traded that month.
Step 2 — Calculate Value Area (VAH & VAL)
Starting from the POC, it expands outward (up or down, whichever row has more volume) until 70% of total volume is captured:
VAH = Value Area High (top of the 70% zone)
VAL = Value Area Low (bottom of the 70% zone)
Step 3 — Draw Everything
ElementWhat it isbox (big)The Value Area rectangle (VAL → VAH)box (small, per row)Individual volume bars — wider = more volumePOC rowRed-tinted barValue Area rowsTeal-tinted barsOutside VA rowsGray barsPOC lineRed horizontal line across the monthLabelsVAH, POC, VAL prices on the right edge
🔄 5. When Does It Draw?
pine// Draw PREVIOUS month's profile when a new month starts
if is_new_month and not na(prev_high) ...
draw_profile(prev_vol, ...)
// Draw CURRENT month's profile (live, updating) on the last bar
if barstate.islast and not na(month_high) ...
draw_profile(vol_by_row, ..., bar_index + 10)
Past months: drawn once when the month closes ✅
Current month: redrawn live on every new bar, extending slightly to the right (+10 bars) 🔄
🧠 Key Concepts Summary
POC → Price with most volume = strongest magnet/fair value
VAH → Top of Value Area → potential resistance
VAL → Bottom of Value Area → potential support
R/S → Swing pivot levels for short-term structure
The idea is that price tends to return to the POC and respect VAH/VAL as key zones — combining this with swing levels gives you a layered view of where the market has found value and where it may react.
This is a Pine Script v5 TradingView indicator that combines two powerful concepts: Monthly Volume Profile (with POC/VAH/VAL) and Swing Support & Resistance levels. Here's a breakdown: 1. User Inputs
pinerows = 48 // How many price rows to split the month into
va_pct = 70 // Value Area = 70% of total volume
lookback = 10 // How many bars to look back for swing highs/lows
rs_len = 8 // Visual length of S/R lines (in bars)
Plus color and style settings for boxes, POC line, and volume bars.
📐 2. Support & Resistance (Swing High/Low)
pineswingHigh = ta.pivothigh(high, lookback, lookback)
swingLow = ta.pivotlow (low, lookback, lookback)
Detects pivot highs (Resistance) and pivot lows (Support) using TradingView's built-in functions.
For each detected swing, it draws:
A horizontal line centered on that bar
A label showing "R 1234.56" (above) or "S 1234.56" (below)
Red = Resistance, Green = Support
📊 3. Monthly Volume Profile — Data Collection
This is the heart of the indicator. It tracks volume per price row within each month.
New Month Detection
pineis_new_month = ta.change(time("M")) != 0
When a new month begins:
The previous month's data is saved (prev_high, prev_low, prev_vol[], prev_start)
Current month arrays are reset to zero
Volume Distribution
Each candle's volume is distributed across the price rows it spans:
pinerow_size = (month_high - month_low) / rows
candle_vol = volume / number_of_rows_spanned
This spreads each candle's volume proportionally across all rows it touches — a simplified but effective TPO-style volume profile.
🎨 4. draw_profile() — The Drawing Function
This function does all the visual work for a given month's data:
Step 1 — Find the POC (Point of Control)
pine// Row with the highest volume = POC
The POC is the price level where the most volume was traded that month.
Step 2 — Calculate Value Area (VAH & VAL)
Starting from the POC, it expands outward (up or down, whichever row has more volume) until 70% of total volume is captured:
VAH = Value Area High (top of the 70% zone)
VAL = Value Area Low (bottom of the 70% zone)
Step 3 — Draw Everything
ElementWhat it isbox (big)The Value Area rectangle (VAL → VAH)box (small, per row)Individual volume bars — wider = more volumePOC rowRed-tinted barValue Area rowsTeal-tinted barsOutside VA rowsGray barsPOC lineRed horizontal line across the monthLabelsVAH, POC, VAL prices on the right edge
🔄 5. When Does It Draw?
pine// Draw PREVIOUS month's profile when a new month starts
if is_new_month and not na(prev_high) ...
draw_profile(prev_vol, ...)
// Draw CURRENT month's profile (live, updating) on the last bar
if barstate.islast and not na(month_high) ...
draw_profile(vol_by_row, ..., bar_index + 10)
Past months: drawn once when the month closes ✅
Current month: redrawn live on every new bar, extending slightly to the right (+10 bars) 🔄
🧠 Key Concepts Summary
POC → Price with most volume = strongest magnet/fair value
VAH → Top of Value Area → potential resistance
VAL → Bottom of Value Area → potential support
R/S → Swing pivot levels for short-term structure
The idea is that price tends to return to the POC and respect VAH/VAL as key zones — combining this with swing levels gives you a layered view of where the market has found value and where it may react.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน