PHP Code:
// © Kinetik Komuta Merkezi - KKM V16 MATRIX ULTIMATE (Canlύ Morfolojik Kutu & HUD)
//@version=6
indicator("Karargah V16 - Canlύ Kutu & Keskin Niώancύ", overlay=true, max_lines_count=500, max_boxes_count=500, max_labels_count=500)
// ═════════════════════════════════════════════════════════════════════════
// 1. ΗEKέRDEK: OTONOM SAR VE DέNAMέK LRB MOTORLARI
// ═════════════════════════════════════════════════════════════════════════
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]
// ═════════════════════════════════════════════════════════════════════════
// 2. ARKA PLAN DNA (EVRENSEL έVME) & AYNA RADARI
// ═════════════════════════════════════════════════════════════════════════
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))
[ayna_sar, ayna_trend, ayna_ep] = f_ozel_sar_ep(high, low, 0.0 + (vol_orani * 0.08), 0.001 + (vol_orani * 0.08), 0.10 + (vol_orani * 0.30))
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.001), 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))
// ═════════════════════════════════════════════════════════════════════════
// 3. DέNAMέK KORέDOR BANTLARI (Ayna ve Makro)
// ═════════════════════════════════════════════════════════════════════════
[ayna_hh, ayna_ll, ayna_mid] = f_kuantum_lrb_dinamik(ayna, 0.10, 4, 4.0, evrensel_ivme)
[macro_hh, macro_ll, macro_mid] = f_kuantum_lrb_dinamik(hl2, 0.05, 8, 6.0, evrensel_ivme)
// ═════════════════════════════════════════════════════════════════════════
// 4. KESKέN NέήANCI: AήIRI UΗ HAFIZASI VE TETέK
// ═════════════════════════════════════════════════════════════════════════
var int aktif_islem = 0
var bool macro_temas_long = false
var bool macro_temas_short = false
if hl2 <= macro_ll
macro_temas_long := true, macro_temas_short := false
if hl2 >= macro_hh
macro_temas_short := true, macro_temas_long := false
var bool horoz_long = false, var bool horoz_short = false
if macro_temas_long and (ayna <= ayna_ll)
horoz_long := true
if macro_temas_short and (ayna >= ayna_hh)
horoz_short := true
bool pusu_long = horoz_long and ta.crossover(ayna, ayna_hh) and barstate.isconfirmed
bool pusu_short = horoz_short and ta.crossunder(ayna, ayna_ll) and barstate.isconfirmed
// ═════════════════════════════════════════════════════════════════════════
// 5. CANLI MORFOLOJέK KUTU (HUD) VE έήLEM YΦNETέMέ
// ═════════════════════════════════════════════════════════════════════════
var box islem_kutusu = na
var label lbl_tp = na, var label lbl_sl = na, var label lbl_en = na
var float entry_price = na
if pusu_long or pusu_short
aktif_islem := pusu_long ? 1 : -1
horoz_long := false, horoz_short := false
macro_temas_long := false, macro_temas_short := false
entry_price := hl2
// Kutuyu ve Etiketleri Yarat
color c_bg = aktif_islem == 1 ? color.new(color.lime, 90) : color.new(color.red, 90)
color c_border = aktif_islem == 1 ? color.lime : color.red
islem_kutusu := box.new(left=bar_index, top=macro_hh, right=bar_index+3, bottom=macro_ll, border_color=c_border, bgcolor=c_bg, border_style=line.style_dashed)
lbl_tp := label.new(bar_index + 3, macro_hh, "TP", style=label.style_label_left, color=color.new(color.black, 100), textcolor=aktif_islem==1 ? color.lime : color.red, size=size.small)
lbl_sl := label.new(bar_index + 3, macro_ll, "SL", style=label.style_label_left, color=color.new(color.black, 100), textcolor=aktif_islem==1 ? color.red : color.lime, size=size.small)
lbl_en := label.new(bar_index + 3, entry_price, "GέRέή", style=label.style_label_left, color=color.new(color.black, 100), textcolor=color.white, size=size.small)
// KUTU GάNCELLEME (έώlem Aktifken Kutu Esner)
if aktif_islem != 0
box.set_right(islem_kutusu, bar_index + 3)
box.set_top(islem_kutusu, macro_hh)
box.set_bottom(islem_kutusu, macro_ll)
string t_tp = (aktif_islem == 1 ? "Dinamik TP: " : "Dinamik SL: ") + str.tostring(macro_hh, format.mintick)
string t_sl = (aktif_islem == 1 ? "Dinamik SL: " : "Dinamik TP: ") + str.tostring(macro_ll, format.mintick)
label.set_xy(lbl_tp, bar_index + 3, macro_hh)
label.set_text(lbl_tp, t_tp)
label.set_xy(lbl_sl, bar_index + 3, macro_ll)
label.set_text(lbl_sl, t_sl)
label.set_x(lbl_en, bar_index + 3)
label.set_text(lbl_en, "Giriώ: " + str.tostring(entry_price, format.mintick))
// TAHLέYE (έώlem Kapatma)
bool tahliye = false
if aktif_islem == 1 and ta.crossunder(hl2, macro_ll) and barstate.isconfirmed
aktif_islem := 0, tahliye := true, horoz_long := false
if aktif_islem == -1 and ta.crossover(hl2, macro_hh) and barstate.isconfirmed
aktif_islem := 0, tahliye := true, horoz_short := false
// ═════════════════════════════════════════════════════════════════════════
// 6. ΗέZέMLER (SADELEήTέRέLMέή EKRAN)
// ═════════════════════════════════════════════════════════════════════════
plot(ayna, "Ayna Radar", color=color.new(color.white, 20), linewidth=1)
plot(ayna_hh, "Ayna Tetik (Tepe)", color=color.new(color.red, 20), linewidth=1, style=plot.style_stepline)
plot(ayna_ll, "Ayna Tetik (Dip)", color=color.new(color.lime, 20), linewidth=1, style=plot.style_stepline)
plot(macro_hh, "Makro Tavan", color=color.new(#ff9800, 30), linewidth=1)
plot(macro_ll, "Makro Taban", color=color.new(#ff9800, 30), linewidth=1)
plotshape(pusu_long, "Dinamik Long", shape.triangleup, location.belowbar, color=color.lime, size=size.small, text="PUSU\nAL", textcolor=color.white)
plotshape(pusu_short, "Dinamik Short", shape.triangledown, location.abovebar, color=color.red, size=size.small, text="PUSU\nSAT", textcolor=color.white)
plotshape(tahliye ? hl2 : na, "Dinamik Tahliye", style=shape.xcross, location=location.absolute, color=color.new(color.yellow, 0), size=size.small, text="TAHLέYE", textcolor=color.white)
plotshape(macro_temas_long and not pusu_long, "Alt Temas", shape.diamond, location.bottom, color=color.new(color.lime, 50), size=size.tiny)
plotshape(macro_temas_short and not pusu_short, "άst Temas", shape.diamond, location.top, color=color.new(color.red, 50), size=size.tiny)
Yer έmleri