#System
'**************************************************************
'*   TC System(TCSystem.txt)
'*     by Jeremy Williams
'*	   Dec. 5,2006
'*
'*	Adapted from Technical Analysis of Stocks and Commodities
'*     February 2007
'*
'*  Summary: 
'*
'*      This system uses to TC indicator to anticipate the crossover
'*  of two moving averages. It generates signals based on the TC 
'*  indicator crossing the closing price, which usually occurs
'*  one bar before the two moving averages cross. The system will
'*  produce long signals for downward crossovers and short signals for
'*  upside crossovers. For more information see "Anticipating Moving
'*  Average Crossovers" in the February 2007 issue of Technical Analysis 
'*  of Stocks and Commodities.
'*
'*  Parameters:
'*
'*  ShortPeriods -  Specifies the number of periods used for the 
'*					short moving average in the TC calculation.
'*
'*  LongPeriods  -  Specifies the number of periods used for the
'*                  long moving average in the TC calculation.
'*
'************************************************************** 

#Param "ShortPeriods",14
#Param "LongPeriods",21

Dim myTC	As Single 

' Calculate the TC indicator
myTC = TC(ShortPeriods,LongPeriods)

' Produce Signals
If C > myTC And C[1] <= myTC[1] Then
	signal = LongSignal
Else If C < myTC And C[1] >= myTC[1] Then
	signal = ShortSignal
End If

'Plot the indicator and the current close in its own pane
Plot("TC",myTC)
Plot("Close",C)