// Downloaded From https://www.WiseStockTrader.com
// EW STUFF

_SECTION_BEGIN("AA Adget XTL");

price1=EMA((H+L)/2,5)-EMA((H+L)/2,17);
k=1;
k2=0.0555;
Lens=5;
upperband=Price1+k2*(k*Price1-price1);
Lowerband=Price1+K2*(K*Price1-price1);
Plot(Price1,"EW Osc",colorLightGrey,styleHistogram);
Plot(IIf(price1>0 AND BarsSince(Price1)>=2 ,upperband,0),"UB",colorRed,styleLine);
Plot(IIf(price1<0 AND BarsSince(Price1)>=2 ,Lowerband,0),"UB",colorGreen,styleLine);
Plot(WMA(Price1,Lens),"",colorOrange,styleLine);

colordots = IIf(WMA(Price1,Lens) > 0,colorGreen,IIf(WMA(Price1,Lens) < 0,colorRed,colorWhite)); 
//Plot(WMA(Price1,Lens),"",colordots,styleThick);

EW = WMA(Price1,Lens);

Buy_EW = Cross(EW,0); 
Sell_EW = Cross(0,EW); 


Buy_EW = ExRem(Buy_EW, sell_EW   );
sell_EW = ExRem(sell_EW , Buy_EW  );

dist = 1.5*ATR(10); 
for( i = 0; i < BarCount; i++ ) 
{ 

HH1 = HHV(H,1);
LL1 = LLV(L,1);

if( Buy_EW[i] ) PlotText( "E@" + C[ i ], i, L[ i ]-dist[i], colorBlack, colorSeaGreen); 
if( sell_EW[i] ) PlotText( "E@" + C[ i ], i, H[ i ]+dist[i], colorWhite, colorDarkRed); 

}

PlotShapes(Buy_EW*shapeHollowUpArrow,colorBrightGreen, 0, Low, Offset =-5);
PlotShapes(sell_EW*shapeHollowDownArrow,colorWhite, 0, High, Offset =-5);
_SECTION_END();