Kod:
// VanHe1sing
//@version=5
indicator('Z Score Deva-i Dert')
// ─── Z SCORE GRDLER ───────────────────────────────────────────────────────
Length = input(200)
StdDevs = input(2.0)
StdDevs_ = input(3.0)
src = input(close)
// ─── MTF ZAMAN DLMLER ─────────────────────────────────────────────────────
GRP_ZMN = "MTF Zaman Dilimleri"
PerI = input.timeframe(title='En Kk Periyot', defval="240", group=GRP_ZMN)
PerK = input.timeframe(title='Kk Periyot', defval="D", group=GRP_ZMN)
PerO = input.timeframe(title='Orta Periyot', defval="W", group=GRP_ZMN)
PerB = input.timeframe(title='Byk Periyot', defval="M", group=GRP_ZMN)
// ─── Z SCORE HESABI ──────────────────────────────────────────────────────────
basis = ta.sma(src, Length)
zscore = (src - basis) / ta.stdev(src, Length)
// ─── Z SCORE ZMLER ───────────────────────────────────────────────────────
hline(StdDevs, color=color.rgb(255, 0, 0), linestyle=hline.style_dotted, linewidth=2)
hline(-1*StdDevs, color=color.rgb(2, 255, 57), linestyle=hline.style_dotted, linewidth=2)
hline(StdDevs_, color=color.rgb(250, 101, 101), linestyle=hline.style_dotted, linewidth=2)
hline(-1*StdDevs_, color=color.rgb(0, 110, 255), linestyle=hline.style_dotted, linewidth=2)
hline(0, color=color.rgb(255, 255, 255), linestyle=hline.style_dotted, linewidth=2)
plot(zscore, color=color.new(#55FF55, 0))
barcolor(zscore > 0
? color.from_gradient(zscore, 0, 2.8, color.orange, color.red)
: color.from_gradient(zscore, -2.0, 0, color.aqua, color.yellow))
// ════════════════════════════════════════════════════════════════════════════════
// MTF VER FONKSYONLARI
// ════════════════════════════════════════════════════════════════════════════════
// Ichimoku tepe/dip + SMA paketi
f_data_pack() =>
h9 = ta.highest(9), l9 = ta.lowest(9)
h26 = ta.highest(26), l26 = ta.lowest(26)
h52 = ta.highest(52), l52 = ta.lowest(52)
tk = (h9 + l9) / 2
kj = (h26 + l26) / 2
ssa = (tk[25] + kj[25]) / 2
ssb = (h52[25] + l52[25]) / 2
ichi_tepe = math.max(tk, kj, ssa, ssb)
ichi_dip = math.min(tk, kj, ssa, ssb)
sma20 = ta.sma(close, 20)
sma50 = ta.sma(close, 50)
sma100 = ta.sma(close, 100)
sma200 = ta.sma(close, 200)
sma500 = ta.sma(close, 500)
[ichi_tepe, ichi_dip, sma20, sma50, sma100, sma200, sma500]
// Pivot paketi
f_get_full_pivots() =>
H = high[1], L = low[1], C = close[1]
P = (H + L + C) / 3
R1 = 2*P - L, S1 = 2*P - H
R2 = P + (H - L), S2 = P - (H - L)
R3 = H + 2*(P - L), S3 = L - 2*(H - P)
R4 = R3 + (R2 - R1), S4 = S3 - (S2 - S1)
R5 = R4 + (R2 - R1), S5 = S4 - (S2 - S1)
[P, R1, R2, R3, R4, R5, S1, S2, S3, S4, S5]
// ─── MTF VER EKME ──────────────────────────────────────────────────────────
[tepeI, dipI, ma20I, ma50I, ma100I, ma200I, ma500I] = request.security(syminfo.tickerid, PerI, f_data_pack())
[tepeD, dipD, ma20D, ma50D, ma100D, ma200D, ma500D] = request.security(syminfo.tickerid, PerK, f_data_pack())
[tepeW, dipW, ma20W, ma50W, ma100W, ma200W, ma500W] = request.security(syminfo.tickerid, PerO, f_data_pack())
[tepeM, dipM, ma20M, ma50M, ma100M, ma200M, ma500M] = request.security(syminfo.tickerid, PerB, f_data_pack())
[pW, r1W, r2W, r3W, r4W, r5W, s1W, s2W, s3W, s4W, s5W] = request.security(syminfo.tickerid, "W", f_get_full_pivots(), lookahead=barmerge.lookahead_on)
[pM, r1M, r2M, r3M, r4M, r5M, s1M, s2M, s3M, s4M, s5M] = request.security(syminfo.tickerid, "M", f_get_full_pivots(), lookahead=barmerge.lookahead_on)
[p3M, r1_3M,r2_3M,r3_3M,r4_3M,r5_3M,s1_3M,s2_3M,s3_3M,s4_3M,s5_3M] = request.security(syminfo.tickerid, "3M", f_get_full_pivots(), lookahead=barmerge.lookahead_on)
[p1Y, r1Y, r2Y, r3Y, r4Y, r5Y, s1Y, s2Y, s3Y, s4Y, s5Y] = request.security(syminfo.tickerid, "12M", f_get_full_pivots(), lookahead=barmerge.lookahead_on)
// ════════════════════════════════════════════════════════════════════════════════
// YARDIMCI FONKSYONLAR
// ════════════════════════════════════════════════════════════════════════════════
f_sc(v) => na(v) ? "Yok" : (close > v ? "Bullish" : "Bearish")
f_cl(v) => na(v) ? color.gray : (close > v ? color.green : color.red)
f_pvt_pos(c, p, r1, r2, r3, r4, r5, s1, s2, s3, s4, s5) =>
c > r5 ? "R5 st" :
c > r4 ? "R4-R5" :
c > r3 ? "R3-R4" :
c > r2 ? "R2-R3" :
c > r1 ? "R1-R2" :
c > p ? "P-R1" :
c > s1 ? "S1-P" :
c > s2 ? "S2-S1" :
c > s3 ? "S3-S2" :
c > s4 ? "S4-S3" :
c > s5 ? "S5-S4" : "S5 Alt"
// ════════════════════════════════════════════════════════════════════════════════
// TABLOLAR
// ════════════════════════════════════════════════════════════════════════════════
var table trendPanel = table.new(position.middle_left, 7, 5,
bgcolor=color.new(color.black, 80), border_color=color.gray, border_width=1)
var table pivotPanel = table.new(position.middle_right, 3, 5,
bgcolor=color.new(color.black, 80), border_color=color.gray, border_width=1)
if barstate.islast
// ── TREND TABLOSU BALIK ─────────────────────────────────────────────────
table.cell(trendPanel, 0, 0, "PERYOT", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 1, 0, "ICHIMOKU", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 2, 0, "SMA 20", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 3, 0, "SMA 50", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 4, 0, "SMA 100", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 5, 0, "SMA 200", text_color=color.yellow, text_size=size.small)
table.cell(trendPanel, 6, 0, "SMA 500", text_color=color.yellow, text_size=size.small)
// ── 240 / Gnlk / Haftalk / Aylk ─────────────────────────────────────
for i = 1 to 4
curr_label = i==1 ? "240" : i==2 ? "Gnlk" : i==3 ? "Haftalk" : "Aylk"
curr_col = i==1 ? #ff00ea : i==2 ? color.green : i==3 ? color.orange : color.blue
tepe_ = i==1 ? tepeI : i==2 ? tepeD : i==3 ? tepeW : tepeM
dip_ = i==1 ? dipI : i==2 ? dipD : i==3 ? dipW : dipM
curr_ichi = close > tepe_ ? "Bullish" : (close < dip_ ? "Bearish" : "YATAY")
curr_bg = close > tepe_ ? color.green : (close < dip_ ? color.red : color.orange)
m20 = i==1 ? ma20I : i==2 ? ma20D : i==3 ? ma20W : ma20M
m50 = i==1 ? ma50I : i==2 ? ma50D : i==3 ? ma50W : ma50M
m100 = i==1 ? ma100I : i==2 ? ma100D : i==3 ? ma100W : ma100M
m200 = i==1 ? ma200I : i==2 ? ma200D : i==3 ? ma200W : ma200M
m500 = i==1 ? ma500I : i==2 ? ma500D : i==3 ? ma500W : ma500M
table.cell(trendPanel, 0, i, curr_label, text_color=curr_col, text_size=size.small, text_halign=text.align_left)
table.cell(trendPanel, 1, i, curr_ichi, bgcolor=curr_bg, text_color=color.white, text_size=size.small)
table.cell(trendPanel, 2, i, f_sc(m20), bgcolor=f_cl(m20), text_color=color.white, text_size=size.small)
table.cell(trendPanel, 3, i, f_sc(m50), bgcolor=f_cl(m50), text_color=color.white, text_size=size.small)
table.cell(trendPanel, 4, i, f_sc(m100), bgcolor=f_cl(m100), text_color=color.white, text_size=size.small)
table.cell(trendPanel, 5, i, f_sc(m200), bgcolor=f_cl(m200), text_color=color.white, text_size=size.small)
table.cell(trendPanel, 6, i, f_sc(m500), bgcolor=f_cl(m500), text_color=color.white, text_size=size.small)
// ── PVOT TABLOSU BALIK ─────────────────────────────────────────────────
table.cell(pivotPanel, 0, 0, "PERYOT", text_color=color.yellow, text_size=size.small)
table.cell(pivotPanel, 1, 0, "PVOT DURUM", text_color=color.yellow, text_size=size.small)
table.cell(pivotPanel, 2, 0, "MEVCUT ARALIK", text_color=color.yellow, text_size=size.small)
// Haftalk
table.cell(pivotPanel, 0, 1, "Haftalk", text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 1, 1, f_sc(pW), bgcolor=f_cl(pW), text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 2, 1, f_pvt_pos(close, pW, r1W, r2W, r3W, r4W, r5W, s1W, s2W, s3W, s4W, s5W), bgcolor=f_cl(pW), text_color=color.white, text_size=size.small)
// Aylk
table.cell(pivotPanel, 0, 2, "Aylk", text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 1, 2, f_sc(pM), bgcolor=f_cl(pM), text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 2, 2, f_pvt_pos(close, pM, r1M, r2M, r3M, r4M, r5M, s1M, s2M, s3M, s4M, s5M), bgcolor=f_cl(pM), text_color=color.white, text_size=size.small)
// 3 Aylk
table.cell(pivotPanel, 0, 3, "3 Aylk", text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 1, 3, f_sc(p3M), bgcolor=f_cl(p3M), text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 2, 3, f_pvt_pos(close, p3M, r1_3M, r2_3M, r3_3M, r4_3M, r5_3M, s1_3M, s2_3M, s3_3M, s4_3M, s5_3M), bgcolor=f_cl(p3M), text_color=color.white, text_size=size.small)
// Yllk
table.cell(pivotPanel, 0, 4, "Yllk", text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 1, 4, f_sc(p1Y), bgcolor=f_cl(p1Y), text_color=color.white, text_size=size.small)
table.cell(pivotPanel, 2, 4, f_pvt_pos(close, p1Y, r1Y, r2Y, r3Y, r4Y, r5Y, s1Y, s2Y, s3Y, s4Y, s5Y), bgcolor=f_cl(p1Y), text_color=color.white, text_size=size.small)
Yer mleri