欢迎访问 外汇EA下载与MT4/MT5自动交易资源 - 聚合外汇EA、黄金EA、量化交易工具与自动化交易实战内容。
登录 注册

每日交易量概况专业版 [WillyAlgoTrader] (Daily Volume Profile Pro [WillyAlgoTrade)

author emer | 1 人阅读 | 0 人评论 |
来源:ForexFactory · Trading Systems · 原帖链接
原帖作者:Burton
发布日期:First Post: Mar 31, 2026 12:15pm
I found this on TradingView and converted the Open Source Pine Script code to MT4 code.

Original code with all details here: https://www.tradingview.com/script/O...llyAlgoTrader/

Daily Volume Profile Pro is an overlay indicator that builds a complete volume profile for each daily session — distributing volume across price bins using candle-range proportional allocation, computing POC (Point of Control), 70% Value Area (VAH/VAL) using the CME expansion method, session VWAP, buy/sell delta per bin, and displaying up to 7 days of profiles simultaneously. The indicator also detects naked (unvisited) POCs from prior days, classifies each day's profile shape (Normal/Trend/Neutral/Double Distribution), tracks Initial Balance ranges, and highlights single-print thin-volume zones — creating a complete volume-based market context tool.

WHY THESE COMPONENTS WORK TOGETHER

A volume profile alone shows where trading activity concentrated — but without context, you don't know whether the profile represents a trending day, a balanced day, or a double-distribution day. You don't know whether the POC from two days ago was ever revisited. You don't know whether the current price is above or below the Initial Balance — which tells you whether the opening range has been broken.

This indicator layers multiple volume-based analyses that each answer a different question:

Volume Profile → WHERE did volume concentrate? Which prices are accepted (high volume) and rejected (low volume)?
POC → What is the single most-traded price? This is the market's "fair value" for that session.
Value Area (70%) → Where did 70% of volume trade? Price inside VA = balance. Price outside VA = imbalance seeking new value.
Delta Coloring → At each price level, was the activity dominated by buyers or sellers? Green bins = buying pressure, red = selling.
Naked POCs → Which prior-day fair values were never revisited? These are strong magnets — price tends to return to unfinished business.
Initial Balance → What was the opening range? Price above IB High = bullish conviction. Below IB Low = bearish. Inside = balance.
Day Type → What shape is the profile? Trend days (narrow) behave differently than Normal (bell curve) or Double Distribution (bimodal) days.
Single Prints → Where did price move too fast for volume to fill? These thin-volume zones are gaps in the profile that often get revisited.

No single component provides a complete picture. The combination tells you: the market's fair value (POC), the accepted range (VA), the directional pressure (delta), the day's character (day type), the opening bias (IB), unfinished levels from prior sessions (naked POCs), and price imbalances (single prints) — all from volume data.

WHAT MAKES IT ORIGINAL

Candle-range proportional volume allocation.
Each candle's volume is distributed across the price bins it touches, proportional to the overlap between the candle's range and each bin:

overlap = max(0, min(candle_high, bin_high) − max(candle_low, bin_low))
allocated_volume = total_volume × overlap / candle_range

This produces a smoother, more accurate profile than the common approach of assigning all volume to a single price (close or typical price). A candle spanning 5 bins distributes its volume across all 5, weighted by how much of the candle falls in each bin.

Buy/sell classification: close ≥ open → buy candle (volume added to buy array), close < open → sell candle (volume added to sell array). Delta coloring shows whether each bin was dominated by buying or selling pressure.

CME-style Value Area expansion.
The 70% Value Area is computed using the standard CME method:
— Start at POC bin
— Compare the volume of the next bin above vs the next bin below
— Expand toward whichever side has higher volume
— Repeat until 70% of total session volume is captured
— VAH = top of the highest included bin, VAL = bottom of the lowest included bin

This matches the industry-standard method used by CME Group and professional platforms. The VA is displayed as dashed lines (VAH/VAL) with an optional semi-transparent background fill.

Naked POC detection with historical scan.
For each prior day's POC, the indicator scans all bars from the POC's day to the present — checking whether price ever touched that level (low ≤ pocPrice ≤ high). If no bar has touched it, the POC is classified as "naked" (nPOC) and drawn as a dashed red line extending to the right.

Naked POCs represent unfinished business — the market established fair value at that price but never returned to retest it. They act as strong magnets because institutional activity that established the original POC may still hold positions anchored to that level. The scan limit is 300 bars to maintain performance.

Day type classification from profile shape.
Each day's volume distribution is analyzed to classify the session:

Trend: significant bins < 35% of total bins — volume concentrated in a narrow area, price moved decisively in one direction
Neutral: significant bins > 65% — volume spread evenly across the range, balanced/rotational day
Normal: 35–65% — bell-curve distribution with clear POC and tapering tails
DD (Double Distribution): significant bins concentrated in both top and bottom thirds but not the middle — bimodal distribution indicating two separate value areas (e.g., gap-and-go)

A "significant bin" is defined as having volume > 25% of POC volume. The classification appears as a color-coded label above each session.

Initial Balance (IB) range tracking.
The IB captures the high and low of the first N minutes of each session (configurable: 30, 60, 90, or 120 minutes). The IB range is drawn as solid lines with optional background fill, optionally extended to the end of session.

IB context: price above IB High signals that early buyers were committed and the market accepted higher prices — bullish bias. Price below IB Low signals the opposite. Price inside IB = range-bound session. The dashboard shows the current IB position (Above IB / Below IB / Inside IB).

Single print (thin volume) zone detection.
Bins with volume less than 15% of the POC bin's volume are classified as single prints — areas where price moved too quickly for significant volume to build. These are highlighted with a distinct border color and represent imbalance zones that often get revisited as the market seeks to fill the volume gap.

Multi-day profile display with configurable orientation.
Up to 7 days of profiles are drawn simultaneously with left or right orientation. Each day's profile bins are scaled proportionally: bin width = volume / maxVolume × span/3 in bars. The adaptive bin count adjusts to the day's price range: bins = min(binCountInput, max(8, range / (ATR × 0.05))).

POC extension + previous day POC (yPOC).
Each day's POC can be extended forward as a dashed line for 1–7 days (configurable), serving as a reference level for subsequent sessions. Yesterday's POC (yPOC) is drawn separately as a labeled reference — one of the most-watched volume levels in professional trading.

Today's POC, VAH, and VAL can be extended to the right chart edge for real-time reference.

Session VWAP.
Volume-weighted average price computed per session: VWAP = Σ(typicalPrice × volume) / Σ(volume). Displayed as a dotted line within each session. VWAP represents the average price at which volume traded — a key reference for institutional traders.

Optional MA overlay.
Six MA types available (SMA, EMA, RMA, WMA, VWMA, None) for additional trend context alongside the volume profile.

HOW IT WORKS — CALCULATION FLOW

Step 1 — Session detection: Day change tracked via ta.change(time("D")). Session start/end bars, day high/low, and timestamps stored in arrays. IB high/low tracked during the first N minutes of each session.

Step 2 — Profile construction (per day): For each session, the price range is divided into bins. Every candle within the session distributes its volume across bins proportional to the candle-range overlap with each bin. Separate buy and sell arrays track directional volume.

Step 3 — POC/VA/VWAP: POC = bin with maximum volume. VA computed via CME expansion from POC until 70% captured. VWAP = cumulative (typical price × volume) / cumulative volume.

Step 4 — Visualization (last bar): All profiles, lines, and labels are drawn on barstate.islast using delete-and-redraw pattern. Profile boxes are colored by delta (buy/sell dominance), with POC bin highlighted, VA bins tinted, single prints bordered.

Step 5 — Naked POC scan: Each prior-day POC is checked against all subsequent bars. If no bar has touched the level → naked POC drawn as dashed line.

Step 6 — Day type: Volume distribution analyzed for shape classification (Trend/Normal/Neutral/DD).

HOW TO USE

Quick start:
1. Add the indicator to an intraday chart (1M–30M recommended)
2. Volume profiles appear for each daily session (up to 7 days)
3. Yellow horizontal line = POC (highest volume price)
4. Blue dashed lines = VAH / VAL (70% Value Area boundaries)
5. Red dashed lines = naked POCs from prior days (unvisited fair values)
6. Orange lines = Initial Balance high/low

Reading the chart:
Solid line = POC (session fair value)
Dashed line = extended POC (reference for future sessions)
Dashed line with "nPOC" label = naked POC (unvisited — strong magnet)
"yPOC" label = yesterday's POC
Dashed lines = VAH / VAL (70% Value Area boundaries)
Shaded zone = Value Area background
Dotted line = session VWAP
Solid lines = IB High / IB Low
Shaded zone = Initial Balance range
Profile bins = buying pressure (delta positive)
Profile bins = selling pressure (delta negative)
Bordered bins = single prints (thin volume — imbalance zones)
— Day type labels: Trend / Normal / Neutral / DD

Dashboard fields:
— Day Type: profile shape classification (Trend / Normal / Neutral / DD)
— Trend: price vs POC (Bullish ▲ / Bearish ▼)
— Price Zone: Above VA / Inside VA / Below VA
— IB Position: Above IB / Inside IB / Below IB
— POC: today's price, vs POC distance
— VAH / VAL: Value Area boundaries
— Delta: net buy/sell percentage
— Volume: total session volume
— Naked POCs: count of unvisited prior-day POCs

Tuning guide:
Profile too coarse: increase Profile Bins (30–40)
Profile too granular: decrease Profile Bins (15–20)
Want to see more history: increase Days to Show (up to 7)
IB too narrow for your market: increase IB Period (90–120 min)
Too many single prints: this is informational — they highlight real imbalances

KEY SETTINGS REFERENCE

Main:
Days to Show (default 7): number of daily profiles (1–7)
Profile Bins (default 34): resolution of volume distribution

Profile:
Delta Coloring (default On): color bins by buy/sell pressure
Single Prints (default On): highlight low-volume imbalance zones (< 15% of POC)
Profile Side (default Left): draw bars left or right of session

Levels:
POC (default On) with width and extension (1–7 days)
Naked POCs (default On): unvisited prior-day POCs
Value Area (default On) with background fill
Session VWAP (default Off)
Previous Day POC (default On): yPOC reference
Extend Today (default On): extend current session levels to chart edge

Initial Balance:
IB Period (default 60 min): 15–120 minutes
IB Background (default On) / Extend IB Lines (default On)

Visual:
— Day separators, day labels (Mon–Sun), day type labels
— MA overlay: SMA/EMA/RMA/WMA/VWMA/None
— Auto / Dark / Light theme

Alerts

POC CROSS UP / POC CROSS DOWN — price crosses today's POC
VAH BREAK — price breaks above Value Area High
VAL BREAK — price breaks below Value Area Low

IMPORTANT NOTES

Use on intraday timeframes. The indicator builds daily session profiles — it requires intraday data (1M–30M recommended) to produce meaningful volume distribution. On daily or higher timeframes, each day has only one candle, producing a single-bin profile.
No repainting. All alert conditions require barstate.isconfirmed. Profiles are computed from historical data within each session. Today's profile updates in real-time as new bars arrive (this is expected behavior for a live volume profile — not repainting).
The volume allocation is proportional to candle-range overlap, not tick-by-tick. True tick data is not available in Pine Script. This candle-range method produces a close approximation for intraday timeframes (1M–15M). Lower timeframes = more candles per session = more accurate profile.
The Value Area uses the standard CME expansion method: start at POC, expand toward higher-volume adjacent bins until 70% captured. This matches the industry-standard algorithm used by professional platforms.
Naked POC scan checks up to 300 bars of history per POC for performance reasons. On very low timeframes with many bars per day, a POC from 5+ days ago may exceed the scan range.
Single prints are defined as bins with volume < 15% of POC volume — these represent areas where price moved too quickly for meaningful volume to accumulate. They are not errors or missing data.
Day type classification uses volume distribution shape analysis based on the ratio of significant bins to total bins. It's a probabilistic assessment of the session's character, not a definitive market prediction.
This is a volume analysis and market context tool, not an automated trading system. It visualizes where volume traded, which prices are accepted/rejected, and which levels remain unfinished — trade decisions remain yours.
Requires volume data. On instruments without reliable volume (some forex pairs), the profile accuracy depends on broker-reported tick volume.

Attached Image (click to enlarge)
Click to Enlarge

Name: Daily Volume Profile Pro.png
Size: 43 KB


//+------------------------------------------------------------------+
// MT4 NOTES FOR USE
//+------------------------------------------------------------------+
//
// 1. TIMEFRAME: Attach to an intraday chart (M1–M30 recommended).
// Daily or higher timeframes produce single-bin profiles.
//
// 2. VOLUME: Uses tick_volume[] (broker tick count), which is the
// only volume available in MQL4 for most instruments.
// For futures/stocks with real volume, tick_volume will equal volume.
//
// 3. SESSION DETECTION: Day boundaries are detected using server
// calendar time. If your broker's day starts at a time other
// than midnight, sessions will still align correctly to calendar
// days as reported by the broker's server time.
//
// 4. NAKED POC SCAN: Checks up to 300 bars forward per POC for
// performance. On very low timeframes with many bars per day,
// POCs from >5 days ago may fall outside the scan window.
//
// 5. COLOR RENDERING: MQL4 rectangles are fully opaque. The VA
// background and IB background use highly lightened colours to
// approximate the semi-transparent fills of the Pine Script
// original. Enable "Draw on background" (OBJPROP_BACK=true)
// so profile bars render behind candlesticks.
//
// 6. PERFORMANCE: Full session scan + profile rebuild runs only on
// new bar formation. Dashboard updates on every tick.
// On M1 with 7 days of data (~3360 bars) the rebuild typically
// completes in < 50 ms.
//
//+------------------------------------------------------------------+

原帖附件 (2)

📦 帖子附件汇总 (3)

以下是回帖中所有共享的附件(3 个,已去重)。

🔐
请登录后参与评论
注册满12小时后评论,即可解锁附件下载
立即登录