Indicator

Fathom VWAP

Session or rolling VWAP, with three bands.

What the indicator shows

  • The central line is the VWAP: the session’s average price, weighted by the volume traded at each price.
  • The three pairs of bands, above and below, measure the distance from the VWAP, in standard deviations or as a percentage.

How to use it

  • Above the VWAP, price trades higher than the session’s average; below it, lower.
  • The outer bands locate the extremes, from which price tends to return toward the average.
  • In a trend, pullbacks to the VWAP or the first band often act as support or resistance.
  • bars gives a rolling VWAP over the last bars, independent of the start of the session.

How it is computed

  • daily: session VWAP, which starts over at every session open, at 6:00 pm New York time (full session, not only the RTH session); periodValue must then be 1. bars: rolling VWAP over the last periodValue finished bars.
  • The standard deviation is the volume-weighted standard deviation of prices, with a Bessel correction on volume: √(Σ v·(p − VWAP)² / (V − 1)), where V is the total volume; it is 0 while V is at most 2.
  • The bands sit first, second and third standard deviations from the VWAP (standard-deviation), or as many percent of the VWAP (price-percentage: 0.25 puts the band 0.25% from the VWAP, 50 points for a 20,000-point VWAP). These three values range from 0.01 to 10, with at most two decimals.

When it updates

  • One point per finished timeframe-second bar, sent once, final, when the bar closes; its id is the start of the bar. No value is published inside a bar.
  • A field is only absent when its value is undefined (zero cumulative volume): in practice, every field is present.
  • Weekly reset: at the Sunday reopen (6:00 pm New York time), the computation starts over, rolling window included; the week’s last bar gets its point on the first trade of the reopen.
Identifier
vwap-bands
Objects received
point
Historical cost
1 compute unit per trade

Subscribe

The same params work in real time, on historical data and in exports. Parameters you omit take their default values.

Subscribe message
{
  "t": "subscribe",
  "sub": "vwap-bands",
  "instrument": "NQ.front",
  "indicator": "vwap-bands",
  "params": {
    "envelopeMode": "standard-deviation",
    "first": 1,
    "periodMode": "daily",
    "periodValue": 1,
    "second": 2,
    "third": 3,
    "timeframe": 300
  },
  "mode": "live",
  "from": "live"
}

Parameters

As soon as a parameter differs from its default, the subscription counts as a custom configuration. To change a parameter, open a new subscription.

ParameterTypeDefaultAllowed valuesUnitDescription
envelopeModechoicestandard-deviationstandard-deviation · price-percentage—Bands in standard deviations (standard-deviation) or as a percentage of the VWAP (price-percentage).
firstnumber10.01 to 10—Distance of band 1 from the VWAP, from 0.01 to 10, with at most two decimals: in standard deviations (1.5), or in percent of the VWAP with price-percentage (0.25 = 0.25%).
periodModechoicedailydaily · bars—Session VWAP (daily) or rolling over periodValue bars (bars).
periodValueinteger11 to 10,000barsNumber of bars in the rolling window with bars; must be 1 with daily.
secondnumber20.01 to 10—Distance of band 2 from the VWAP, in the same unit, from 0.01 to 10, with at most two decimals.
thirdnumber30.01 to 10—Distance of band 3 from the VWAP, in the same unit, from 0.01 to 10, with at most two decimals.
timeframeinteger3001 · 5 · 10 · 15 · 30 · 60 · 120 · 180 · 300 · 600 · 900 · 1800 · 3600—Bar duration in seconds: from 1 second (1) to 1 hour (3600).

Objects received

Each object keeps the same id from one update to the next. Its data is in the data field. Prices are in ticks: multiply them by the instrument’s tick size (GET /v1/instruments) to get points.

point sent final

Values at the close of the bar.

id format: <barStartNs>. Each object is sent once, final (final: true).

FieldTypeUnitPresentDescription
lower1numbertickssometimesBand −1.
lower2numbertickssometimesBand −2.
lower3numbertickssometimesBand −3.
upper1numbertickssometimesBand +1: VWAP + first standard deviations (or first% of the VWAP with price-percentage: 0.25% of a 20,000-point VWAP is 50 points).
upper2numbertickssometimesBand +2 (second multiplier).
upper3numbertickssometimesBand +3 (third multiplier).
vwapnumbertickssometimesVWAP; like the bands, absent when the value is undefined.

