// Downloaded From https://www.WiseStockTrader.com
//Go Short/Long on Cross over with Stop loss of recent High/Low on 5 Minute Chart
_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorBlack),
ParamColor("BgBottom", colorBlack),ParamColor("titleblock",colorWhite)); 
_SECTION_END();

_SECTION_BEGIN("520 cross");
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot(Close,"Price",colorWhite, styleCandle);
Plot(EMA(Close,5),"5EMA",colorGreen,style=styleThick);
Plot(EMA(Close,20),"20EMA",colorRed,style=styleThick);
Buy=Cross(EMA(Close,5),EMA(Close,20));
Sell=Cross(EMA(Close,20),EMA(Close,5));
Short=Sell;
Cover=Buy;
shape = Buy * shapeSmallUpTriangle + Sell * shapeSmallDownTriangle;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
_SECTION_END();

 
_SECTION_BEGIN("Ribbon");
no=Param( "Swing", 10, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);
 
Plot( 2, "Ribbon",IIf(C>tsl,colorGreen,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();