Loading…

Anchored VWAP From Clicked Bar

A daily VWAP always starts at midnight. An anchored VWAP starts wherever the trader decides something changed - a news release, a swing low, the open of a specific session - and that anchor point is the entire value of the tool. This indicator drops a draggable dashed vertical line onto the chart; the VWAP line is recalculated cumulatively from whichever bar the vertical line currently sits on, straight through to the live bar, and it stays that way until the line is dragged somewhere else. Dragging a chart object does not generate a new price tick, so an indicator that only recalculates inside OnCalculate() would sit frozen until the next tick arrived. This one hooks OnChartEvent() for the drag (and the object edit-end event some builds send instead) and calls the same recalculation routine OnCalculate() uses, then forces an immediate ChartRedraw() - moving the anchor updates the line instantly, not on the next tick. The recalculation itself only ever walks from the anchor bar to the current bar, never the full chart history, and only clears the specific range of bars vacated when the anchor moves forward - both bounded by how far back the anchor is, which is the correct cost for a tool whose entire purpose is a trader-chosen window rather than the whole dataset. Notes and limitations - Uses tick volume, not real traded volume, the same as every VWAP on this platform's retail feeds on both MT4 and MT5 - neither has a consolidated forex tape. - The anchor is stored only as a chart object, so it resets to the default position whenever the indicator is removed, the timeframe changes, or the terminal restarts. It is a charting aid for the current session, not a saved setting. - If the anchor line is deleted, it is recreated automatically at the default position the next time the indicator recalculates.

Indicator · MT4 · v1.0 · Free

About Anchored VWAP From Clicked Bar

Anchored VWAP From Clicked Bar is an indicator for MetaTrader 4. It has 1 setting, such as Default bars back. MQL source code included.

Files in the download: AnchoredVwap.ex4, AnchoredVwap.mq4, AnchoredVwap.txt.

Settings

SettingDefaultWhat it does
Default bars back50Bars back from the current bar for the initial anchor position

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: VWAP · Volume · Trading Sessions · News Trading · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria