NSE-Sectors Relative Strength

study(“NSE-Sectors Relative Strength”)

//This indicator plots the normal distribution for the 10 sectors of the Nifty for the last X bars of the selected resolution, based on the selected comparative security.

sym = input(title=”Comparative Security”, type=symbol, defval=”SPY”)
res = input(title=”Resolution”, type=resolution, defval=”D”)
a = security(sym, res, close)
i = input(title=”Deviation”, type=integer, defval=200, minval=2, maxval=2000)

XLB1 = security(“CNXPHARMA”,res,close)
XLE1 = security(“CNXEnergy”,res,close)
XLF1 = security(“CNXAuto”,res,close)
XLI1 = security(“CNXMedia”,res,close)
XLK1 = security(“CNXFinance”,res,close)
XLP1 = security(“CNXFMCG”,res,close)
XLU1 = security(“CNXRealty”,res,close)
XLV1 = security(“CNXMETAL”,res,close)
XLY1 = security(“CNXPSUBANK”,res,close)
XTN1 = security(“CNXPSE”,res,close)

XLB2 = XLB1/a
XLE2 = XLE1/a
XLF2 = XLF1/a
XLI2 = XLI1/a
XLK2 = XLK1/a
XLP2 = XLP1/a
XLU2 = XLU1/a
XLV2 = XLV1/a
XLY2 = XLY1/a
XTN2 = XTN1/a

XLB3 = stdev(XLB2,i)
XLE3 = stdev(XLE2,i)
XLF3 = stdev(XLF2,i)
XLI3 = stdev(XLI2,i)
XLK3 = stdev(XLK2,i)
XLP3 = stdev(XLP2,i)
XLU3 = stdev(XLU2,i)
XLV3 = stdev(XLV2,i)
XLY3 = stdev(XLY2,i)
XTN3 = stdev(XTN2,i)

XLB4 = sum(XLB2,i)/i
XLE4 = sum(XLE2,i)/i
XLF4 = sum(XLF2,i)/i
XLI4 = sum(XLI2,i)/i
XLK4 = sum(XLK2,i)/i
XLP4 = sum(XLP2,i)/i
XLU4 = sum(XLU2,i)/i
XLV4 = sum(XLV2,i)/i
XLY4 = sum(XLY2,i)/i
XTN4 = sum(XTN2,i)/i

XLB5 = (XLB2-XLB4)/XLB3
XLE5 = (XLE2-XLE4)/XLE3
XLF5 = (XLF2-XLF4)/XLF3
XLI5 = (XLI2-XLI4)/XLI3
XLK5 = (XLK2-XLK4)/XLK3
XLP5 = (XLP2-XLP4)/XLP3
XLU5 = (XLU2-XLU4)/XLU3
XLV5 = (XLV2-XLV4)/XLV3
XLY5 = (XLY2-XLY4)/XLY3
XTN5 = (XTN2-XTN4)/XTN3

plot(XLB5,title=”CNXPHARMA – XLB”,color=red)
plot(XLE5,title=”CNXEnergy – XLE”,color=blue)
plot(XLF5,title=”CNXAuto – XLF”,color=purple)
plot(XLI5,title=”CNXMedia – XLI”,color=yellow)
plot(XLK5,title=”CNXFinance – XLK”,color=orange)
plot(XLP5,title=”CNXFMCG Staples – XLP”,color=green)
plot(XLU5,title=”CNXRealty – XLU”,color=gray)
plot(XLV5,title=”CNXMETAL Care – XLV”,color=black)
plot(XLY5,title=”CNXPSUBANK Discretionary – XLY”,color=maroon)
plot(XTN5,title=”CNXPSE – XTN”,color=navy)

Leave a Comment

Your email address will not be published. Required fields are marked *