TradingView indicators

MACD volume indicator guide

Volume-weighted MACD vs volume confirmation

Short answer

Volume-weighted MACD changes the price averages themselves. One explicit version subtracts a slow VWMA from a fast VWMA and smooths that difference for its signal line. Standard MACD with volume confirmation keeps its EMA calculation and accepts a crossover only when a separate volume condition passes. These methods can trigger on different bars; the name alone does not identify the formula.

Parts of the setup

MACD concept definitions and test uses
ConceptDefinitionTest use
Rolling VWMAVWMA(n) = sum(close × volume over n bars) / sum(volume over the same n bars). Each window includes the current completed bar.Require a complete window of known volume values and a positive total volume. This is a rolling average, not a session-anchored VWAP.
VWMA-difference MACDW = VWMA(fast) − VWMA(slow); signal = EMA(W, signal length); histogram = W − signal.This page defines that specific variant. A ratio of volume-weighted EMAs or an elastic average is a different formula.
Standard MACD plus a filterM = EMA(close, fast) − EMA(close, slow); signal = EMA(M, signal length). Volume does not change M or its signal.Accept a bullish crossover only when current volume divided by the mean of the previous L completed bars is greater than a fixed threshold.
Crossover versus stateA bullish crossover requires the current line above its signal and the previous line at or below its previous signal.A filter that passes later does not revive a rejected crossover. Requiring only line above signal would define a different entry rule.

A rule you can put into code

  1. 1

    Freeze the calculation

    Write the price source, fast/slow lengths, signal smoothing, volume baseline, initialization, and missing-data policy.

    Matching length labels does not make different average types equivalent.

  2. 2

    Compare values before alerts

    On the same TradingView feed and session, inspect both lines, signals, histograms, and volume ratios at completed timestamps.

    A screenshot comparison without matching source data cannot establish numerical agreement.

  3. 3

    Require valid consecutive bars

    Evaluate the crossover only after the current bar closes and both current and previous indicator values are valid.

    Intrabar price and volume can change. A gap must not become a fabricated crossover.

  4. 4

    Separate formula and filter tests

    Run the four controls below before combining volume weighting with an entry filter.

    Otherwise a change in smoothing, participation filtering, or trade count can be mistaken for the effect of volume weighting.

A six-bar calculation with different crossover dates

This is a hypothetical arithmetic example, not a market backtest. Closes for bars 1 through 6 are 100, 102, 101, 104, 102, 105. Volumes in arbitrary but consistent units are 10, 10, 100, 10, 100, 10. Use fast 2, slow 3, and signal 2 to keep the calculation short; these are not recommended trading settings.

Seed both price EMAs at 100 on bar 1, so standard MACD and its initial signal are zero. For every EMA, alpha = 2 / (length + 1), and the next value is alpha × current input + (1 − alpha) × previous EMA. The weighted line first exists on bar 3; seed its signal with that first value. Each method then applies a 2-bar EMA to its own line.

For confirmation, divide current volume by the mean of the previous two bars, excluding the current bar, and require a ratio strictly greater than 1. All values below are rounded to four decimals after calculation. Both methods use the same closing prices and bar-close timing.

  • Bar 3: VWMA(2) = 101.0909 and VWMA(3) = 101.0000, so W = 0.0909; weighted signal = 0.0909. Standard M = 0.1111 and signal = 0.1481. Relative volume = 10.0000. The weighted signal is only initialized; no weighted crossover can be inferred without a valid previous value.
  • Bar 4: VWMA(2) = 101.2727 and VWMA(3) = 101.3333, so W = −0.0606; weighted signal = −0.0101. Standard M = 0.5370 and signal = 0.4074, a bullish crossover. Relative volume = 10 / 55 = 0.1818, so the confirmation version rejects that event.
  • Bar 5: VWMA(2) = 102.1818 and VWMA(3) = 101.6190, so W = 0.5628; weighted signal = 0.3718, a bullish crossover. Standard M = 0.0957 and signal = 0.1996, a bearish crossover. Relative volume = 100 / 55 = 1.8182. Passing the volume filter cannot turn a bearish MACD event into a bullish one.
  • Bar 6: VWMA(2) = 102.2727 and VWMA(3) = 102.4167, so W = −0.1439; weighted signal = 0.0280. Standard M = 0.4902 and signal = 0.3933, another bullish crossover. Relative volume = 0.1818, so it is rejected again. Volume weighting and confirmation have produced different event sequences.

Reproduce the denominator and initialization

On bar 5, the fast VWMA is (104 × 10 + 102 × 100) / (10 + 100) = 11240 / 110 = 102.1818. The slow VWMA is (101 × 100 + 104 × 10 + 102 × 100) / 210 = 21340 / 210 = 101.6190. Their difference is 0.5628 price units. It is not a percentage or a measure of traded volume.

The hand example fixes its start at bar 1. A chart with earlier history can have different EMA seeds and initial readings. Match the full history, source, session, and seed before asserting agreement. For a research test, preload history, use one common evaluation start, and check that extending the preload no longer materially changes signals in the scored period.

Missing volume is not zero volume

TradingView reports that some symbols and timeframes have no volume data; some feeds supply tick volume, which counts price updates. Record the exchange or provider, timeframe, session, and volume meaning. A tick-volume test and a traded-unit-volume test are different data experiments.

