// Downloaded From https://www.WiseStockTrader.com
CTS=IIf(C>=Ref(C,-5),1,-1)+
 IIf(C>=Ref(C,-6),1,-1)+
 IIf(C>=Ref(C,-7),1,-1)+
 IIf(C>=Ref(C,-8),1,-1)+
 IIf(C>=Ref(C,-9),1,-1)+
 IIf(C>=Ref(C,-10),1,-1)+
 IIf(C>=Ref(C,-11),1,-1)+
 IIf(C>=Ref(C,-12),1,-1)+
 IIf(C>=Ref(C,-13),1,-1)+
 IIf(C>=Ref(C,-14),1,-1);



 Plot(CTS, "CTS", colorBlack, styleLine ); 

 Plot(12,"",colorRed,styleLine);
 Plot(0,"",colorBlue,styleLine);
 Plot(-12,"",colorRed,styleLine);

 EntryLong = CTS>=5 AND Ref(CTS,-1)<5;
 ExitLong = CTS<0;

 Buy = EntryLong;
 Sell = ExitLong;

 PlotShapes(IIf(Buy ==1, shapeUpArrow , shapeNone), colorGreen, 0,CTS, Offset=-15);
 PlotShapes(IIf(Sell ==1, shapeDownArrow, shapeNone), colorRed, 0,CTS, Offset=-15);