For anyone who might find this useful...
//Relative Strength % comparison
//to respective Index
//USING YAHOO DATABASE
SetChartOptions
(0,chartShowDates);
//Relative Strength period of comparison
period = Param("Periods",21,10,252,1);
//Base Market
BaseMkt=WriteIf(MarketID(1)=="NYSE","^DJI",WriteIf(MarketID(1)=="Nasdaq","^NDX",WriteIf(MarketID(1)=="AMEX","^XAX",""))); //Base market....
//Relative strength calculation
x = Foreign(BaseMkt,"C") - Ref(Foreign(BaseMkt,"C"),-period);
x = (x / Ref(Foreign(BaseMkt,"C"),-period)) * 100;
y = C - Ref(C,-period);
y = ( y / Ref(C,-period)) * 100;
rs = y - x;
//line color
Color=colorBlue;
//Plot Relative strength line
Plot(rs,"",color,styleLine);
//Header
Title=EncodeColor(colorBlack)+"("+WriteVal(period,1)+") Day.."
+"Relative_Strength of ."+EncodeColor(Color)+FullName()+
EncodeColor
(colorBlack)+".as compared
to "+EncodeColor(color)
+ baseMkt +EncodeColor(colorBlack)+" =
"+WriteVal(rs,1.2)+"\n"+"\n"+
FullName
()+"\n"+"\n"+" MARKET = "+MarketID(1)+"\n"+" SECTOR = "+SectorID(1)+"\n"+
" INDUSTRY = "
+IndustryID(1);
//Exploration
//Note: you can change the relative strength setting using the Parameter
button in AA window...
Filter = rs >= Param("Relative_strength",0,-1000,1000,1) AND V >= 100000 ;
AddColumn(rs,"RS_%",1.2);
AddTextColumn(MarketID(1),"Market");
AddColumn(C,"close",1.2);
AddColumn(V,"Volume",1);