// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("Narayan_Chouhan");
function PercentR( periods )
{
return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) );
}
WR=PercentR( 50);
M1=MACD(12, 26);
S1=Signal(12,26,9);
SMA=MA(C, 20 );

PlotOHLC(O,H,L,C,"",1,64);
Plot(sma,"",3,1);

bcond1=wr>-80;
bcond2=C>sma;
bcond3=m1>s1;
Buy =(bCond1 AND bCond2 AND bCond3);
scond1 = wr<-20;
scond2=C<sma;
scond3=m1<s1;
Sell =(sCond1 AND sCond2 AND sCond3);
Buy = ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-10);
PlotShapes(Sell*shapeDownArrow,colorRed,0,H,-10);

BuyPrice=ValueWhen(Buy,C,1);
SellPrice=ValueWhen(Sell,C,1);
Cover=Buy;
Short=Sell;
Filter=Buy OR Sell;
AddColumn(IIf(Buy,BuyPrice,Null),"Buy", 1.2,1,colorGreen,50);
AddColumn(IIf(Sell,SellPrice,Null),"Sell " ,1.2,1,colorOrange,50);
_SECTION_END();