{ Downloaded From https://www.WiseStockTrader.com }
Dy:=Input("Day of Trend",1,31,19);
Mn:=Input("Month of Trend",1,12,12);
Yr:=Input("Year of Trend",2000,2500,2003);

Value1:=Input("Bearish Periods",3,55,21);
Value2:=Input("Multiplication Factor",1,10,3.2);
Value3:=Input("Initial Stop",0,100000,10);

Value4:= 34;{Channel Periods}
Value5:= 75;{OverBought Region}

HoldingDays:= BarsSince(Dy=DayOfMonth()
AND Mn=Month() AND Yr=Year());

Index:=RSI(CLOSE,Value4);
OB:=Index -Value5;
Bullish:= CLOSE-(CLOSE*(OB/100));

Bearish:=(Sum(Abs(LOW-Ref(LOW,-1)),Value1))/Value1;
RangeA:=(Sum(CLOSE-LOW,Value1))/Value1;
Stop:=CLOSE-((Bearish+RangeA)*Value2);

If(Stop>PREV AND Stop>Value3,Stop,If(Stop>PREV
AND Stop < Value3,Value3,If(Stop<=PREV,PREV,Stop
*Holdingdays)));

Bullish