'************************************************************** '* '* Extreme Value Stop ( Fixed ) '* by Jeremy Williams '* February 10, 2006 '* '* Summary: '* '* This fixed stop sets its stop value at the lowest low ( or highest high) '* over a set number of periods before the order is placed plus a cushion. '* '* Parameters: '* '* Periods: the number of period of lookback '* '* Cushion: the number of ATR's below the lowest low found '* '* ATR_Periods: the number of periods used to calculate the ATR '* '************************************************************** #Stop #Param "Periods",10 #Param "Cushion",1 #Param "ATR_Periods",14 Dim StopValue As Single If signal = longsignal then ' If in Long position ' Caluclate the Stop Value if not set, otherwise ' use the last bar's stop value. If StopValue = 0 then StopValue = LLV(Periods) - Cushion*ATR(ATR_Periods) Else StopValue = StopValue[1] End If PlotPrice ("Stop",StopValue) ' Plot the Stop ' If StopValue is breached, send an exit signal and reset StopValue If L <= StopValue then Signal = ExitSignal StopValue = 0 end if Else If Signal = ShortSignal then ' If in a Short Position ' Calculate the Stop Value if not set, otherwise ' use the last bar's stop value. If StopValue = 0 then StopValue = HHV(periods) + Cushion*ATR(ATR_Periods) Else StopValue = StopValue[1] End If PlotPrice ("Stop",StopValue) ' Plot the Stop ' If StopValue is breached, send an exit signal and reset StopValue If H >= StopValue then Signal = ExitSignal StopValue = 0 End If End If