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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。