Free Forex indicator · MT4 / MT5

Anchored VWAP for MT4 & MT5: Free Download and Settings

Choose the starting candle for a weighted average and its deviation bands. Compare real EUR/USD examples, understand when the anchor moves, and download our marked source edition for desktop MT4 or MT5.

ForexBestRobots edition 1.01

Reviewed by ForexBestRobots Editorial Team

Original sourceEarnForex 1.00
PlatformsDesktop MT4 · MT5
LicenseApache 2.0 · Free
On this page

What Anchored VWAP displays

Anchored VWAP accumulates a weighted average from one selected candle to the latest candle. This EarnForex-based indicator draws the average, optional upper/lower deviation bands and a draggable vertical anchor. It can place the anchor a number of bars back or at the first available candle of the current day, week, month or year. It shows one active anchored range.

ForexBestRobots edition 1.01 is a marked derivative of EarnForex 1.00. It rejects invalid inputs, protects object ownership, handles unavailable/future anchors, stabilizes weighted variance and silences initial/reset/manual-move notifications. The unchanged originals, author notices, Apache 2.0 and change patches are included.

Prices, weights and deviation bands

For candles from the anchor onward, V=Σ(v×p)/Σv. Default p=(H+L+C)/3. Other PriceType choices are (H+L+2C)/4, (H+L)/2, Close and Open. MT4 uses broker tick volume; MT5 can select tick or real trade volume. A bar’s representative price is weighted, not every individual transaction price.

Population variance is σ²=Σ[v(p−V)²]/Σv, with bands U=V+2σ and L=V−2σ by default. There is no n−1 sample correction. Our code uses weighted Welford updates to reduce subtraction error. The multiplier changes band width; the bands do not establish a 95% confidence interval or guarantee support/resistance.

Zero weight adds nothing. Before any positive weight the output is empty; later zero-weight candles carry the accumulated value. Real volume is often unavailable on spot Forex, so selecting it can produce no curve. We never replace missing volume with one. Invalid prices or negative weights clear the calculation until valid data can be recalculated.

Real EUR/USD examples

Figures use real HistData EUR/USD Bid quotes from June 2025. We reconstruct H1 OHLC and count supplied quote records per candle as weights. The file’s own Volume field is zero and is not used. These counts are not exchange volume or a captured MetaTrader broker history. Fixed EST timestamps are converted to UTC by adding five hours, without a daylight-saving adjustment. Charts and CSV are our reconstruction, not a profit backtest.

The BarsBack=100 snapshot ends at the 6 June 2025 20:00 candle, whose final values are known at 21:00. The anchor is 2 June 16:00, giving 101 included candles. Final V=1.141330, U=1.146395 and L=1.136266. This is one frozen anchor position. With default AutoUpdate=true, the next new chart candle moves a bars-back anchor and recalculates the whole displayed range; these historical snapshot events are not a log of live alerts.

The same prices with anchors at 4 June 00:00 and 5 June 00:00 yield V_A=1.141698 and V_B=1.143575 at the 5 June 23:00 candle, known at 6 June 00:00. Different windows produce different averages; neither anchor is declared superior. The comparison uses two conceptual instances with unique ObjectPrefix values, not a two-anchor feature in one instance.

The day snapshot anchors at 6 June 00:00. At C, the 09:00 close 1.141420 is below L=1.141504 after an inside close: the exit is observable at 10:00. At D, the 10:00 close 1.141920 is back inside, with L=1.141103: observable at 11:00. Only the current anchored day is drawn; the previous day is not retained as a second session curve. No trades or returns are simulated.

