Piet.Hein

Sectors Relative Strength Normal Distribution

I wrote this indicator as an attempt to see the Relative Strengths of different sectors in the same scale, but there is also other ways to do that.

This indicator plots the normal distribution for the 10 sectors of the SPY for the last X bars of the selected resolution, based on the selected comparative security. It shows which sectors are outperforming and underperforming the SPY (or any other security) relatively to each other by the given deviation.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
study("Sectors Relative Strength Normal Distribution")

//This indicator plots the normal distribution for the 10 sectors of the SPY 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("XLB",res,close)
XLE1 = security("XLE",res,close)
XLF1 = security("XLF",res,close)
XLI1 = security("XLI",res,close)
XLK1 = security("XLK",res,close)
XLP1 = security("XLP",res,close)
XLU1 = security("XLU",res,close)
XLV1 = security("XLV",res,close)
XLY1 = security("XLY",res,close)
XTN1 = security("XTN",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="Materials - XLB",color=red)
plot(XLE5,title="Energy - XLE",color=blue)
plot(XLF5,title="Financial - XLF",color=purple)
plot(XLI5,title="Industrial - XLI",color=yellow)
plot(XLK5,title="Technology - XLK",color=orange)
plot(XLP5,title="Consumer Staples - XLP",color=green)
plot(XLU5,title="Utilities - XLU",color=gray)
plot(XLV5,title="Healthy Care - XLV",color=black)
plot(XLY5,title="Consumer Discretionary - XLY",color=maroon)
plot(XTN5,title="Transportation - XTN",color=navy)