PHP Code:
// © Kinetik Komuta Merkezi [Masterpiece V6.1 - Striker & Gravity]
//@version=6
indicator("KKM V6.1 Striker", shorttitle="KKM V6.1", overlay=true, max_labels_count=50, max_lines_count=50)
// ─────────────────────────────────────────────────────────────────
// 1. GÝRDÝLER
// ─────────────────────────────────────────────────────────────────
group_l1 = "1. Kinetik Motor"
int i_coreLen = input.int(55, "Çekirdek (ZLEMA) Uzunluđu", group=group_l1)
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_trade = "2. Operasyon & Kasa"
float i_tpPct = input.float(1.0, "Vur-Kaç Hedefi (%)", step=0.1, group=group_trade)
float i_riskPct = input.float(1.0, "Kabul Edilen Risk (Kasanýn %'si)", step=0.5, group=group_trade)
// ─────────────────────────────────────────────────────────────────
// 2. MATEMATÝKSEL MOTOR & ZAMAN DÝLÝMLERÝ
// ─────────────────────────────────────────────────────────────────
f_calc() =>
// ZLEMA
float ema1 = ta.ema(hl2, i_coreLen)
float ema2 = ta.ema(ema1, i_coreLen)
float val_core = ema1 + (ema1 - ema2)
// L1 @yörük@
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
// 5 Dakikalýk TWAP (Erken Yerçekimi)
bool isNew5m = ta.change(time("5")) != 0
var float sumPrice5m = 0.0, var float barCount5m = 0.0
if isNew5m or bar_index == 0
sumPrice5m := hl2, barCount5m := 1.0
else
sumPrice5m += hl2, barCount5m += 1.0
float val_twap_5m = sumPrice5m / barCount5m
// Saatlik Saf TWAP (Ana Merkez)
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 val_twap_h = sumPriceH / barCountH
[val_core, z, val_twap_5m, val_twap_h, hl2]
[curCore, curYoruk, curTwap5m, curTwapH, curPrice] = f_calc()
// ─────────────────────────────────────────────────────────────────
// 3. SESSÝZ MTF MAKRO ÇEKÝRDEK
// ─────────────────────────────────────────────────────────────────
f_zlema() =>
e1 = ta.ema(hl2, i_coreLen)
e2 = ta.ema(e1, i_coreLen)
e1 + (e1 - e2)
[z1] = request.security(syminfo.tickerid, "1", [f_zlema()])
[z3] = request.security(syminfo.tickerid, "3", [f_zlema()])
[z5] = request.security(syminfo.tickerid, "5", [f_zlema()])
[z15] = request.security(syminfo.tickerid, "15", [f_zlema()])
[z60] = request.security(syminfo.tickerid, "60", [f_zlema()])
float mtfCore = (nz(z1, curCore) + nz(z3, curCore) + nz(z5, curCore) + nz(z15, curCore) + nz(z60, curCore)) / 5.0
bool isMacroBull = curPrice > mtfCore
// ─────────────────────────────────────────────────────────────────
// 4. ÇÝZÝMLER
// ─────────────────────────────────────────────────────────────────
plot(mtfCore, "MTF Makro Çekirdek", color=color.new(color.silver, 20), linewidth=3)
plot(curTwapH, "S-TWAP", color=color.rgb(255, 204, 0), linewidth=1, style=plot.style_linebr)
plot(curTwap5m, "5m TWAP (Yerçekimi)", color=color.new(color.white, 30), linewidth=1, style=plot.style_dotted)
plot(curYoruk, "@yörük@", color=color.fuchsia, linewidth=2, style=plot.style_stepline)
plot(curCore, "Çekirdek", color=color.aqua, linewidth=2)
// ─────────────────────────────────────────────────────────────────
// 5. KÝNETÝK ATEŢLEME & ZEMÝN ALARMI
// ─────────────────────────────────────────────────────────────────
float safeAtr = math.max(ta.atr(14), syminfo.mintick)
bool isIgnition = (high - low) >= (safeAtr * 1.5)
bool trendBull = curPrice > curCore and curPrice > curYoruk and curPrice > curTwapH
bool trendBear = curPrice < curCore and curPrice < curYoruk and curPrice < curTwapH
bool fireBull = trendBull and isIgnition and close > open
bool fireBear = trendBear and isIgnition and close < open
// GÖRSEL ZEMÝN ALARMI (Arka Plan Flaţý)
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 float shelfLevel = na
var float statTp = na
var line lineEntry = na, var label lblEntry = na
var line lineShelf = na, var label lblShelf = na
var line lineTp = na, var label lblTp = na
if (fireBull and activeSide != 1)
activeSide := 1, entryPrice := close, shelfLevel := curCore, statTp := close * (1 + (i_tpPct / 100))
if not na(lineEntry)
line.delete(lineEntry), label.delete(lblEntry), line.delete(lineShelf), label.delete(lblShelf), line.delete(lineTp), label.delete(lblTp)
lineEntry := line.new(bar_index, entryPrice, bar_index + 6, entryPrice, color=color.new(#00e676, 0), width=2)
lblEntry := label.new(bar_index + 6, 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)
lineShelf := line.new(bar_index, shelfLevel, bar_index + 6, shelfLevel, color=color.new(#ff1744, 0), width=1, style=line.style_dashed)
lblShelf := label.new(bar_index + 6, shelfLevel, "ÝPTAL (Raf): " + str.tostring(math.round(shelfLevel, 2)), color=color.new(#ff1744, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
lineTp := line.new(bar_index, statTp, bar_index + 6, statTp, color=color.new(#00bcd4, 0), width=2, style=line.style_dotted)
lblTp := label.new(bar_index + 6, statTp, "HEDEF: " + str.tostring(math.round(statTp, 2)), color=color.new(#00bcd4, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
else if (fireBear and activeSide != -1)
activeSide := -1, entryPrice := close, shelfLevel := curCore, statTp := close * (1 - (i_tpPct / 100))
if not na(lineEntry)
line.delete(lineEntry), label.delete(lblEntry), line.delete(lineShelf), label.delete(lblShelf), line.delete(lineTp), label.delete(lblTp)
lineEntry := line.new(bar_index, entryPrice, bar_index + 6, entryPrice, color=color.new(#ff1744, 0), width=2)
lblEntry := label.new(bar_index + 6, 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)
lineShelf := line.new(bar_index, shelfLevel, bar_index + 6, shelfLevel, color=color.new(#00e676, 0), width=1, style=line.style_dashed)
lblShelf := label.new(bar_index + 6, shelfLevel, "ÝPTAL (Raf): " + str.tostring(math.round(shelfLevel, 2)), color=color.new(#00e676, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
lineTp := line.new(bar_index, statTp, bar_index + 6, statTp, color=color.new(#00bcd4, 0), width=2, style=line.style_dotted)
lblTp := label.new(bar_index + 6, statTp, "HEDEF: " + str.tostring(math.round(statTp, 2)), color=color.new(#00bcd4, 80), textcolor=color.white, style=label.style_label_left, size=size.small)
if activeSide != 0
line.set_x2(lineEntry, bar_index + 6), label.set_x(lblEntry, bar_index + 6)
line.set_x2(lineShelf, bar_index + 6), label.set_x(lblShelf, bar_index + 6)
line.set_x2(lineTp, bar_index + 6), label.set_x(lblTp, bar_index + 6)
bool stopOut = (activeSide == 1 and curPrice < curYoruk) or (activeSide == -1 and curPrice > curYoruk)
bool shelfFail = activeSide == 1 ? close < shelfLevel : close > shelfLevel
bool tpOut = (activeSide == 1 and high >= statTp) or (activeSide == -1 and low <= statTp)
if stopOut or shelfFail or tpOut
activeSide := 0
color grayCol = color.new(color.gray, 60)
line.set_color(lineEntry, grayCol), label.set_color(lblEntry, grayCol)
line.set_color(lineShelf, grayCol), label.set_color(lblShelf, grayCol)
line.set_color(lineTp, grayCol), label.set_color(lblTp, grayCol)
color bCol = trendBull ? #00e676 : trendBear ? #ff1744 : #787b86
barcolor(bCol)
// ─────────────────────────────────────────────────────────────────
// 6. MÝNÝ PUSULA (HUD) & KASA YÖNETÝMÝ & YERÇEKÝMÝ
// ─────────────────────────────────────────────────────────────────
var table miniHud = table.new(position.bottom_right, 2, 6, bgcolor=color.new(color.black, 40), border_color=color.new(color.gray, 80), border_width=1)
if barstate.islast
// Risk ve Kasa Hesaplamasý
float refPrice = activeSide != 0 ? entryPrice : close
float stopDistPct = math.abs(refPrice - curYoruk) / refPrice * 100
float recSize = stopDistPct > 0 ? (i_riskPct / stopDistPct) * 100 : 0
string sizeStr = stopDistPct < 0.1 ? "ÇOK YAKIN" : "%" + str.tostring(math.round(recSize)) + " Kasa"
// Yerçekimi (5m TWAP) Analizi
bool isGravityPull = (activeSide == 1 and curPrice < curTwap5m) or (activeSide == -1 and curPrice > curTwap5m)
string gravText = isGravityPull ? "⚠️ S-TWAP'A ÇEKÝLÝYOR" : "5M DESTEKLÝYOR"
color gravCol = isGravityPull ? color.orange : color.silver
table.cell(miniHud, 0, 0, "KKM STRIKER", text_color=color.gray, text_size=size.small, bgcolor=color.new(color.black, 40))
table.merge_cells(miniHud, 0, 0, 1, 0)
table.cell(miniHud, 0, 1, "MAKRO (MTF)", text_color=color.white, text_size=size.small)
table.cell(miniHud, 1, 1, isMacroBull ? "BOĐA RÜZGARI" : "AYI BASKISI", text_color=isMacroBull ? #00e676 : #ff1744, text_size=size.small)
table.cell(miniHud, 0, 2, "DURUM", text_color=color.white, text_size=size.small)
table.cell(miniHud, 1, 2, activeSide == 1 ? "AKTÝF (AL)" : activeSide == -1 ? "AKTÝF (SAT)" : "TETÝKTE", text_color=activeSide == 1 ? #00e676 : activeSide == -1 ? #ff1744 : color.silver, text_size=size.small)
table.cell(miniHud, 0, 3, "KÝN. STOP", text_color=color.white, text_size=size.small)
table.cell(miniHud, 1, 3, activeSide != 0 ? str.tostring(math.round(curYoruk, 2)) : "-", text_color=#ff1744, text_size=size.small)
table.cell(miniHud, 0, 4, "RÝSK/KASA", text_color=color.white, text_size=size.small)
table.cell(miniHud, 1, 4, sizeStr + " (Uzaklýk: %" + str.tostring(stopDistPct, "#.##") + ")", text_color=color.aqua, text_size=size.small)
table.cell(miniHud, 0, 5, "YERÇEKÝMÝ (5m)", text_color=color.white, text_size=size.small)
table.cell(miniHud, 1, 5, gravText, text_color=gravCol, text_size=size.small)
Yer Ýmleri