Real EUR/USD H1 with reconstructed quote-count weights. A frozen BarsBack100 anchor begins 2 June 16:00; 101 candles reach the 6 June 20:00 snapshot.
Real EUR/USD H1 with reconstructed quote-count weights. A frozen BarsBack100 anchor begins 2 June 16:00; 101 candles reach the 6 June 20:00 snapshot.2025-06-02 00:00 — 2025-06-06 20:00 UTC · 117 candles
Same real prices, two declared anchors: A at 4 June 00:00 and B at 5 June 00:00. Two VWAP curves are compared; bands for A are shown.
Same real prices, two declared anchors: A at 4 June 00:00 and B at 5 June 00:00. Two VWAP curves are compared; bands for A are shown.2025-06-04 00:00 — 2025-06-05 23:00 UTC · 48 candles
Current-day anchor at 6 June 00:00. C marks the 09:00 outside close; D the 10:00 return. Each is observable at the next H1 opening.
Current-day anchor at 6 June 00:00. C marks the 09:00 outside close; D the 10:00 return. Each is observable at the next H1 opening.2025-06-05 00:00 — 2025-06-06 20:00 UTC · 45 candles

Real Bid OHLC and our supplied-quote-record counts, UTC. HistData’s zero Volume field is not the weight. CSV contains active anchors and candle-close times; this is not a native platform capture or trading backtest.

Download chart calculation data (CSV) · 1Download chart calculation data (CSV) · 2Download chart calculation data (CSV) · 3

Anchor movement, calendar periods and chart time

This program calculates on the chart timeframe; it has no UpperTimeframe input. Changing timeframe changes candle representatives and aggregated weights, so the line need not be identical. Calendar boundaries use the broker chart clock, with Monday as the week start. Our UTC figures do not imply an automatic timezone conversion in the program. An incomplete current period uses its oldest loaded candle.

Dragging the anchor recalculates immediately using the candle containing that time, including the whole candle rather than a precise intrabar start. AutoUpdate=true resets a bars-back anchor on each new candle, or a calendar anchor on the next period boundary. Set it false to hold a manual anchor. BarsBack=100 means shift 100 and normally includes 101 candles through shift 0; short history clamps to the oldest loaded candle.

Settings and default values

MT4 has 19 functional inputs plus five Comment_ separator strings. MT5 has 20 functional inputs; VolumeType is MT5-only, as marked below. SDMultiplier must be finite and non-negative, BarsBack at least 1, and AnchorLineWidth 1–5. ObjectPrefix must be unique, nonempty, without spaces and at most 40 characters. Duplicate/nested namespaces are rejected.

InputDefaultPractical meaning
AnchorModeANCHOR_BARS_BACKBars-back or current-calendar-period anchoring.
BarsBack100Anchor shift, default 100; minimum 1. Shift100 normally includes 101 candles.
AnchorPeriodTypeAPT_DAYDay, Monday-based week, month or year; used in period-start mode.
AutoUpdatetrueReset the anchor on each new candle or period; true by default.
PriceTypePT_TYPICALRepresentative price; default (H+L+C)/3.
VolumeTypeVOLUME_TICKMT5 only: tick volume by default, or real trade volume when supplied. MT4 uses tick volume.
ShowBandtrueDisplay the deviation bands; hiding them does not disable band alerts.
SDMultiplier2.0Non-negative population-SD multiplier; default 2.0. Zero disables band event families.
AnchorLineColorclrDodgerBlueVertical anchor-line color.
AnchorLineStyleSTYLE_DASHVertical anchor-line style; default dashed.
AnchorLineWidth1Anchor-line width 1–5; default 1.
AlertOnVWAPCrossfalseEnable VWAP-cross events; off by default.
AlertOnBandExitfalseEnable inside-to-outside band events; off.
AlertOnBandReturnfalseEnable outside-to-inside band events; off.
AlertPopuptruePopup channel; on, but all event families start off.
AlertSoundfalseSound channel; off by default.
AlertSoundFile"alert.wav"Sound filename; default alert.wav; file must exist in terminal sounds.
AlertEmailfalseEmail channel; configure in the terminal.
AlertPushfalseMobile push channel; configure in the terminal.
ObjectPrefix"ForexBestRobots-AVWAP-"Unique namespace; default ForexBestRobots-AVWAP-. Do not delete its hidden InstanceLock.

Closed-candle events and notification channels

A VWAP upward event requires Close1>V1 and Close2≤V2 on the two closed candles; downward requires Close1<V1 and Close2≥V2. Equality on the newer candle alone is not a crossing. Band edges count as inside. Exit means inside then outside; return means outside then inside. Both evaluated candles must have positive selected volume.

