PHP Code:
// © Kinetik Komuta Merkezi [V15 - Hibrit Güvenli Bölge (8-34 PT) Entegrasyonu]
//@version=6
indicator("Kinetik Komuta Merkezi [V15]", overlay = true, max_lines_count = 500)
// ─────────────────────────────────────────────────────────────────
// 0. GÝRDÝLER VE RENK PALETÝ
// ─────────────────────────────────────────────────────────────────
group_dash = "Gösterge Paneli (Dashboard)"
bool show_dash = input.bool(true, "Paneli Göster", group=group_dash)
string dash_pos = input.string("Top Right", "Panel Konumu", options=["Top Right", "Top Left", "Bottom Right", "Bottom Left"], group=group_dash)
group_motor = "Çift Motor & Bulut"
int len_fast = input.int(20, "Hýzlý Motor (Zemin 1)", group=group_motor)
int len_slow = input.int(50, "Yavaþ Motor (Zemin 2)", group=group_motor)
group_pt = "Güvenli Bölge (8-34 PT Filtresi)"
bool show_pt_bg = input.bool(true, "Yeþil Arka Planý Göster", group=group_pt)
int pt_ema_len = input.int(8, "PT Hýzlý (EMA)", group=group_pt)
int pt_sma_len = input.int(34, "PT Yavaþ (SMA)", group=group_pt)
int pt_consec_low = input.int(10, "Minimum Mum (Low > EMA)", group=group_pt)
int pt_consec_ema = input.int(5, "Minimum Mum (EMA > SMA)", group=group_pt)
group_kin = "Kinetik Renkler"
col_up1 = input.color(#00e676, "Boða Ana", group=group_kin)
col_dn1 = input.color(#ff1744, "Ayý Ana", group=group_kin)
col_flat= input.color(#787b86, "Flat (Bulut Ýçi)", group=group_kin)
color col_cloud_up = color.new(#00e676, 85)
color col_cloud_dn = color.new(#ff1744, 85)
group_stat = "1σ Ýstatistiksel Hedef"
int volLength = input.int(20, "Volatilite Periyodu", group=group_stat)
int projBars = input.int(15, "Ýleriye Dönük Mum (T)", group=group_stat)
int barsPerYear = input.int(525600, "Yýllýk Mum (1dk=525600)", group=group_stat)
group_ayna = "Makro Duvarlar (Yin-Yang Ayna)"
float h_start = input.float(0.06, "Hýzlý SAR Baþlangýç", step=0.01, group=group_ayna)
float h_inc = input.float(0.06, "Hýzlý SAR Ývme", step=0.01, group=group_ayna)
float h_max = input.float(0.30, "Hýzlý SAR Max", step=0.1, group=group_ayna)
int pivot_len = input.int(15, "Duvar Tespiti (Pivot Uzunluðu)", group=group_ayna)
// ─────────────────────────────────────────────────────────────────
// 1. MOTOR: ÇÝFT ZEMÝN (KÝNETÝK BULUT VE MUM RENGÝ)
// ─────────────────────────────────────────────────────────────────
float mid_fast = ta.hma(ta.median(hl2, len_fast * 2), 10)
float mid_slow = ta.hma(ta.median(hl2, len_slow * 2), 10)
bool is_bull_trend = mid_fast > mid_slow
bool is_bear_trend = mid_fast < mid_slow
p_fast = plot(mid_fast, color=color.white, linewidth=1, title="Hýzlý Zemin", display=display.pane)
p_slow = plot(mid_slow, color=color.new(color.white, 50), linewidth=1, title="Yavaþ Zemin", display=display.pane)
fill(p_fast, p_slow, is_bull_trend ? col_cloud_up : col_cloud_dn, title="Kinetik Bulut")
float cloud_top = math.max(mid_fast, mid_slow)
float cloud_bot = math.min(mid_fast, mid_slow)
color bar_col = close > cloud_top ? col_up1 : close < cloud_bot ? col_dn1 : col_flat
barcolor(bar_col)
// ─────────────────────────────────────────────────────────────────
// 2. MOTOR: 3'LÜ SAR (TAKTÝKSEL 1-2-3 HEDEFLERÝ)
// ─────────────────────────────────────────────────────────────────
float sar_a = ta.sar(0.02, 0.02, 0.2)
float sar_b = ta.sar(0.01, 0.01, 0.1)
float sar_c = ta.sar(0.005, 0.005, 0.05)
float t_up1 = ta.hma(close + math.abs(close - sar_a), 10)
float t_up2 = ta.hma(close + math.abs(close - sar_b), 10)
float t_up3 = ta.hma(close + math.abs(close - sar_c), 10)
float t_dn1 = ta.hma(close - math.abs(close - sar_a), 10)
float t_dn2 = ta.hma(close - math.abs(close - sar_b), 10)
float t_dn3 = ta.hma(close - math.abs(close - sar_c), 10)
bool hit_u3 = ta.crossover(high, t_up3) and is_bull_trend
bool hit_u2 = ta.crossover(high, t_up2) and is_bull_trend and not hit_u3
bool hit_u1 = ta.crossover(high, t_up1) and is_bull_trend and not hit_u2 and not hit_u3
bool hit_d3 = ta.crossunder(low, t_dn3) and is_bear_trend
bool hit_d2 = ta.crossunder(low, t_dn2) and is_bear_trend and not hit_d3
bool hit_d1 = ta.crossunder(low, t_dn1) and is_bear_trend and not hit_d2 and not hit_d3
plot(hit_u1 ? t_up1 : na, style=plot.style_circles, linewidth=2, color=col_up1, display=display.pane)
plot(hit_u2 ? t_up2 : na, style=plot.style_circles, linewidth=3, color=col_up1, display=display.pane)
plot(hit_u3 ? t_up3 : na, style=plot.style_circles, linewidth=4, color=col_up1, display=display.pane)
plot(hit_d1 ? t_dn1 : na, style=plot.style_circles, linewidth=2, color=col_dn1, display=display.pane)
plot(hit_d2 ? t_dn2 : na, style=plot.style_circles, linewidth=3, color=col_dn1, display=display.pane)
plot(hit_d3 ? t_dn3 : na, style=plot.style_circles, linewidth=4, color=col_dn1, display=display.pane)
plotchar(hit_u1, char="1", location=location.abovebar, color=col_up1, size=size.tiny, display=display.pane)
plotchar(hit_u2, char="2", location=location.abovebar, color=col_up1, size=size.tiny, display=display.pane)
plotchar(hit_u3, char="3", location=location.abovebar, color=col_up1, size=size.tiny, display=display.pane)
plotchar(hit_d1, char="1", location=location.belowbar, color=col_dn1, size=size.tiny, display=display.pane)
plotchar(hit_d2, char="2", location=location.belowbar, color=col_dn1, size=size.tiny, display=display.pane)
plotchar(hit_d3, char="3", location=location.belowbar, color=col_dn1, size=size.tiny, display=display.pane)
var float bull_seal_price = na
var float bear_seal_price = na
var line bull_seal = na
var line bear_seal = na
if hit_u3
bull_seal_price := high
if not na(bull_seal)
line.delete(bull_seal)
bull_seal := line.new(bar_index, high, bar_index + 1, high, color=col_up1, width=2, style=line.style_dashed, extend=extend.right)
if hit_d3
bear_seal_price := low
if not na(bear_seal)
line.delete(bear_seal)
bear_seal := line.new(bar_index, low, bar_index + 1, low, color=col_dn1, width=2, style=line.style_dashed, extend=extend.right)
// ─────────────────────────────────────────────────────────────────
// 3. MOTOR: 5'LÝ SAR ÇAKIÞMASI (ELMAS TETÝK)
// ─────────────────────────────────────────────────────────────────
float s1 = ta.sar(0.0, 0.001, 0.02)
float s2 = ta.sar(0.0, 0.002, 0.02)
float s3 = ta.sar(0.0, 0.003, 0.02)
float s4 = ta.sar(0.0, 0.0001, 0.02)
float s5 = ta.sar(0.001, 0.00001, 0.02)
plot(s3, "1 (SAR Mavi)", color=color.new(#040cfb, 0), linewidth=1, style=plot.style_cross, display=display.pane)
plot(s4, "2 (SAR Sarý)", color=color.new(color.yellow, 0), linewidth=1, style=plot.style_cross, display=display.pane)
plot(s5, "3 (SAR Fuþya)", color=color.new(color.fuchsia, 0), linewidth=1, style=plot.style_cross, display=display.pane)
isEq(v1, v2) => math.abs(v1 - v2) <= syminfo.mintick
isEq3(v1, v2, v3) => isEq(v1, v2) and isEq(v1, v3)
c1 = isEq3(s1, s2, s3), c2 = isEq3(s1, s2, s4), c3 = isEq3(s1, s2, s5)
c4 = isEq3(s1, s3, s4), c5 = isEq3(s1, s3, s5), c6 = isEq3(s1, s4, s5)
c7 = isEq3(s2, s3, s4), c8 = isEq3(s2, s3, s5), c9 = isEq3(s2, s4, s5), c10 = isEq3(s3, s4, s5)
any3 = c1 or c2 or c3 or c4 or c5 or c6 or c7 or c8 or c9 or c10
float matchVal = na
if c1 or c2 or c3 or c4 or c5 or c6
matchVal := s1
else if c7 or c8 or c9
matchVal := s2
else if c10
matchVal := s3
trigger = any3 and not any3[1]
isSupport = close > matchVal
diamondColor = isSupport ? color.rgb(0, 230, 118, 20) : color.rgb(255, 23, 68, 20)
plotshape(trigger ? matchVal : na, "3'lü SAR Elmasý", shape.diamond, location.absolute, color=diamondColor, size=size.small, display=display.pane)
var float last_diamond_price = na
var int last_diamond_dir = 0
if trigger
last_diamond_price := matchVal
last_diamond_dir := isSupport ? 1 : -1
// ─────────────────────────────────────────────────────────────────
// 4. MOTOR: ÝSTATÝSTÝKSEL VOLATÝLÝTE (KUTUP YILDIZI)
// ─────────────────────────────────────────────────────────────────
logReturn = math.log(close / nz(close[1], close))
rawVol = ta.stdev(logReturn, volLength)
annualVol = rawVol * math.sqrt(barsPerYear)
conePrice(float basePrice, float vol, int t, float sigmaMultiplier, int direction) =>
drift = direction * sigmaMultiplier * vol * math.sqrt(float(t) / float(barsPerYear))
basePrice * math.exp(drift)
var label[] sigmaLabels = array.new<label>()
var line[] sigmaLines = array.new<line>()
if barstate.islast
if sigmaLabels.size() > 0
for i = 0 to sigmaLabels.size() - 1
label.delete(sigmaLabels.get(i))
line.delete(sigmaLines.get(i))
sigmaLabels.clear()
sigmaLines.clear()
float tip1up = conePrice(close, annualVol, projBars, 1.0, 1)
float tip1dn = conePrice(close, annualVol, projBars, 1.0, -1)
int tipX = bar_index + projBars
if is_bull_trend
sigmaLabels.push(label.new(tipX, tip1up, "1σ Hedef\n" + str.tostring(tip1up, format.mintick), color=color.new(col_up1, 80), textcolor=col_up1, style=label.style_label_left, size=size.small))
sigmaLines.push(line.new(bar_index, close, tipX, tip1up, color=color.new(col_up1, 50), style=line.style_dotted))
else if is_bear_trend
sigmaLabels.push(label.new(tipX, tip1dn, "1σ Hedef\n" + str.tostring(tip1dn, format.mintick), color=color.new(col_dn1, 80), textcolor=col_dn1, style=label.style_label_left, size=size.small))
sigmaLines.push(line.new(bar_index, close, tipX, tip1dn, color=color.new(col_dn1, 50), style=line.style_dotted))
// ─────────────────────────────────────────────────────────────────
// 5. MOTOR: YÝN-YANG AYNASI VE MAKRO DUVARLAR
// ─────────────────────────────────────────────────────────────────
f_ozel_sar(src_h, src_l, _start, _inc, _max, _reset_hiz) =>
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
if _reset_hiz
af := _start
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]
bool yeni_gun = ta.change(time("D")) != 0
[sar_hizli, trend_hizli] = f_ozel_sar(high, low, h_start, h_inc, h_max, yeni_gun)
float ayna_hizli = trend_hizli > 0 ? close + math.abs(close - sar_hizli) : close - math.abs(close - sar_hizli)
float ph_ayna = ta.pivothigh(ayna_hizli, pivot_len, pivot_len)
float pl_ayna = ta.pivotlow(ayna_hizli, pivot_len, pivot_len)
var array<line> macro_up_walls = array.new<line>()
var array<line> macro_dn_walls = array.new<line>()
if not na(ph_ayna)
line w_up = line.new(bar_index[pivot_len], ph_ayna, bar_index, ph_ayna, color=col_up1, width=2, style=line.style_dotted, extend=extend.right)
array.push(macro_up_walls, w_up)
if array.size(macro_up_walls) > 2
line.delete(array.shift(macro_up_walls))
if not na(pl_ayna)
line w_dn = line.new(bar_index[pivot_len], pl_ayna, bar_index, pl_ayna, color=col_dn1, width=2, style=line.style_dotted, extend=extend.right)
array.push(macro_dn_walls, w_dn)
if array.size(macro_dn_walls) > 2
line.delete(array.shift(macro_dn_walls))
plot(ayna_hizli, "Ayna Ýzi", color=color.new(color.gray, 80), linewidth=1, display=display.pane)
// ─────────────────────────────────────────────────────────────────
// 6. MOTOR: MUM ANATOMÝSÝ VE HACÝM DELTASI (RÖNTGEN)
// ─────────────────────────────────────────────────────────────────
float tr_val = ta.tr(true)
float priceRange = math.max(tr_val, syminfo.mintick)
float body = close - open
float bodySize = math.abs(body)
float upperWick = high - math.max(open, close)
float lowerWick = math.min(open, close) - low
float totalCandle = bodySize + upperWick + lowerWick
totalCandle := totalCandle == 0 ? syminfo.mintick : totalCandle
float bodyRatio = body / priceRange
float wickBuy = lowerWick / totalCandle
float wickSell = upperWick / totalCandle
float closePos = (close - low) / priceRange
float buyStrength = (closePos * 0.6) + (wickBuy * 0.25) + (bodyRatio > 0 ? bodyRatio * 0.35 : 0)
float sellStrength = ((1 - closePos) * 0.6) + (wickSell * 0.25) + (bodyRatio < 0 ? -bodyRatio * 0.35 : 0)
float estBuyVol = volume * buyStrength
float estSellVol = volume * sellStrength
float normTotal = estBuyVol + estSellVol
estBuyVol := normTotal > 0 ? volume * (estBuyVol / normTotal) : 0
estSellVol := normTotal > 0 ? volume * (estSellVol / normTotal) : 0
float deltaPct = normTotal > 0 ? ((estBuyVol - estSellVol) / normTotal) * 100 : 0
string deltaStatus = deltaPct >= 65 ? "Balina Alýmý" : deltaPct >= 20 ? "Güçlü Alým" : deltaPct <= -65 ? "Balina Satýþý" : deltaPct <= -20 ? "Güçlü Satýþ" : "Nötr / Dengeli"
color deltaCol = deltaPct >= 65 ? color.new(#00e676, 0) : deltaPct >= 20 ? color.new(#26a69a, 0) : deltaPct <= -65 ? color.new(#ff1744, 0) : deltaPct <= -20 ? color.new(#ef5350, 0) : color.new(#787b86, 0)
// ─────────────────────────────────────────────────────────────────
// 7. MOTOR: GÜVENLÝ BÖLGE (8-34 POWER TREND FÝLTRESÝ)
// ─────────────────────────────────────────────────────────────────
float ema_pt = ta.ema(close, pt_ema_len)
float sma_pt = ta.sma(close, pt_sma_len)
bool lowAboveEMA = na(low) or (low == close) ? close > ema_pt : low > ema_pt
bool emaAboveSMA = ema_pt > sma_pt
bool smaUp = sma_pt > sma_pt[1]
bool barUp = na(open) or (open == close) ? (close > close[1]) : (close > open)
var int consecLow = 0
consecLow := lowAboveEMA ? nz(consecLow[1]) + 1 : 0
var int consecEMA = 0
consecEMA := emaAboveSMA ? nz(consecEMA[1]) + 1 : 0
bool onConditions = consecLow >= pt_consec_low and consecEMA >= pt_consec_ema and smaUp and barUp
bool offCross = ta.crossunder(ema_pt, sma_pt)
var bool ptOn = false
if offCross
ptOn := false
else if onConditions
ptOn := true
bgcolor(show_pt_bg and ptOn ? color.new(color.green, 88) : na, title="Güvenli Bölge Arka Planý")
// ─────────────────────────────────────────────────────────────────
// 8. GÖRSEL MOTOR: VERÝ TERMÝNALÝ (DASHBOARD)
// ─────────────────────────────────────────────────────────────────
var pos = dash_pos == "Top Right" ? position.top_right : dash_pos == "Top Left" ? position.top_left : dash_pos == "Bottom Right" ? position.bottom_right : position.bottom_left
var table dash = table.new(pos, 4, 12, border_width = 1, border_color = color.new(#363a45, 50), frame_color = color.new(#363a45, 50), frame_width = 1, bgcolor = color.new(#131722, 10))
if show_dash and barstate.islast
table.cell(dash, 0, 0, "KÝNETÝK KOMUTA MERKEZÝ", text_color=color.white, text_halign=text.align_center, bgcolor=color.new(#2962ff, 50), text_size=size.small)
table.merge_cells(dash, 0, 0, 3, 0)
table.cell(dash, 0, 1, "Fiyat | Hýz | Atalet", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 1, str.tostring(close, format.mintick), text_color=color.white, text_size=size.small, text_halign=text.align_center)
table.cell(dash, 2, 1, str.tostring(mid_fast, format.mintick), text_color=color.aqua, text_size=size.small, text_halign=text.align_center)
table.cell(dash, 3, 1, str.tostring(mid_slow, format.mintick), text_color=color.orange, text_size=size.small, text_halign=text.align_center)
string txt_bull_seal = na(bull_seal_price) ? "-" : str.tostring(bull_seal_price, format.mintick)
string txt_bear_seal = na(bear_seal_price) ? "-" : str.tostring(bear_seal_price, format.mintick)
table.cell(dash, 0, 2, "3 Mührü (Duvar)", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 2, "Boða:\n" + txt_bull_seal, text_color=col_up1, text_size=size.small)
table.cell(dash, 2, 2, "Ayý:\n" + txt_bear_seal, text_color=col_dn1, text_size=size.small)
table.merge_cells(dash, 2, 2, 3, 2)
table.cell(dash, 0, 3, "Boða 1-2-3", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 3, str.tostring(t_up1, format.mintick), text_color=col_up1, text_size=size.small)
table.cell(dash, 2, 3, str.tostring(t_up2, format.mintick), text_color=col_up1, text_size=size.small)
table.cell(dash, 3, 3, str.tostring(t_up3, format.mintick), text_color=col_up1, text_size=size.small)
table.cell(dash, 0, 4, "Ayý 1-2-3", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 4, str.tostring(t_dn1, format.mintick), text_color=col_dn1, text_size=size.small)
table.cell(dash, 2, 4, str.tostring(t_dn2, format.mintick), text_color=col_dn1, text_size=size.small)
table.cell(dash, 3, 4, str.tostring(t_dn3, format.mintick), text_color=col_dn1, text_size=size.small)
table.cell(dash, 0, 5, "3'lü SAR", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 5, str.tostring(sar_a, format.mintick), text_color=color.silver, text_size=size.small)
table.cell(dash, 2, 5, str.tostring(sar_b, format.mintick), text_color=color.silver, text_size=size.small)
table.cell(dash, 3, 5, str.tostring(sar_c, format.mintick), text_color=color.silver, text_size=size.small)
table.cell(dash, 0, 6, "SAR (Mavi-Sarý-Fuþya)", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 6, str.tostring(s3, format.mintick), text_color=color.new(#040cfb, 0), text_size=size.small)
table.cell(dash, 2, 6, str.tostring(s4, format.mintick), text_color=color.new(color.yellow, 0), text_size=size.small)
table.cell(dash, 3, 6, str.tostring(s5, format.mintick), text_color=color.new(color.fuchsia, 0), text_size=size.small)
string txt_elmas = na(last_diamond_price) ? "-" : str.tostring(last_diamond_price, format.mintick)
color col_elmas = last_diamond_dir == 1 ? col_up1 : last_diamond_dir == -1 ? col_dn1 : color.gray
table.cell(dash, 0, 7, "Son Elmas", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 7, txt_elmas, text_color=col_elmas, text_size=size.small, text_halign=text.align_center)
table.merge_cells(dash, 1, 7, 3, 7)
table.cell(dash, 0, 8, "Ayna (Gerilim)", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
table.cell(dash, 1, 8, str.tostring(ayna_hizli, format.mintick), text_color=color.new(#d500f9, 0), text_size=size.small, text_halign=text.align_center)
table.merge_cells(dash, 1, 8, 3, 8)
table.cell(dash, 0, 9, "Anlýk Delta (Baský)", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
string txt_delta = (deltaPct > 0 ? "+" : "") + str.tostring(deltaPct, "#.0") + "% (" + deltaStatus + ")"
table.cell(dash, 1, 9, txt_delta, text_color=deltaCol, text_size=size.small, text_halign=text.align_center)
table.merge_cells(dash, 1, 9, 3, 9)
// YENÝ GÜNCELLEME: Güvenli Bölge Durumu
table.cell(dash, 0, 10, "Güvenli Bölge (PT)", text_color=color.gray, text_size=size.small, text_halign=text.align_left)
string txt_pt = ptOn ? "AKTÝF (Trend Onaylý)" : "BEKLEMEDE"
color col_pt = ptOn ? color.new(#00e676, 0) : color.new(#787b86, 0)
table.cell(dash, 1, 10, txt_pt, text_color=col_pt, text_size=size.small, text_halign=text.align_center)
table.merge_cells(dash, 1, 10, 3, 10)
table.cell(dash, 0, 11, "(AÝ) Eðitim çalýþmasýdýr. Yatýrým tavsiyesi DEÐÝLDÝR.", text_color=color.new(color.gray, 50), text_size=size.tiny)
table.merge_cells(dash, 0, 11, 3, 11)
Yer Ýmleri