#Indicator
'**************************************************************
'*   Volume Price Confimation/Contradiction (VPC.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 myMA	As Single
Dim myVWMA	As Single
Dim myVPC	AS Single

' Calculate the moving averages
myMA = SMA(Periods)
myVWMA = VWMA(Periods)

' Calculate the indicator
myVPC = myVWMA - myMA

' Plot the indicator
Plot("VPC",myVPC)

' Return the value calculated by the indicator
Return myVPC