Use an explicit strict policy for this version: a missing or negative volume anywhere in a required window makes that weighted value or filter unavailable. Do not silently replace missing volume with zero, one, or a price-only average. The standard price MACD can still be displayed, but a volume-confirmed entry must remain disabled.

A genuine zero-volume bar contributes zero weight. It does not invalidate a VWMA window whose total volume is positive. If either fast or slow total volume is zero, the weighted difference is unavailable. A zero previous-volume mean makes the relative-volume ratio unavailable, even if the current bar has volume. A valid ratio equal to 1 fails a strictly greater-than-1 filter.

After an invalid weighted value, reset its signal and seed it on the next valid weighted value. Require a further consecutive valid bar before allowing crossovers. Apply the same restart rule to the SMA control. Log invalid periods and score all variants on a common valid sample so missing data cannot masquerade as an improved strategy.

Use four controls to isolate the volume contribution

Replacing EMA with VWMA changes both the weighting and the averaging method. Comparing only those two cannot attribute the difference to volume. Include an unweighted rolling SMA control, because constant positive volume makes VWMA equal to SMA, not EMA.

For an entry-only experiment, give every arm the same exit: a bearish standard EMA MACD crossover, with exits processed before entries and no re-entry on that bar. Keep position size, costs, fill timing, session, dates, and risk limits fixed. Evaluate conditions at bar close and model entry at the next bar open. Never require the entry volume filter for a risk exit.

  • A: Standard EMA MACD 12/26 with a 9-bar EMA signal, bullish crossover entries, no volume filter.
  • B: The same A entries, accepted only when volume / mean(previous 20 completed volume bars) > 1. Comparing A with B isolates the filter.
  • C: SMA(close, 12) − SMA(close, 26), with a 9-bar EMA signal and bullish crossover entries. Comparing A with C exposes the change from exponential to rolling averages.
  • D: VWMA(close, 12) − VWMA(close, 26), with the same signal length and crossover rule, no entry filter. Comparing C with D isolates volume weights within the rolling windows.
  • Compare net return, drawdown, trade count, average net trade, exposure time, and rejected entries on untouched dates. Fewer losses alongside fewer trades is not sufficient evidence of improvement. Only after these controls should a fifth arm combine weighting and filtering.

Turn the chosen formula into an inspectable specification

Give the Pine Script AI Coding Agent the chosen arm, price source, lengths, EMA seed, strict missing-volume policy, bar-close trigger, and exit priority. Ask for separately inspectable line, signal, histogram, validity, and relative-volume outputs before adding alerts.

Request a syntax check, then compare the outputs with the same formula on TradingView at recorded timestamps. Compilation checks language correctness; it does not prove numerical agreement, profitability, or equivalence to a protected community script. This page defines a public calculation and does not claim to reproduce proprietary code.

Test templates

These examples define a research process. They are not trade calls or evidence that a setup will make money.

Synthetic six-bar input

Completed bars

Rule to test

Reproduce the 2/3/2 example using the explicit seed and previous-two-bar volume denominator.

Validation

Check the bar 4 rejected standard crossover and bar 5 weighted crossover. Match unrounded values before comparing event flags.

One fixed exchange feed

One fixed interval

Rule to test

Run controls A through D on the same valid dates, with shared exits, next-open fills, position size, and costs.

Validation

Use C versus D for volume weighting and A versus B for confirmation. Preserve an untouched evaluation period and report exposure alongside returns.

Volume boundary fixtures

Completed bars

Rule to test

Repeat with constant positive volumes, one zero, an all-zero window, and one missing volume.

Validation

Constant volume must give VWMA = SMA. One zero may be valid; a zero denominator or missing window must disable volume-dependent signals.

Checks before accepting a result

Record the formula and source feed, not just the indicator title or line colors.

Retain rejected crossover timestamps. A later rise in volume is not permission to backdate an entry.

Treat the six-bar example as a numerical fixture. It contains no evidence about future returns.

Turn the idea into an inspectable Pine Script rule

The Pine Script AI Coding Agent can create and edit code documents from a written specification, and provides a syntax-check tool on request. Use it to implement one stated MACD variant, inspect the generated formula and validity rules, then verify values in TradingView before creating alerts.

Build a defined MACD volume rule

Frequently asked questions

What is the volume-weighted MACD formula?

One explicit version is VWMA(close, fast) minus VWMA(close, slow), with an EMA signal line and a histogram equal to the difference minus its signal. Other scripts use different volume adjustments, so inspect their formula before comparing values.

Is a MACD volume filter the same as volume-weighted MACD?

No. A filter accepts or rejects a standard MACD event without changing its line. Volume weighting changes the average prices and can move the crossover to a different bar.

Does constant volume restore standard EMA MACD?

No. Constant positive volume makes a rolling VWMA equal to a rolling SMA. A VWMA difference therefore becomes an SMA difference, which generally differs from EMA MACD.

What should happen when volume is missing?

Mark the volume-dependent calculation unavailable and disable its entry condition under the strict policy defined here. Keep missing values distinct from real zeros, and do not substitute a price-only signal without labeling a separate method.

Does volume weighting make MACD more accurate?

No general accuracy improvement follows from the formula. It changes the observations that receive more weight; confirmation also removes potential trades. Evaluate a defined rule after costs against the correct control on untouched data.

Sources and limits

Source review completed 2026-10-17.

This page is an indicator-testing resource, not investment advice. The example is synthetic and the test designs are not return forecasts. Backtests can omit execution effects, and trading can result in loss.