PHP Code:
// © Kinetik Komuta Merkezi [Masterpiece V6.9 - Terminal Sόrόmό]
//@version=6
indicator("KKM V6.9 Terminal", shorttitle="KKM V6.9", overlay=true, max_labels_count=50, max_lines_count=50)
// ─────────────────────────────────────────────────────────────────
// 1. GέRDέLER
// ─────────────────────────────────────────────────────────────────
group_l1 = "1. Kinetik Motor"
int atrLen = input.int(20, "L1 Hafύza (ATR)", group=group_l1)
float atrMult = input.float(3.5, "L1 Gόrόltό Duvarύ", step=0.1, group=group_l1)
float mu = input.float(0.6, "L1 Yakύnsaklύk (μ)", step=0.1, group=group_l1)
group_holy = "2. Kurumsal S-TWAP Filtresi"
float maxTension = input.float(2.0, "Maksimum Gerginlik Sύnύrύ (ATR)", step=0.1, group=group_holy)
// ─────────────────────────────────────────────────────────────────
// 2. ARKA PLAN HESAPLAMALARI (SAF YΦRάK VE TWAP)
// ─────────────────────────────────────────────────────────────────
f_yoruk_pure() =>
float threshold = ta.atr(atrLen) * atrMult
var float z = na
var float v = 0.0
if bar_index == 0
z := hl2
else
float zPrev = z[1], float vPrev = v[1]
float zPred = zPrev + vPrev
float zTemp = zPred + mu * (hl2 - zPred)
float diff = zTemp - zPrev
if math.abs(diff) > threshold
v := math.sign(diff) * (math.abs(diff) - threshold)
else
v := 0.0
z := zPrev + v
z
// S-TWAP ve 15m TWAP (Makro Onay)
bool isNew15m = ta.change(time("15")) != 0
var float sumPrice15m = 0.0, var float barCount15m = 0.0
if isNew15m or bar_index == 0
sumPrice15m := hl2, barCount15m := 1.0
else
sumPrice15m += hl2, barCount15m += 1.0
float curTwap15m = sumPrice15m / barCount15m
bool isNewHour = ta.change(time("60")) != 0
var float sumPriceH = 0.0, var float barCountH = 0.0
if isNewHour or bar_index == 0
sumPriceH := hl2, barCountH := 1.0
else
sumPriceH += hl2, barCountH += 1.0
float curTwapH = sumPriceH / barCountH
bool isNewDay = ta.change(time("D")) != 0
var float sumPriceD = 0.0, var float barCountD = 0.0
if isNewDay or bar_index == 0
sumPriceD := hl2, barCountD := 1.0
else
sumPriceD += hl2, barCountD += 1.0
float curTwapD = sumPriceD / barCountD
// ─────────────────────────────────────────────────────────────────
// 3. BAR RENKLENDέRME (Maliyet ήelalesi)
// ─────────────────────────────────────────────────────────────────
bool costBull = close > curTwap15m and curTwap15m > curTwapH and curTwapH > curTwapD
bool costBear = close < curTwap15m and curTwap15m < curTwapH and curTwapH < curTwapD
barcolor(costBull ? #00e676 : costBear ? #ff1744 : #787b86)
// ─────────────────────────────────────────────────────────────────
// 4. ήELALE ΗέZέMLERέ (Sadece 1-3-5-15 Ekranda Kalύr)
// ─────────────────────────────────────────────────────────────────
float y1 = f_yoruk_pure()
float y3 = request.security(syminfo.tickerid, "3", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
float y5 = request.security(syminfo.tickerid, "5", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
float y15 = request.security(syminfo.tickerid, "15", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
float y60 = request.security(syminfo.tickerid, "60", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
float y240 = request.security(syminfo.tickerid, "240", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
float yD = request.security(syminfo.tickerid, "D", f_yoruk_pure(), lookahead=barmerge.lookahead_off)
plot(y1, "1m Yφrόk", color=color.new(#ffeb3b, 0), linewidth=1, style=plot.style_stepline)
plot(y3, "3m Yφrόk", color=color.new(#ff9800, 0), linewidth=1, style=plot.style_stepline)
plot(y5, "5m Yφrόk", color=color.new(#e91e63, 0), linewidth=1, style=plot.style_stepline)
plot(y15, "15m Yφrόk", color=color.new(#9c27b0, 0), linewidth=2, style=plot.style_stepline)
// ─────────────────────────────────────────────────────────────────
// 5. MέKRO ATEήLEME & MANYETέK HEDEFLEME MANTIΠI
// ─────────────────────────────────────────────────────────────────
float safeAtr = math.max(ta.atr(14), syminfo.mintick)
bool isIgnition = (high - low) >= (safeAtr * 1.5)
float atrH = request.security(syminfo.tickerid, "60", ta.atr(14), lookahead=barmerge.lookahead_off)
float twapDistAtr = atrH > 0 ? math.abs(close - curTwapH) / atrH : 0
bool tensionOk = twapDistAtr <= maxTension
bool breakBull = close > y1 and close > y3 and (open < y1 or open < y3 or close[1] < y1)
bool breakBear = close < y1 and close < y3 and (open > y1 or open > y3 or close[1] > y1)
bool fireBull = breakBull and isIgnition and close > curTwapH and close > open and tensionOk
bool fireBear = breakBear and isIgnition and close < curTwapH and close < open and tensionOk
bgcolor(fireBull ? color.new(#00e676, 85) : fireBear ? color.new(#ff1744, 85) : na, title="Ateώleme Zemin Flaώύ")
var int activeSide = 0
var float entryPrice = na
var bool hasMagnet = false
var line lineEntry = na, var label lblEntry = na
if (fireBull and activeSide != 1)
activeSide := 1, entryPrice := close, hasMagnet := y60 > close
if not na(lineEntry)
line.delete(lineEntry), label.delete(lblEntry)
lineEntry := line.new(bar_index, entryPrice, bar_index + 5, entryPrice, color=color.new(#00e676, 0), width=2)
lblEntry := label.new(bar_index + 5, entryPrice, "GέRέή: " + str.tostring(math.round(entryPrice, 2)), color=color.new(#00e676, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
else if (fireBear and activeSide != -1)
activeSide := -1, entryPrice := close, hasMagnet := y60 < close
if not na(lineEntry)
line.delete(lineEntry), label.delete(lblEntry)
lineEntry := line.new(bar_index, entryPrice, bar_index + 5, entryPrice, color=color.new(#ff1744, 0), width=2)
lblEntry := label.new(bar_index + 5, entryPrice, "GέRέή: " + str.tostring(math.round(entryPrice, 2)), color=color.new(#ff1744, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if activeSide != 0
line.set_x2(lineEntry, bar_index + 5), label.set_x(lblEntry, bar_index + 5)
bool magnetHitBull = activeSide == 1 and hasMagnet and high >= y60
bool magnetHitBear = activeSide == -1 and hasMagnet and low <= y60
bool microStopBull = activeSide == 1 and close < y1
bool microStopBear = activeSide == -1 and close > y1
if magnetHitBull or magnetHitBear
activeSide := 0
line.set_color(lineEntry, color.new(color.gray, 60)), label.set_color(lblEntry, color.new(color.gray, 60))
else if microStopBull or microStopBear
activeSide := 0
line.set_color(lineEntry, color.new(color.gray, 60)), label.set_color(lblEntry, color.new(color.gray, 60))
// ─────────────────────────────────────────────────────────────────
// 6. TERMINAL PUSULASI (TAM KONTROL HUD)
// ─────────────────────────────────────────────────────────────────
var table terminal = table.new(position.bottom_right, 2, 11, bgcolor=color.new(color.black, 60), border_color=color.new(color.gray, 80), border_width=1)
f_col(val) => close > val ? #00e676 : close < val ? #ff1744 : color.silver
if barstate.islast
table.cell(terminal, 0, 0, "KKM MICRO SNIPER", text_color=color.gray, text_size=size.small, bgcolor=color.new(color.black, 40))
table.merge_cells(terminal, 0, 0, 1, 0)
// Satύr 1: Giriώ Fiyatύ (Son durumu asla unutmaz)
string entryState = activeSide == 1 ? " (AKTέF/AL)" : activeSide == -1 ? " (AKTέF/SAT)" : " (KAPALI)"
string entryStr = not na(entryPrice) ? str.tostring(math.round(entryPrice, 2)) + entryState : "BEKLENέYOR"
color entryCol = activeSide == 1 ? #00e676 : activeSide == -1 ? #ff1744 : color.silver
table.cell(terminal, 0, 1, "SON GέRέή", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 1, entryStr, text_color=entryCol, text_size=size.small)
// Satύr 2: Tampon Stop (1m ve 3m Ortalamasύ)
float stopAvg = (y1 + y3) / 2
table.cell(terminal, 0, 2, "STOP (1m+3m)", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 2, str.tostring(math.round(stopAvg, 2)), text_color=color.orange, text_size=size.small)
// Satύr 3-9: MTF Radar
table.cell(terminal, 0, 3, "1m Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 3, str.tostring(math.round(y1, 2)), text_color=f_col(y1), text_size=size.small)
table.cell(terminal, 0, 4, "3m Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 4, str.tostring(math.round(y3, 2)), text_color=f_col(y3), text_size=size.small)
table.cell(terminal, 0, 5, "5m Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 5, str.tostring(math.round(y5, 2)), text_color=f_col(y5), text_size=size.small)
table.cell(terminal, 0, 6, "15m Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 6, str.tostring(math.round(y15, 2)), text_color=f_col(y15), text_size=size.small)
table.cell(terminal, 0, 7, "60m Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 7, str.tostring(math.round(y60, 2)), text_color=f_col(y60), text_size=size.small)
table.cell(terminal, 0, 8, "4S Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 8, str.tostring(math.round(y240, 2)), text_color=f_col(y240), text_size=size.small)
table.cell(terminal, 0, 9, "1G Yφrόk", text_color=color.white, text_size=size.small)
table.cell(terminal, 1, 9, str.tostring(math.round(yD, 2)), text_color=f_col(yD), text_size=size.small)
// Satύr 10: YTD
table.cell(terminal, 0, 10, "YTD", text_color=color.gray, text_size=size.tiny)
table.merge_cells(terminal, 0, 10, 1, 10)
// ─────────────────────────────────────────────────────────────────
// 7. ALARMLAR
// ─────────────────────────────────────────────────────────────────
alertcondition(fireBull, "🟢 SNIPER AL", "ALIM! 1m/3m Yφrόk Kύrύldύ.")
alertcondition(fireBear, "🔴 SNIPER SAT", "SATIή! 1m/3m Yφrόk Kύrύldύ.")
Yer έmleri