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.
Usuń z Ulubionych Skryptów Dodaj do Ulubionych Skryptów
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) 

Komentarze

GREAT WORK
Odpowiedź
Thank you!
Odpowiedź
Great idea, thanks for this!
Odpowiedź
oh to be young and learn how to program ,
you did a nice visual there
+1
Odpowiedź
Cool one.
Odpowiedź
Piet.Hein IvanLabrie
:)
Odpowiedź
Strona główna Skaner akcji Skaner Forex Skaner Krypto Kalendarz ekonomiczny Jak to działa Funkcje wykresów Cena Poleć przyjaciela Dobre Praktyki Centrum Pomocy Rozwiązania internetowe i brokerskie Widżety Wykresy Lekka Biblioteka Wykresów Blog i wiadomości Twitter
Profil Ustawienia profilu Konto i płatności Poleć przyjaciela Wiadomości do działu obsługi Centrum Pomocy Opublikowane Pomysły Obserwujący Lista obserwowanych Wiadomość prywatna Czat Wyloguj