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.
從常用腳本中移除 新增至常用腳本
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) 

評論

GREAT WORK
回覆
Thank you!
回覆
Great idea, thanks for this!
回覆
oh to be young and learn how to program ,
you did a nice visual there
+1
回覆
Cool one.
回覆
Piet.Hein IvanLabrie
:)
回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 如何運作 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特
概覽 個人資料設定 賬戶和賬單 推薦朋友 代幣 我的客服工單 幫助中心 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出