#Indicator
'**************************************************************
'*   Volume Weighted Moving Average (VWMA.txt)
'*     by Jeremy Williams
'*	   May. 9, 2007
'*
'*	Adapted from Technical Analysis of Stocks and Commodities
'*     July 2007
'*
'*  Summary: 
'*
'*      This indicator is used in the calculation of the VPCI
'*  indicator. For more information see "Between Price and Volume"
'*  in the July 2007 issue of Technical Analysis of Stocks 
'*  and Commodities.
'*
'*  Parameters:
'*
'*  Periods -  Specifies the number of periods for the 
'*                     moving average calculation 
'*  
'************************************************************** 
#Param "Periods",14

Dim myProduct		As Single
Dim myNumerator		As Single
Dim myDenominator	As Single
Dim myVWMA			As Single

' Calculate the moving averages
MyProduct = C * V
myNumerator = Sum(myProduct, Periods)
myDenominator = Sum(V, Periods)

' Calculate the indicator
myVWMA = myNumerator/myDenominator

'Plot the indicator
PlotPrice("VWMA", myVWMA)

' Return the value calculated by the indicator
Return myVWMA