// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("BB Daily Scan Tr-1, Rv-3, Bo-2");
x = MACD();
y = Signal();
hist = x - y;
z = hist < Ref(hist, -1);
s= hist > Ref(hist, -1);


earlyBuy = (Sum(z, 4) == 3)AND (hist > Ref(hist, -1)) ;
earlySell = (Sum(s, 4) == 3)AND  (hist < Ref(hist, -1));
Buy = (Cross(x,y) OR earlyBuy) AND (EMA(Close,20)>EMA(Close,50))  ;
Sell = (Cross(y,x) OR earlySell ) AND (EMA(Close,20)< EMA(Close,50)); 




 color = IIf(hist > Ref(hist, -1), colorLime,  colorOrange);
 Plot(hist, "", color,  styleHistogram|styleThick  );
 PlotShapes(shapeUpArrow * Buy, colorDarkGreen, 0,  z);
 PlotShapes(shapeUpArrow * earlyBuy , colorLime, 0,  z);

 PlotShapes(shapeDownArrow * Sell, colorRed, 0,  s);
 PlotShapes(shapeDownArrow * earlySell , colorOrange, 0,  s);

Sell = BBandTop(Close,15,2)< Close;
Buy = BBandBot(Close,15,2)> Close;


Filter= Buy OR Sell ;


_SECTION_END();