// Downloaded From https://www.WiseStockTrader.com
thresh1=Param("buy thresh",75,1,99,1); 
thresh2=Param("sell thresh",75,1,99,1); 
Ticker1 = ParamStr("Symbol1", "~POS30QTR" ); 
Ticker2 = ParamStr("Symbol2", "~NEG30QTR" ); 
flgrng=Param("threshold count",10,1,50,1); 
 
t1=Foreign(Ticker1,"C"); 
t2=Foreign(TIcker2,"C"); 
dif=t1/(t1+t2)*100; 
flgon=Sum(dif>thresh1,flgrng)==flgrng; 
flgoff=Sum(dif<thresh2,flgrng)==flgrng; 
 

Plot(dif,"Diffusion",colorTeal,styleLine|styleThick); 
Plot(thresh1,"",colorGreen); 
Plot(thresh2,"",colorRed); 
 
Plot(flgon*100,"Buy",colorGreen,styleHistogram|styleThick); 
Plot(flgoff*100,"Sell",colorRed,styleHistogram|styleThick);