SU=Study("SU",GetChartID());
RE=Study("RE",GetChartID());
Short=Cross(SU,Close);
Cover=Cross(EMA(Close,20) ,EMA(Close,50));
Buy=Cross(Close,RE);
Sell=Cross(EMA(Close,50),EMA(Close,20));
PlotShapes(Buy*3, colorGreen, 0, L);
PlotShapes(Short*4, colorRed, 0, H);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Plot( EMA( Close,20 ),"EMA20",colorRed,styleLine);
Plot( EMA( Close,50 ),"EMA50",colorBlue,styleLine);
PlotShapes( IIf( Buy, shapeHollowSmallUpTriangle, shapeNone ), colorGreen, 0, BuyPrice );
PlotShapes( IIf( Sell, shapeHollowSmallDownTriangle, shapeNone ), colorRed, 0, SellPrice );
PlotShapes( IIf( Cover, shapeSmallUpTriangle, shapeNone ), colorGreen, 0, CoverPrice );
PlotShapes( IIf( Short, shapeSmallDownTriangle, shapeNone ), colorRed, 0, ShortPrice );