'**********************************************************************
'*   VFI Moving Average Crossover Stop (VFIMAstop)
'*     by Jeremy Williams
'*	   February 20,2006
'*
'*	Adapted from Technical Analysis of Stocks and Commodities
'*    June 2004 and July 2004
'*
'*  Summary: 
'*
'*      This stop was designed to be used with the VFI Moving
'*  Average crossover system VFIMA. It requires the VFI indicator.
'*  For more information see "Using Money Flow to Stay with the Trend",
'*  and "Volume Flow Indicator Performance" in the June 2004 and 
'*  July 2004 editions of Technical Analysis of Stocks and
'*  Commodities.
'*
'*  Parameters:
'*
'*  Period= Specifies the number of Periods used for VFI calculation
'*
'*  Coef = Specifies the fixed scaling factor for the VFI calculation
'*
'*  VolCoef= Specifies the cutoff for maximum volume in the VFI calculation
'*             
'*  ShortSmoothing= Specifies the number of periods used in the short moving average
'*
'*  LongSmoothing=Specifies the number of periods used in the long moving average 
'*
'******************************************************************** 
#Stop

#Param "Period",130
#Param "Coef", .2
#Param "VolCoef",2.5
#Param "SD_period",30
#Param "ShortSmoothing",3
#param "LongSmoothing",14


Dim ShortVFI As Single
Dim LongVFI As Single

ShortVFI = VFI(Period,Coef,Volcoef,SD_Period,ShortSmoothing)
LongVFI = VFI(Period,Coef,Volcoef,SD_Period,LongSmoothing)

If ShortVFI < LongVFI then 			' If short moving average goes below 
Signal = ExitSignal					' long moving average, generate long
End if								' signal