'************************************************************** '* Adaptive Price Zone Indicator (APZ) '* by Jeremy Williams '* August 22,2006 '* '* Adapted from Technical Analysis of Stocks and Commodities '* September 2006 '* '* Summary: '* '* This indicator plots bands around the double smoothed EMA '* to identify overbought/oversold conditions. The bands are based '* on the average intraday range. For more information see "Trading '* With An Adaptive Price Zone" in the August 2006 edition of '* Technical Analysis of Stocks and Commodities. '* '* Parameters: '* '* Periods= Specifies the number of Periods used for the EMA and '* average range calculations. '* '* BandWidth= Specifies the number of deviations above/below the '* double smoothed EMA used to calculate the Bands '* '************************************************************** #Indicator #Param "Periods",5 #Param "BandWidth",2 Dim myUpper As Single Dim myLower As Single Dim myEMA As Single Dim myDoubleEMA As Single Dim myRange As Single Dim myRangeEMA As Single Dim myRangeDEMA As Single ' Find the EMA and the Double Smoothed EMA myEMA = EMA(Periods) myDoubleEMA = EMA(myEMA,Periods) ' Find the intraday range and average using a Double Smoothed EMA myRange = High - Low myRangeEMA = EMA(myRange,Periods) myRangeDEMA = EMA(myRangeEMA,Periods) ' Caclulate the Bands around the Double Smoothed EMA myUpper = myDoubleEMA + BandWidth*myRangeDEMA myLower = myDoubleEMA - BandWidth*myRangeDEMA ' Plot The Bands and the Centerline PlotPrice("Upper",myUpper) PlotPrice("Lower",myLower) PlotPrice("Centerline",myDoubleEMA) Return myDoubleEMA ' Return the value of the Double Smoothed EMA