Kod:
//@version=5
indicator(title = "Pivot MTF Analysis", overlay = true)
// --- GÝRDÝLER ---
GRP_ZMN = "Zaman Dilimleri"
PerK = input.timeframe(title='Küçük Periyot', defval="D", group=GRP_ZMN)
PerO = input.timeframe(title='Orta Periyot', defval="W", group=GRP_ZMN)
PerB = input.timeframe(title='Büyük Periyot', defval="M", group=GRP_ZMN)
// --- FONKSÝYONLAR ---
f_data_pack(include_tk) =>
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 = include_tk ? math.max(tk, kj, ssa, ssb) : math.max(kj, ssa, ssb)
ichi_dip = include_tk ? math.min(tk, kj, ssa, ssb) : math.min(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)
has_ichi = not na(ssb)
[ichi_tepe, ichi_dip, has_ichi, sma20, sma50, sma100, sma200, sma500]
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]
// --- VERÝ ÇEKME ---
[tepeD, dipD, hasID, ma20D, ma50D, ma100D, ma200D, ma500D] = request.security(syminfo.tickerid, PerK, f_data_pack(false))
[tepeW, dipW, hasIW, ma20W, ma50W, ma100W, ma200W, ma500W] = request.security(syminfo.tickerid, PerO, f_data_pack(true))
[tepeM, dipM, hasIM, ma20M, ma50M, ma100M, ma200M, ma500M] = request.security(syminfo.tickerid, PerB, f_data_pack(true))
[pD, r1D, r2D, r3D, r4D, r5D, s1D, s2D, s3D, s4D, s5D] = request.security(syminfo.tickerid, "D", f_get_full_pivots(), lookahead=barmerge.lookahead_on)
[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)
// --- PÝVOT ÇÝZÝMLERÝ (YENÝ GÖRSEL ODAK) ---
plot(pD, title="Günlük Pivot", color=color.new(#3cff00, 0), linewidth=1, style=plot.style_stepline)
plot(pW, title="Haftalýk Pivot", color=color.new(color.orange, 0), linewidth=1, style=plot.style_stepline)
plot(pM, title="Aylýk Pivot", color=color.new(color.blue, 0), linewidth=1, style=plot.style_stepline)
plot(p3M, title="3 Aylýk Pivot", color=color.new(#ff00d4, 0), linewidth=1, style=plot.style_stepline)
plot(p1Y, title="Yýllýk Pivot", color=color.new(color.yellow, 0), linewidth=1, style=plot.style_stepline)
// --- ANALÝZ YARDIMCILARI ---
f_sc(v) => na(v) ? "Yok" : (close > v ? "BOÐA" : "AYI")
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 (KORUNDU) ---
var table trendPanel = table.new(position.middle_left, 7, 4, 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 (Veriler Ichimoku Kodundaki Gibi Akar)
table.cell(trendPanel, 0, 0, "PERÝYOT", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 1, 0, "ICHIMOKU", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 2, 0, "SMA 20", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 3, 0, "SMA 50", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 4, 0, "SMA 100", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 5, 0, "SMA 200", text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 6, 0, "SMA 500", text_color=color.white, text_size=size.tiny)
// Günlük, Haftalýk, Aylýk Satýrlarý
for i = 1 to 3
curr_label = i==1 ? "Günlük" : i==2 ? "Haftalýk" : "Aylýk"
curr_col = i==1 ? color.green : i==2 ? color.orange : color.blue
curr_ichi = i==1 ? (close > tepeD ? "BOÐA" : (close < dipD ? "AYI" : "YATAY")) : i==2 ? (close > tepeW ? "BOÐA" : (close < dipW ? "AYI" : "YATAY")) : (close > tepeM ? "BOÐA" : (close < dipM ? "AYI" : "YATAY"))
curr_bg = i==1 ? (close > tepeD ? color.green : (close < dipD ? color.red : color.orange)) : i==2 ? (close > tepeW ? color.green : (close < dipW ? color.red : color.orange)) : (close > tepeM ? color.green : (close < dipM ? color.red : color.orange))
table.cell(trendPanel, 0, i, curr_label, text_color=curr_col, text_size=size.tiny, text_halign=text.align_left)
table.cell(trendPanel, 1, i, curr_ichi, bgcolor=curr_bg, text_color=color.white, text_size=size.tiny)
// SMA'lar (Dinamik Seçim)
m20 = i==1 ? ma20D : i==2 ? ma20W : ma20M
m50 = i==1 ? ma50D : i==2 ? ma50W : ma50M
m100 = i==1 ? ma100D : i==2 ? ma100W : ma100M
m200 = i==1 ? ma200D : i==2 ? ma200W : ma200M
m500 = i==1 ? ma500D : i==2 ? ma500W : ma500M
table.cell(trendPanel, 2, i, f_sc(m20), bgcolor=f_cl(m20), text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 3, i, f_sc(m50), bgcolor=f_cl(m50), text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 4, i, f_sc(m100), bgcolor=f_cl(m100), text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 5, i, f_sc(m200), bgcolor=f_cl(m200), text_color=color.white, text_size=size.tiny)
table.cell(trendPanel, 6, i, f_sc(m500), bgcolor=f_cl(m500), text_color=color.white, text_size=size.tiny)
// PIVOT TABLOSU DOLUMU
table.cell(pivotPanel, 0, 0, "PERÝYOT", text_color=color.yellow, text_size=size.tiny)
table.cell(pivotPanel, 1, 0, "PÝVOT DURUM", text_color=color.yellow, text_size=size.tiny)
table.cell(pivotPanel, 2, 0, "MEVCUT ARALIK", text_color=color.yellow, text_size=size.tiny)
// Haftalýk, Aylýk, 3 Aylýk, Yýllýk Satýrlarý
table.cell(pivotPanel, 0, 1, "Haftalýk", text_color=color.white, text_size=size.tiny)
table.cell(pivotPanel, 1, 1, f_sc(pW), bgcolor=f_cl(pW), text_color=color.white, text_size=size.tiny)
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.tiny)
table.cell(pivotPanel, 0, 2, "Aylýk", text_color=color.white, text_size=size.tiny)
table.cell(pivotPanel, 1, 2, f_sc(pM), bgcolor=f_cl(pM), text_color=color.white, text_size=size.tiny)
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.tiny)
table.cell(pivotPanel, 0, 3, "3 Aylýk", text_color=color.white, text_size=size.tiny)
table.cell(pivotPanel, 1, 3, f_sc(p3M), bgcolor=f_cl(p3M), text_color=color.white, text_size=size.tiny)
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.tiny)
table.cell(pivotPanel, 0, 4, "Yýllýk", text_color=color.white, text_size=size.tiny)
table.cell(pivotPanel, 1, 4, f_sc(p1Y), bgcolor=f_cl(p1Y), text_color=color.white, text_size=size.tiny)
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.tiny)
plotcandle(open, high, low, close, 'fiyat', color = close < open ? color.red : color.green, bordercolor = close < open ? color.red : color.green)
Yer Ýmleri