# Technical Studies Reference

### Volume Weighted Average Price (VWAP) with Standard Deviation Lines

This study calculates and displays the Volume Weighted Average Price (VWAP) over the specified period of time for the symbol of the chart. The period of time is set by the Time Period Type and Time Period Length Inputs.

This calculation gives greater weight to trade prices that have a higher volume. The calculation resets at the begining of each new period in the chart.

Let $$X$$ be a random variable denoting the Input Data, let $$X_i$$ be the value of the Input Data at chart bar $$i$$, let $$V_i$$ be the Volume at chart bar $$i$$, and let $$n$$ be the length of the period in chart bars for the calculation as specified by the Inputs Time Period Type and Time Period Length.

We begin by computing the Period Volume $$V_P$$ for the period.

$$V_P = \sum_{i=1}^nV_i$$

Then the Volume Weighted Average Price during the length for the given Inputs is denoted as $$VWAP(X,n)$$, and is calculated as follows.

$$VWAP(X,n) = \left(\sum_{i=1}^nX_iV_i\right)/V_P$$

The start of the trading day is determined from the Session Times set in Chart >> Chart Settings. For example, when the Time Period Length and Time Period Type are set to 1 Day, then the calculations will begin at the start of each trading day according to the Session Times and end at the end of the trading day.

The study also supports calculating and displaying Fixed Offet/Standard Deviation band lines, which the calculation is explained further down on this page.

#### Displaying or Hiding Standard Deviation/Fixed Offset Band Lines

Up to 4 Standard Deviation/Fixed Offset lines based upon the Volume Weighted Average Price line can be displayed. To display these standard deviation band lines, follow the steps below.

• Open the Study Settings window for the Volume Weighted Average Price study on the chart. For instructions, refer to Adding/Modifying Chart Studies.
• Select the Subgraphs tab.
• The Standard Deviation/Fixed Offset lines are labeled Top Band 1-4 and Bottom Band 1-4. To make a line visible, set its Draw Style to Dash or another visible Draw Style. To hide it, set its Draw Style to Ignore.

Refer to the description for the Band # Std. Deviation Multiplier/Fixed Offset Input, for information about how these lines are calculated.

#### Differences Between VWAP and Standard Deviation Lines On Different Timeframe Bars

The VWAP is a fairly simple calculation, but is very dependent on the data that it is calculated using. For the highest accuracy and the same values on different timeframe bars, it is necessary to set the Base on Underlying Data Input to Yes, so that the study uses the underlying data that makes up the bars. It is also necessary to have tick by tick data in the chart data file for the highest accuracy. Refer to Tick by Tick Data Configuration.

When you compare VWAPs on different timeframe bars, the values will be exact when using Base on Underlying Data. If Base on Underlying Data is set to No, the values will be different and this is expected.

The Standard Deviation Bands for the Volume Weighted Average Price on different timeframe bars can be different. This is because the Standard Deviation is calculated in part using the chart bar values, and the chart bar values can be significantly different between chart bar timeframes. For example, there is only every fifth value on a 5 minute bar chart versus a 1 minute bar chart.

#### Standard Deviation Band Calculation

The following explanation of the standard deviation band calculation is when the Standard Deviation Band Calculation Method is set to VWAP Variance.

The Variance during one period for the given Inputs is denoted as $$Var(X,n)$$, and is calculated as follows.

$$Var(X,n) =\sum_{i=1}^n\left(X_i-WVAP_i(X,n)\right)^2V_i$$

The Standard Deviation during the period for the given Inputs is denoted as $$SD(X,n)$$, and is calculated as follows.

$$SD(X,n) = \sqrt{Var(X,n)}$$

Next, the Offset during the period for the given Inputs is denoted as $$Off(X,n)$$, and is calculated as follows. $$V_P) is documented above. \(Off(X,n) = \sqrt{Var(X,n)/V_P}$$

The Standard Deviation Bands are computed using a Multiplier $$b$$. Let $$TB_j$$ and $$BB_j$$ be Top Band and Bottom Band number $$j$$, respectively $$(j=1,2,3,4)$$. We compute the Bands for each Period as follows.

$$TB_1 = VWAP + b\cdot Off(X,n)$$
$$BB_1 = VWAP - b\cdot Off(X,n)$$
$$TB_2 = VWAP + 2b\cdot Off(X,n)$$
$$BB_2 = VWAP - 2b\cdot Off(X,n)$$
$$TB_3 = VWAP + 3b\cdot Off(X,n)$$
$$BB_3 = VWAP - 3b\cdot Off(X,n)$$
$$TB_4 = VWAP + 4b\cdot Off(X,n)$$
$$BB_4 = VWAP - 4b\cdot Off(X,n)$$

#### Inputs

• Input Data
• Time Period Type: Sets the type of time period for the calculation. This Input works in conjunction with Time Period Length. For a 1 Day period, set this to Days. The number of Days specified always refers to calendar days and not trading days.
• Time Period Length: Sets the quantity to be used with Time Period Type. For example, for a period of 1 Day, set this to 1 and set Time Period Type to Days.
• Base on Underlying Data: This Input setting only applies to Intraday charts and not to Historical charts.

When this Input is set to No, which is the default, then the price and volume data for the calculations are based on the bars in the chart. The last trade price of the bar is used, which is the default, and the total volume of the chart bar is used.

To base the calculations on the underlying price and volume data which generally is more detailed than the chart bars, set this Input to Yes. When this Input is set to Yes, the chart may be automatically reloaded to load in the more detailed Volume at Price data.

It is recommended when using this setting that since Intraday charts are required, select Chart >> Chart Settings and select Chart Data Type >> Intraday Chart Only to always ensure the chart is set to use Intraday data.
• Start Date-Time: This Input can optionally be set to a starting Date-Time to begin the calculations at for the Volume Weighted Average Price study. It is necessary to specify both the Date and the Time. You cannot just specify the Time only. The Time Period Length and Time Period Type Inputs still apply when using a Start Date-Time.

The Start Date-Time setting does not refer to the starting time of day when the Time Period Length and Time Period Type is set to set to 1 Day.

The purpose of this Input is to reduce the amount of calculations performed within the chart by starting at a particular Date-Time.
• Standard Deviation Band Calculation Method: This can be set to VWAP Variance, Fixed Offset or Standard Deviation. For the formulas for each, refer to Standard Deviation Band Calculation.
• Band # Std. Deviation Multiplier/Fixed Offset: When the standard deviation Top # Band and Bottom # Band Subgraphs are set to be displayed, this Input specifies how far the band lines are from the Volume Weighted Average Price line.

When the Standard Deviation Band Calculation Method Input is set to VWAP Variance or Standard Deviation , then this Input specifies the value multiplied by the VWAP Variance or Standard Deviation. For example, if the Input is set to 2.0, then the band would be offset by 200% of the Standard Deviation.

When the Standard Deviation Band Calculation Method Input is set to Fixed Offset, then this Input becomes a fixed offset and is used to offset the Bands from the Volume Weighted Average Price by the specified amount. Bands 1-4 are offset by the exact amounts.