**Volume-weighted average price** (**VWAP**) is a lagging volume indicator. The VWAP is a weighted moving average that uses the volume as the weighting factor so that higher volume days have more weight. It is a non-cumulative moving average, so only data within the time period is used in the calculation.

Although this function is available in `talib`, we will show you how to compute an indicator manually here by creating its formula. This will help you create your own indicators at times when you may use customer technical indicators or not-so-popular indicators that are missing from `talib`.

The formula for calculating VWAP is as follows:

Here, *n* is the *time period* and has to be defined by the user.

## Getting started

Make sure your Python namespace has the following objects:

`pd`(module)`plot_candlesticks_chart`(function)`PlotType`(enum)`historical_data`(a`pandas`DataFrame)

Refer to the *Technical requirements* section of this chapter to set...