PHP Code:
// Kinetik Komuta Merkezi - KKM V35 CYBORG MATRIX (V33 Motoru + HTF Radar + HUD)
//@version=6
strategy("Karargah V35 - Cyborg Yay Stratejisi", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.04)
// ═════════════════════════════════════════════════════════════════════════
// 1. AYARLAR VE GRDLER
// ═════════════════════════════════════════════════════════════════════════
htfRes = input.timeframe("60", "st Zaman Dilimi (HTF) Onay", group="Makro Rzgar Radar")
showDash = input.bool(true, "Karargah Gsterge Paneli (HUD)", group="Grsellik")
// ═════════════════════════════════════════════════════════════════════════
// 2. EKRDEK FONKSYONLAR (Sfr Repaint Garantisi)
// ═════════════════════════════════════════════════════════════════════════
// V33 Ktle Fizii
f_ozel_sar_ep(src_h, src_l, _start, _inc, _max) =>
var int trend = 0, var float sar_val = 0.0, var float ep = 0.0, var float af = 0.0
if trend == 0 and not na(src_h[1])
trend := src_h >= src_h[1] or src_l >= src_l[1] ? 1 : -1
sar_val := trend > 0 ? src_l[1] : src_h[1], ep := trend > 0 ? src_h[1] : src_l[1], af := _start
else
float nextsar = sar_val
if trend > 0
if src_h[1] > ep
ep := src_h[1], af := math.min(_max, af + _inc)
nextsar := sar_val + af * (ep - sar_val)
nextsar := math.min(math.min(src_l[1], src_l[2]), nextsar)
if nextsar > src_l
trend := -1, nextsar := ep, ep := src_l, af := _start
else
if src_l[1] < ep
ep := src_l[1], af := math.min(_max, af + _inc)
nextsar := sar_val + af * (ep - sar_val)
nextsar := math.max(math.max(src_h[1], src_h[2]), nextsar)
if nextsar < src_h
trend := 1, nextsar := ep, ep := src_h, af := _start
sar_val := nextsar
[sar_val, trend, ep]
f_kuantum_lrb_dinamik(src, base_decay, smooth, max_atr_dist, evrensel_ivme) =>
var float hh = na, var float ll = na
float pre_hh = nz(hh[1], src), float pre_ll = nz(ll[1], src)
float atr_gucu = nz(ta.atr(14), ta.tr)
float decay_mult = 2.0 - (evrensel_ivme * 1.5)
float cur_decay = atr_gucu * base_decay * decay_mult
float decay_sma = ta.sma(cur_decay, smooth)
float temp_hh = src >= pre_hh ? src : pre_hh - decay_sma
float temp_ll = src <= pre_ll ? src : pre_ll + decay_sma
float max_mesafe = atr_gucu * max_atr_dist
hh := math.min(temp_hh, src + max_mesafe)
ll := math.max(temp_ll, src - max_mesafe)
float mid = math.avg(hh, ll)
[hh, ll, mid]
// TEMA Motoru (HTF Onay in)
f_tema(src, len) =>
e1 = ta.ema(src, len)
e2 = ta.ema(e1, len)
e3 = ta.ema(e2, len)
3 * e1 - 3 * e2 + e3
// ═════════════════════════════════════════════════════════════════════════
// 3. V33 DNA VE 3 SAF ZG + EKSEN HESAPLAMASI
// ═════════════════════════════════════════════════════════════════════════
float ham_volatilite = ta.tr(true)
float max_vol = nz(ta.highest(ham_volatilite, 3), 0.0001), float min_vol = nz(ta.lowest(ham_volatilite, 3), 0.0)
float vol_orani = (max_vol == min_vol) ? 0.0 : ((ham_volatilite - min_vol) / (max_vol - min_vol))
float ayna_start = 0.02 + (vol_orani * 0.08), float ayna_inc = 0.02 + (vol_orani * 0.08), float ayna_max = 0.20 + (vol_orani * 0.30)
[ayna_sar, ayna_trend, ayna_ep] = f_ozel_sar_ep(high, low, ayna_start, ayna_inc, ayna_max)
float ayna = ayna_trend > 0 ? hl2 + math.abs(hl2 - ayna_sar) : hl2 - math.abs(hl2 - ayna_sar)
float ayna_ivme = math.abs(ayna - nz(ayna[1], ayna))
float max_ivme = nz(ta.highest(ayna_ivme, 3), 0.0001), float min_ivme = nz(ta.lowest(ayna_ivme, 3), 0.0)
float evrensel_ivme = (max_ivme == min_ivme) ? 0.0 : ((ayna_ivme - min_ivme) / (max_ivme - min_ivme))
[ayna_hh, ayna_ll, ayna_mid] = f_kuantum_lrb_dinamik(ayna, 0.10, 4, 4.0, evrensel_ivme)
var int eksen_yonu = 1
if ayna_mid > nz(ayna_mid[1], ayna_mid)
eksen_yonu := 1
else if ayna_mid < nz(ayna_mid[1], ayna_mid)
eksen_yonu := -1
// ═════════════════════════════════════════════════════════════════════════
// 4. HTF (MAKRO RZGAR) ONAYI
// ═════════════════════════════════════════════════════════════════════════
// Lookahead kapal tutularak HTF Repaint engellenir
float htfFast = request.security(syminfo.tickerid, htfRes, f_tema(close, 9), lookahead=barmerge.lookahead_off)
float htfSlow = request.security(syminfo.tickerid, htfRes, f_tema(close, 21), lookahead=barmerge.lookahead_off)
bool htf_bull = htfFast > htfSlow
bool htf_bear = htfFast < htfSlow
// ═════════════════════════════════════════════════════════════════════════
// 5. SNYAL RETM (Fzyon Mant)
// ═════════════════════════════════════════════════════════════════════════
// V33 Dip Sekmesi (barstate.isconfirmed ile gn ii repaint iptal edildi)
bool dip_sekmesi_long = (ayna[1] <= ayna_ll[1]) and (ayna > ayna[1]) and barstate.isconfirmed
bool tepe_sekmesi_short = (ayna[1] >= ayna_hh[1]) and (ayna < ayna[1]) and barstate.isconfirmed
// Fzyon Onay: Sekme + Kanal Ekseni + HTF Makro Rzgar
bool filtreli_long_onay = dip_sekmesi_long and (eksen_yonu == 1) and htf_bull
bool filtreli_short_onay = tepe_sekmesi_short and (eksen_yonu == -1) and htf_bear
// ═════════════════════════════════════════════════════════════════════════
// 6. BAA BA (BREAKEVEN) LEM YNETM
// ═════════════════════════════════════════════════════════════════════════
var float islem_giris_fiyati = na
var bool basa_bas_long_aktif = false
var bool basa_bas_short_aktif = false
if filtreli_long_onay and strategy.position_size == 0
strategy.entry("DP LONG", strategy.long)
islem_giris_fiyati := ayna
basa_bas_long_aktif := false
if filtreli_short_onay and strategy.position_size == 0
strategy.entry("TEPE SHORT", strategy.short)
islem_giris_fiyati := ayna
basa_bas_short_aktif := false
if strategy.position_size > 0
float hedef_mesafe = ayna_hh - islem_giris_fiyati
if ayna >= islem_giris_fiyati + (hedef_mesafe * 0.618)
basa_bas_long_aktif := true
if (ayna >= ayna_hh) and barstate.isconfirmed
strategy.close("DP LONG", comment="Diren Vuruldu (TP)")
else if basa_bas_long_aktif and (ayna <= islem_giris_fiyati) and barstate.isconfirmed
strategy.close("DP LONG", comment="Baa Ba Kurtarma (BE)")
else if (ayna < ayna_ll) and (ayna < ayna[1]) and barstate.isconfirmed
strategy.close("DP LONG", comment="Destek kt (SL)")
if strategy.position_size < 0
float hedef_mesafe = islem_giris_fiyati - ayna_ll
if ayna <= islem_giris_fiyati - (hedef_mesafe * 0.618)
basa_bas_short_aktif := true
if (ayna <= ayna_ll) and barstate.isconfirmed
strategy.close("TEPE SHORT", comment="Destek Vuruldu (TP)")
else if basa_bas_short_aktif and (ayna >= islem_giris_fiyati) and barstate.isconfirmed
strategy.close("TEPE SHORT", comment="Baa Ba Kurtarma (BE)")
else if (ayna > ayna_hh) and (ayna > ayna[1]) and barstate.isconfirmed
strategy.close("TEPE SHORT", comment="Diren Krld (SL)")
if strategy.position_size == 0
basa_bas_long_aktif := false
basa_bas_short_aktif := false
islem_giris_fiyati := na
// ═════════════════════════════════════════════════════════════════════════
// 7. GRSELLETRME VE HUD
// ═════════════════════════════════════════════════════════════════════════
plot(ayna, "Sar Ayna (Ktle)", color=color.new(color.yellow, 0), linewidth=2, style=plot.style_stepline)
plot(ayna_hh, "Krmz Tepe (Diren)", color=color.new(color.red, 0), linewidth=1, style=plot.style_stepline)
plot(ayna_ll, "Yeil Dip (Destek)", color=color.new(color.lime, 0), linewidth=1, style=plot.style_stepline)
plot(basa_bas_long_aktif or basa_bas_short_aktif ? islem_giris_fiyati : na, "Baa Ba Zrh", color=color.new(color.blue, 0), linewidth=2, style=plot.style_cross)
plotshape(filtreli_long_onay and strategy.position_size <= 0, "Dipten AL", shape.triangleup, location.belowbar, color.lime, size=size.small)
plotshape(filtreli_short_onay and strategy.position_size >= 0, "Tepeden SAT", shape.triangledown, location.abovebar, color.red, size=size.small)
// --- TEMA'DAN SKLEN KARARGAH HUD (GSTERGE PANEL) ---
if showDash and barstate.islast
var table dash = table.new(position.top_right, 2, 7, bgcolor=color.new(#0D0D0D, 10), border_color=color.new(#333333, 0), border_width=1, frame_color=color.new(#00E5FF, 0), frame_width=2)
// Balk
table.cell(dash, 0, 0, "CYBORG MATRIX V35", text_color=color.new(#00E5FF, 0), text_size=size.normal, bgcolor=color.new(#111111, 0), text_halign=text.align_center)
table.merge_cells(dash, 0, 0, 1, 0)
// Operasyon Durumu
string islem_durumu = strategy.position_size > 0 ? "LONG AKTF" : strategy.position_size < 0 ? "SHORT AKTF" : "PUSUDA (BEKLEMEDE)"
color durum_renk = strategy.position_size > 0 ? color.lime : strategy.position_size < 0 ? color.red : color.gray
table.cell(dash, 0, 1, "Operasyon", text_color=color.white, text_size=size.small, bgcolor=color.new(#1A1A1A, 0))
table.cell(dash, 1, 1, islem_durumu, text_color=durum_renk, text_size=size.small, bgcolor=color.new(#1A1A1A, 0), text_halign=text.align_center)
// Makro Rzgar (HTF)
string htf_text = htf_bull ? "YUKARI (BULL)" : htf_bear ? "AAI (BEAR)" : "YATAY"
color htf_renk = htf_bull ? color.lime : htf_bear ? color.red : color.gray
table.cell(dash, 0, 2, "Makro HTF (" + htfRes + ")", text_color=color.white, text_size=size.small, bgcolor=color.new(#161616, 0))
table.cell(dash, 1, 2, htf_text, text_color=htf_renk, text_size=size.small, bgcolor=color.new(#161616, 0), text_halign=text.align_center)
// Baa Ba Zrh Durumu
string zirh_text = (basa_bas_long_aktif or basa_bas_short_aktif) ? "AKTF (KORUNUYOR)" : "KAPALI"
color zirh_renk = (basa_bas_long_aktif or basa_bas_short_aktif) ? color.aqua : color.gray
table.cell(dash, 0, 3, "Baa Ba (B.E.) Zrh", text_color=color.white, text_size=size.small, bgcolor=color.new(#1A1A1A, 0))
table.cell(dash, 1, 3, zirh_text, text_color=zirh_renk, text_size=size.small, bgcolor=color.new(#1A1A1A, 0), text_halign=text.align_center)
// Ayna (Radar)
table.cell(dash, 0, 4, "Sar Ayna (Anlk)", text_color=color.white, text_size=size.small, bgcolor=color.new(#161616, 0))
table.cell(dash, 1, 4, str.tostring(ayna, format.mintick), text_color=color.yellow, text_size=size.small, bgcolor=color.new(#161616, 0), text_halign=text.align_center)
// Diren Hedefi
table.cell(dash, 0, 5, "Krmz Tepe (Diren)", text_color=color.white, text_size=size.small, bgcolor=color.new(#1A1A1A, 0))
table.cell(dash, 1, 5, str.tostring(ayna_hh, format.mintick), text_color=color.red, text_size=size.small, bgcolor=color.new(#1A1A1A, 0), text_halign=text.align_center)
// Destek Hedefi
table.cell(dash, 0, 6, "Yeil Dip (Destek)", text_color=color.white, text_size=size.small, bgcolor=color.new(#161616, 0))
table.cell(dash, 1, 6, str.tostring(ayna_ll, format.mintick), text_color=color.lime, text_size=size.small, bgcolor=color.new(#161616, 0), text_halign=text.align_center)
Yer mleri