All three event switches are off by default, while AlertPopup is on. Sound, email and push are off. Enable the desired event family and delivery channel separately. ShowBand=false hides bands but leaves their calculation and enabled band alerts active. SDMultiplier=0 disables band exit/return alerts while VWAP crosses remain available.

First attachment, history resets and manual anchor moves do not send immediate historical alerts. Later checks run once per new chart candle; multiple enabled families can fire together. Auto-updated anchors are evaluated using their new active range. Messages are analytical events, not orders; configure email/push and keep the terminal running. Native delivery and sound-file availability have not been verified here.

Install and compile the source

  1. Download and extract the ZIP for your desktop platform.
  2. In MetaTrader select File → Open Data Folder, then MQL4 or MQL5.
  3. Copy Indicators there; keep upstream separately as the unchanged reference.
  4. Open Anchored_VWAP_ForexBestRobots.mq4 or .mq5 in the matching MetaEditor, press F7 and inspect errors and warnings.
  5. Refresh Navigator → Indicators and attach the compiled program to a demo chart with sufficient history.
  6. Start with a unique ObjectPrefix and event switches off. Verify anchor movement, selected volume and AutoUpdate before enabling notifications.

Desktop custom indicators cannot be installed directly in the MetaTrader mobile app. Use separate prefixes for multiple instances. The calculation CSV is explanatory data, not a compiled indicator.

Download Anchored VWAP free

Each platform ZIP contains marked MQ4/MQ5 source, unchanged original, author notices, Apache 2.0, changes, a patch, checksums and instructions in all 12 site languages. These downloads target desktop MT4/MT5; no DLL or extra include is required.

There is no ready EX4/EX5. Actual source functions and drivers were checked outside MetaTrader using modeled APIs; native MQL compilation, rendering, drag events, broker synchronization and real notifications remain unverified. Compile with F7 in the matching MetaEditor, inspect errors and warnings, and test on a demo chart.

Free source ZIP · ForexBestRobots edition 1.01 · Compile in MetaEditor

Data limits and changing history

Spot Forex has no single consolidated trading-volume series. Broker tick activity and our quote-record counts are source-dependent proxies. This line cannot prove the average trader’s entry, who is profitable, or the market’s net long/short position. Bands and crosses do not define position size, stop or a complete trading method.

Open-candle prices and weights change. A fixed-anchor past value depends only on its own preceding window, but moving/auto-updating the anchor, changing timeframe or correcting history can change the displayed past curve. Choosing a historical anchor after seeing the result introduces hindsight. This program does not automatically identify a confirmed swing.

An anchor before loaded history or in the future produces empty output until an available range is selected; it is not silently moved to the latest candle. Load sufficient history, especially for calendar modes, and reattach after older-history corrections when a full refresh is needed. Long ranges and many instances can slow the terminal. The external checks do not replace native testing.

Frequently asked questions

Does tick volume equal exchange trade volume?

No. It reflects the selected feed’s activity. Our figures count supplied quote records and do not use HistData’s zero Volume field.

Does BarsBack100 include exactly 100 candles?

Normally it anchors at shift100 and includes 101 candles through shift0; short loaded history is clamped.

Why did my manual anchor move again?

AutoUpdate is true by default: bars-back mode resets on the next candle, calendar mode on the next period. Use false to hold it.

Does calendar mode retain every previous session VWAP?

No. It displays one active anchored range; a reset replaces the earlier curve.

Why is real-volume mode blank?

If the symbol supplies no positive real volume, the cumulative weight stays zero. MT5 can select tick volume instead; MT4 uses ticks.

Does hiding bands disable their alerts?

No. ShowBand only hides them. Event switches and SDMultiplier determine band notifications.

Are the downloads compiled and natively tested?

No. They are MQ4/MQ5 sources for F7 compilation. Modeled-API checks do not verify native MetaTrader execution.

Sources and review scope

The review follows a pinned EarnForex revision and marked ForexBestRobots changes. Real-data figures and CSV are our own reconstruction from HistData quotes, with the weight method disclosed. This does not imply endorsement by EarnForex or HistData.