'**********************************************************************
'*   Adaptive Price Zone System  (APZSystem)
'*     by Jeremy Williams
'*	   August 22, 2006
'*
'*	Adapted from Technical Analysis of Stocks and Commodities
'*    September 2006
'*
'*  Summary: 
'*
'*      This system uses the Adaptive Price Zone Indicator 
'*  to generate long and short signals. It requires both the 
'*  APZUpper and APZLower indicators. The system fires long when
'*  price crosses the lower APZ band, and fires short when price
'*  crosses the upper APZ band. For more information see 
'*  "Trading With An Adaptive Price Zon" in the August 2006  
'*  edition of Technical Analysis of Stocks and Commodities.
'*
'*  Note: The TASC article suggests using this system with the ADX as
'*         a filter. This can be accomplished by adding: 
'*
'*                           ADX(14) < 30
'*
'* 			to both the long and short fields of the Filter Block/
'*
'*
'*  Parameters:
'*
'*  Period = Specifies the number of Periods used in the APZ calculation
'*
'*  BandWidth = Specifies the width of the bands in the APZ calculation
'*
'******************************************************************** 

#System
#Param "Periods",5
#Param "BandWidth",2

Dim myUpper		As Single
Dim myLower		As Single

' Get the Upper and Lower Bands
myUpper = APZUpper(Periods,BandWidth)
myLower = APZLower(Periods,BandWidth)

' If the symbol trades outside the bands, fire appropriate signal
If High > myUpper Then
	Signal = ShortSignal
Else If Low < myLower Then
	Signal = LongSignal
End If