PHP Code:
//@version=6
indicator("SON YRK - KOMUTA MERKEZ (v1.0 Gold)", overlay=true, max_lines_count=500, max_bars_back=500)
// ==========================================
// KULLANICI SEM MENS
// ==========================================
string secim = input.string("SSTEM 1: L SAR", "AKTF SSTEM SE", options=["SSTEM 1: L SAR", "SSTEM 2: DL+KAPASTE+DNG", "SSTEM 3: SAR AYNA (KANAL)", "SSTEM 4: SAR PVOT (DESTEK/DREN)", "SSTEM 5: TETK (SIKIMA)", "SSTEM 6: GENEL BAKI (ZET)"])
// ==========================================
// 1. MOTOR: 3'L SAR (SABT OMURGA)
// ==========================================
// --- SAR 1: HIZLI ---
float sar_1 = ta.sar(0.02, 0.02, 0.2)
bool al_1 = close > sar_1
// --- SAR 2: ORTA ---
float sar_2 = ta.sar(0.015, 0.015, 0.15)
bool al_2 = close > sar_2
// --- SAR 3: YAVA ---
float sar_3 = ta.sar(0.01, 0.01, 0.1)
bool al_3 = close > sar_3
// Durum Analizi
string durum_sar = "NTR"
color durum_renk = color.gray
if al_1 and al_2 and al_3
durum_sar := "AL"
durum_renk := color.lime
else if not al_1 and not al_2 and not al_3
durum_sar := "SAT"
durum_renk := color.red
else
durum_sar := "NTR"
durum_renk := color.silver
float fark_12 = math.abs(sar_1 - sar_2) / close
float fark_23 = math.abs(sar_2 - sar_3) / close
if (fark_12 < 0.002) and (fark_23 < 0.002)
durum_sar := "DKKAT"
durum_renk := color.yellow
string sabit_detay = (al_1 ? "1:AL" : "1:SAT") + " | " + (al_2 ? "2:AL" : "2:SAT") + " | " + (al_3 ? "3:AL" : "3:SAT")
// ==========================================
// 2. MOTOR: SSTEM 2 (DL + KAPASTE)
// ==========================================
float dongu_1 = ta.sar(0.002, 0.002, 0.2)
float dongu_2 = ta.sar(0.0015, 0.0015, 0.15)
float dongu_3 = ta.sar(0.001, 0.001, 0.1)
tanh(v) => (1 - math.exp(-2 * v)) / (1 + math.exp(-2 * v))
td(s) => nz((s - nz(s[1])) / nz(s[1]))
var w_c = array.from(22.4271, -26.6917, 4.9371, 9.0349, -10.6929, -38.2880, 10.0500, -44.7063, -17.8163, 30.5662, -33.9954, 14.5017, -43.2865, -13.3874, 24.7080, -14.3929, 28.4830, -22.9793, -7.6582, -5.6505, 28.8379, -26.3544, 0.5206, 25.0049, -17.8832, -4.8113, -4.0364, -8.3327, -1.1571, 0.4667, -22.0533, 3.6525, -4.3904, 2.1030, 20.0272, 11.5101, -0.4150)
n_in = array.from(tanh(td(open)), tanh(td(high)), tanh(td(low)), tanh(td(close)))
f_calc_dl(n_arr, w_arr) =>
float out = 0.0
for i = 0 to 5
float s = 0.0
for j = 0 to 3
s += array.get(n_arr, j) * array.get(w_arr, (i * 5) + j)
out += tanh(s + array.get(w_arr, (i * 5) + 4)) * array.get(w_arr, 30 + i)
tanh(out + array.get(w_arr, 36))
float dl_val = f_calc_dl(n_in, w_c)
float volatilite = ta.atr(14)
float sapma = volatilite * (1 + math.abs(dl_val))
float dl_direnc = close + (sapma * 0.5)
float dl_destek = close - (sapma * 0.5)
float mtk_p = ta.sar(0.02, 0.02, 0.2)
float tork = ta.sma(math.abs(mtk_p - nz(mtk_p[1])), 100) * 10
float cap_ust = close > mtk_p ? mtk_p + tork : mtk_p
float cap_alt = close > mtk_p ? mtk_p : mtk_p - tork
float bar_cap_top = close > mtk_p ? cap_ust : cap_alt
float bar_cap_bot = close > mtk_p ? cap_alt : cap_ust
bool temas_1 = (bar_cap_top >= dongu_1) and (bar_cap_bot <= dongu_1)
bool temas_2 = (bar_cap_top >= dongu_2) and (bar_cap_bot <= dongu_2)
bool temas_3 = (bar_cap_top >= dongu_3) and (bar_cap_bot <= dongu_3)
bool temas_var = temas_1 or temas_2 or temas_3
// ==========================================
// 3. MOTOR: SSTEM 3 (SAR AYNA)
// ==========================================
f_sar_mirror(_start, _inc, _max, _smooth) =>
float _sar = ta.sar(_start, _inc, _max)
float _delta = math.abs(close - _sar)
bool _is_up = close > _sar
float _raw_mirror = _is_up ? close + _delta : close - _delta
float _tavan = ta.wma(_raw_mirror, _smooth)
[_sar, _tavan]
[s3_sar1, s3_tavan1] = f_sar_mirror(0.02, 0.02, 0.2, 7)
[s3_sar2, s3_tavan2] = f_sar_mirror(0.015, 0.015, 0.15, 14)
[s3_sar3, s3_tavan3] = f_sar_mirror(0.01, 0.01, 0.1, 21)
// ==========================================
// 4. MOTOR: SSTEM 4 (SAR PVOT - SNIPER)
// ==========================================
var float pivot_seviye = na
var color pivot_renk = color.gray
var float takip_high = high
var float takip_low = low
bool pivot_degisim = al_3 != al_3[1]
if pivot_degisim
if al_3
pivot_seviye := takip_low
pivot_renk := color.lime
takip_high := high
else
pivot_seviye := takip_high
pivot_renk := color.red
takip_low := low
else
if al_3
takip_high := math.max(takip_high, high)
else
takip_low := math.min(takip_low, low)
// ==========================================
// 5. MOTOR: SSTEM 5 (TETK / SIKIMA)
// ==========================================
float en_buyuk_sar = math.max(sar_1, math.max(sar_2, sar_3))
float en_kucuk_sar = math.min(sar_1, math.min(sar_2, sar_3))
float sar_farki = (en_buyuk_sar - en_kucuk_sar) / close
bool sikisma_var = sar_farki < 0.005
string tetik_yon = "YOK"
if sikisma_var
if close > en_buyuk_sar
tetik_yon := "YUKARI (AL)"
else if close < en_kucuk_sar
tetik_yon := "AAI (SAT)"
// ==========================================
// 6. MOTOR: ALARM SSTEM (BEK)
// ==========================================
// Bu ksm grafik zerine izim yapmaz, sadece tetiklendiinde uyar gnderir.
// Alarm 1: Ana Trend Dn (Sistem 1)
alertcondition(al_3 != al_3[1], title="ANA TREND DN", message="DKKAT: Ana Trend Yn Deitirdi!")
// Alarm 2: Pivot Krlm (Sistem 4)
bool pivot_kirilim = ta.crossover(close, pivot_seviye) or ta.crossunder(close, pivot_seviye)
alertcondition(pivot_kirilim, title="PVOT KIRILIMI", message="UYARI: Destek/Diren Krld!")
// Alarm 3: Tetikleme (Sistem 5)
alertcondition(sikisma_var, title="SIKIMA UYARISI", message="TETK: Fiyat Skyor, Patlama Yakn!")
// ==========================================
// GRSELLETRME
// ==========================================
// Sistem 6 (GENEL BAKI) seiliyse grafii tamamen temiz tut.
// --- SABT OMURGA ---
bool goster_omurga = (secim != "SSTEM 6: GENEL BAKI (ZET)")
plot(goster_omurga ? sar_1 : na, "SAR 1", color=color.yellow, style=plot.style_circles, linewidth=2)
plot(goster_omurga ? sar_2 : na, "SAR 2", color=color.blue, style=plot.style_circles, linewidth=2)
plot(goster_omurga ? sar_3 : na, "SAR 3", color=color.red, style=plot.style_circles, linewidth=2)
// --- SSTEM 2 ---
bool goster_s2 = (secim == "SSTEM 2: DL+KAPASTE+DNG")
plotcandle(goster_s2 ? dl_destek : na, goster_s2 ? dl_direnc : na, goster_s2 ? dl_destek : na, goster_s2 ? dl_direnc : na, title="DL Atmosfer", color=color.new(color.silver, 40), bordercolor=na, wickcolor=na)
plotcandle(goster_s2 ? bar_cap_bot : na, goster_s2 ? bar_cap_top : na, goster_s2 ? bar_cap_bot : na, goster_s2 ? bar_cap_top : na, title="SAR ekirdek", color=color.new(color.white, 70), bordercolor=na, wickcolor=na)
plot(goster_s2 ? dongu_1 : na, "Dng 1", color=color.yellow, style=plot.style_cross, linewidth=1)
plot(goster_s2 ? dongu_2 : na, "Dng 2", color=color.blue, style=plot.style_cross, linewidth=1)
plot(goster_s2 ? dongu_3 : na, "Dng 3", color=color.red, style=plot.style_cross, linewidth=1)
// --- SSTEM 3 ---
bool goster_s3 = (secim == "SSTEM 3: SAR AYNA (KANAL)")
plot(goster_s3 ? s3_tavan1 : na, "Tavan 1", color=color.yellow, linewidth=1, style=plot.style_line)
plot(goster_s3 ? s3_tavan2 : na, "Tavan 2", color=color.blue, linewidth=1, style=plot.style_line)
plot(goster_s3 ? s3_tavan3 : na, "Tavan 3", color=color.red, linewidth=1, style=plot.style_line)
// --- SSTEM 4 (SAR PVOT) ---
bool goster_s4 = (secim == "SSTEM 4: SAR PVOT (DESTEK/DREN)")
plot(goster_s4 ? pivot_seviye : na, "Pivot Hatt", color=pivot_renk, linewidth=2, style=plot.style_linebr)
// --- SSTEM 5 (TETK) ---
bool goster_s5 = (secim == "SSTEM 5: TETK (SIKIMA)")
plotshape(goster_s5 and sikisma_var and close > en_buyuk_sar, "AL Tetik", shape.labelup, location.belowbar, color.lime, text="TETK", textcolor=color.white)
plotshape(goster_s5 and sikisma_var and close < en_kucuk_sar, "SAT Tetik", shape.labeldown, location.abovebar, color.red, text="TETK", textcolor=color.white)
// ==========================================
// WIDGET PANEL (GENEL BAKI MODU DAHL)
// ==========================================
var table panel = table.new(position.top_right, 2, 8, bgcolor=color.new(color.black, 50), border_width=1)
if barstate.islast
// --- SABT KISIM ---
table.cell(panel, 0, 0, "DURUM", text_color=color.white, text_size=size.small)
table.cell(panel, 1, 0, durum_sar, text_color=durum_renk, text_size=size.small, bgcolor=color.new(durum_renk, 85))
table.cell(panel, 0, 1, "SNYALLER", text_color=color.gray, text_size=size.small)
table.cell(panel, 1, 1, sabit_detay, text_color=color.silver, text_size=size.small)
table.cell(panel, 0, 2, "----------------", text_color=color.gray)
table.cell(panel, 1, 2, "----------------", text_color=color.gray)
// --- DEKEN KISIM ---
if secim == "SSTEM 1: L SAR"
table.cell(panel, 0, 3, "MOD", text_color=color.white)
table.cell(panel, 1, 3, "SADE ZLEME", text_color=color.yellow)
table.cell(panel, 0, 4, "", bgcolor=color.black)
table.cell(panel, 1, 4, "", bgcolor=color.black)
table.cell(panel, 0, 5, "", bgcolor=color.black)
table.cell(panel, 1, 5, "", bgcolor=color.black)
table.cell(panel, 0, 6, "", bgcolor=color.black)
table.cell(panel, 1, 6, "", bgcolor=color.black)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
else if secim == "SSTEM 2: DL+KAPASTE+DNG"
table.cell(panel, 0, 3, "DL DREN", text_color=color.silver, text_size=size.small)
table.cell(panel, 1, 3, str.tostring(dl_direnc, format.mintick), text_color=color.red, text_size=size.small)
table.cell(panel, 0, 4, "DL DESTEK", text_color=color.silver, text_size=size.small)
table.cell(panel, 1, 4, str.tostring(dl_destek, format.mintick), text_color=color.lime, text_size=size.small)
table.cell(panel, 0, 5, "TEMAS", text_color=color.white, text_size=size.small)
string temas_txt = temas_var ? "⚠️ KRTK" : "TEMZ"
color temas_col = temas_var ? color.red : color.gray
table.cell(panel, 1, 5, temas_txt, text_color=temas_col, text_size=size.small)
table.cell(panel, 0, 6, "", bgcolor=color.black)
table.cell(panel, 1, 6, "", bgcolor=color.black)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
else if secim == "SSTEM 3: SAR AYNA (KANAL)"
table.cell(panel, 0, 3, "KANAL", text_color=color.gray, text_size=size.small)
table.cell(panel, 1, 3, "ST / ALT", text_color=color.gray, text_size=size.small)
table.cell(panel, 0, 4, "1 (SARI)", text_color=color.yellow, text_size=size.small)
string k1 = str.tostring(s3_tavan1, format.mintick) + " / " + str.tostring(s3_sar1, format.mintick)
table.cell(panel, 1, 4, k1, text_color=color.yellow, text_size=size.small)
table.cell(panel, 0, 5, "2 (MAV)", text_color=color.blue, text_size=size.small)
string k2 = str.tostring(s3_tavan2, format.mintick) + " / " + str.tostring(s3_sar2, format.mintick)
table.cell(panel, 1, 5, k2, text_color=color.blue, text_size=size.small)
table.cell(panel, 0, 6, "3 (KRZ)", text_color=color.red, text_size=size.small)
string k3 = str.tostring(s3_tavan3, format.mintick) + " / " + str.tostring(s3_sar3, format.mintick)
table.cell(panel, 1, 6, k3, text_color=color.red, text_size=size.small)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
else if secim == "SSTEM 4: SAR PVOT (DESTEK/DREN)"
table.cell(panel, 0, 3, "PVOT MODU", text_color=color.white, text_size=size.small)
table.cell(panel, 1, 3, "AKTF", text_color=pivot_renk, text_size=size.small)
table.cell(panel, 0, 4, "SEVYE", text_color=color.gray, text_size=size.small)
table.cell(panel, 1, 4, str.tostring(pivot_seviye, format.mintick), text_color=pivot_renk, text_size=size.small)
table.cell(panel, 0, 5, "UZAKLIK", text_color=color.gray, text_size=size.small)
float p_fark = close - pivot_seviye
string p_txt = p_fark > 0 ? "+" : ""
table.cell(panel, 1, 5, p_txt + str.tostring(p_fark, format.mintick), text_color=color.white, text_size=size.small)
table.cell(panel, 0, 6, "", bgcolor=color.black)
table.cell(panel, 1, 6, "", bgcolor=color.black)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
else if secim == "SSTEM 5: TETK (SIKIMA)"
table.cell(panel, 0, 3, "TETK MODU", text_color=color.white, text_size=size.small)
string t_durum = sikisma_var ? "SIKIMA VAR" : "BEKLEMEDE"
color t_renk = sikisma_var ? color.yellow : color.gray
table.cell(panel, 1, 3, t_durum, text_color=t_renk, text_size=size.small)
table.cell(panel, 0, 4, "OLASI YN", text_color=color.silver, text_size=size.small)
color yon_renk = tetik_yon == "YUKARI (AL)" ? color.lime : (tetik_yon == "AAI (SAT)" ? color.red : color.gray)
table.cell(panel, 1, 4, tetik_yon, text_color=yon_renk, text_size=size.small)
table.cell(panel, 0, 5, "FYAT", text_color=color.white, text_size=size.small)
table.cell(panel, 1, 5, str.tostring(close, format.mintick), text_color=color.white, text_size=size.small)
table.cell(panel, 0, 6, "", bgcolor=color.black)
table.cell(panel, 1, 6, "", bgcolor=color.black)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
else if secim == "SSTEM 6: GENEL BAKI (ZET)"
// TM SSTEMLERN ZET
// 1. Pivot Durumu
table.cell(panel, 0, 3, "PVOT", text_color=color.white, text_size=size.small)
string p_durum = close > pivot_seviye ? "DESTEKTE" : "DRENTE"
color p_renk = close > pivot_seviye ? color.lime : color.red
table.cell(panel, 1, 3, p_durum, text_color=p_renk, text_size=size.small)
// 2. Tetik Durumu
table.cell(panel, 0, 4, "TETK", text_color=color.white, text_size=size.small)
string t_d = sikisma_var ? "UYARI !" : "SAKN"
color t_r = sikisma_var ? color.yellow : color.gray
table.cell(panel, 1, 4, t_d, text_color=t_r, text_size=size.small)
// 3. Fiyat
table.cell(panel, 0, 5, "FYAT", text_color=color.silver, text_size=size.small)
table.cell(panel, 1, 5, str.tostring(close, format.mintick), text_color=color.white, text_size=size.small)
// 4. Kanal Modu (Sistem 3)
table.cell(panel, 0, 6, "KANAL", text_color=color.white, text_size=size.small)
string k_durum = close > s3_tavan1 ? "AIRI ALIM" : (close < s3_sar1 ? "AIRI SATIM" : "NORMAL")
color k_renk = k_durum == "NORMAL" ? color.gray : color.orange
table.cell(panel, 1, 6, k_durum, text_color=k_renk, text_size=size.small)
table.cell(panel, 0, 7, "", bgcolor=color.black)
table.cell(panel, 1, 7, "", bgcolor=color.black)
Yer mleri