Example messages

Messages as the WebSocket sends them to the subscription above, taken from a real NQ session. Historical data returns the same objects, with the same cursor, without the sub field.

Final object
{
  "sub": "vwap-bands",
  "cursor": "20720.0.0",
  "t": "upsert",
  "id": "1790207700000000000",
  "final": true,
  "ts": "1790208000058746563",
  "data": {
    "vwap": 123131.51652638063,
    "upper1": 123195.01381482669,
    "lower1": 123068.01923793457,
    "upper2": 123258.51110327273,
    "lower2": 123004.52194948852,
    "upper3": 123322.00839171879,
    "lower3": 122941.02466104247
  }
}

JSON schemas

To validate or type your data: the JSON schemas of the parameters and of data, also available from GET /v1/indicators. The SDK can generate types from them.

Parameters schema
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fathomcharts.com/schemas/vwap-bands/params.json",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "envelopeMode": {
      "description": "Bands in standard deviations (`standard-deviation`) or as a percentage of the VWAP (`price-percentage`).",
      "type": "string",
      "default": "standard-deviation",
      "enum": [
        "standard-deviation",
        "price-percentage"
      ]
    },
    "first": {
      "description": "Distance of band 1 from the VWAP, from 0.01 to 10, with at most two decimals: in standard deviations (`1.5`), or in percent of the VWAP with `price-percentage` (`0.25` = 0.25%).",
      "type": "number",
      "default": 1,
      "minimum": 0.01,
      "maximum": 10,
      "multipleOf": 0.01
    },
    "periodMode": {
      "description": "Session VWAP (`daily`) or rolling over `periodValue` bars (`bars`).",
      "type": "string",
      "default": "daily",
      "enum": [
        "daily",
        "bars"
      ]
    },
    "periodValue": {
      "description": "Number of bars in the rolling window with `bars`; must be 1 with `daily`.",
      "type": "integer",
      "default": 1,
      "minimum": 1,
      "maximum": 10000
    },
    "second": {
      "description": "Distance of band 2 from the VWAP, in the same unit, from 0.01 to 10, with at most two decimals.",
      "type": "number",
      "default": 2,
      "minimum": 0.01,
      "maximum": 10,
      "multipleOf": 0.01
    },
    "third": {
      "description": "Distance of band 3 from the VWAP, in the same unit, from 0.01 to 10, with at most two decimals.",
      "type": "number",
      "default": 3,
      "minimum": 0.01,
      "maximum": 10,
      "multipleOf": 0.01
    },
    "timeframe": {
      "description": "Bar duration in seconds: from 1 second (`1`) to 1 hour (`3600`).",
      "type": "integer",
      "default": 300,
      "enum": [
        1,
        5,
        10,
        15,
        30,
        60,
        120,
        180,
        300,
        600,
        900,
        1800,
        3600
      ]
    }
  },
  "allOf": [
    {
      "description": "`periodValue` must be 1 in `daily` mode.",
      "if": {
        "properties": {
          "periodMode": {
            "const": "daily"
          }
        }
      },
      "then": {
        "properties": {
          "periodValue": {
            "const": 1
          }
        }
      }
    }
  ]
}
data field schema
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://fathomcharts.com/schemas/vwap-bands/data.json",
  "title": "point",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "lower1": {
      "description": "Band −1.",
      "type": "number"
    },
    "lower2": {
      "description": "Band −2.",
      "type": "number"
    },
    "lower3": {
      "description": "Band −3.",
      "type": "number"
    },
    "upper1": {
      "description": "Band +1: VWAP + `first` standard deviations (or `first`% of the VWAP with `price-percentage`: 0.25% of a 20,000-point VWAP is 50 points).",
      "type": "number"
    },
    "upper2": {
      "description": "Band +2 (`second` multiplier).",
      "type": "number"
    },
    "upper3": {
      "description": "Band +3 (`third` multiplier).",
      "type": "number"
    },
    "vwap": {
      "description": "VWAP; like the bands, absent when the value is undefined.",
      "type": "number"
    }
  },
  "required": []
}