PHP Code:
//@version=6
indicator("Yφrόk [Titan Form - DNA Keskin Niώancύsύ]", overlay=true, max_labels_count=500)
// ─────────────────────────────────────────────────────────────────
// 1. TEMEL MATEMATέKSEL VE MATS FONKSέYONLARI
// ─────────────────────────────────────────────────────────────────
bool_to_float(bool source) => source ? 1.0 : 0.0
ema(source)=>
var float ema_val = 0.0
var int count = 0
count := nz(count[1]) + 1
ema_val := (1.0 - 2.0 / (count + 1.0)) * nz(ema_val[1]) + 2.0 / (count + 1.0) * source
ema_val
atan2(y, x) =>
var float angle = 0.0
if x > 0
angle := math.atan(y / x)
else if x < 0 and y >= 0
angle := math.atan(y / x) + math.pi
else if x < 0 and y < 0
angle := math.atan(y / x) - math.pi
else if x == 0 and y > 0
angle := math.pi / 2
else if x == 0 and y < 0
angle := -math.pi / 2
angle
degrees(float source) => source * 180 / math.pi
f_mats(int _len) =>
atr_val = ema(ta.tr)
slope = (close - close[10]) / (atr_val * 10)
angle_rad = atan2(slope, 1)
deg = degrees(angle_rad)
src_m = ta.sma((deg > 0 ? high : low), 2)
smooth = 0.0
hh = math.max(math.sign(ta.change(ta.highest(_len))), 0)
ll = math.max(math.sign(ta.change(ta.lowest(_len)) * -1), 0)
tc = math.pow(ta.sma(bool_to_float(hh > 0 or ll > 0), _len), 2)
smooth := nz(smooth[1] + tc * (src_m - smooth[1]), src_m)
wp = _len * 4 - 1
a = math.abs(nz(smooth[1]) - smooth)
ma_a = ta.ema(a, wp)
dfa = ta.ema(ma_a, wp) * _len * 0.4
res = 0.0
if smooth > nz(res[1])
res := (smooth - dfa < res[1]) ? res[1] : (smooth - dfa)
else
res := (smooth + dfa > res[1]) ? res[1] : (smooth + dfa)
res
// ─────────────────────────────────────────────────────────────────
// 2. GέRDέLER
// ─────────────────────────────────────────────────────────────────
k_start = input.float(0.0, "Kral Baώlangύη", step=0.01, group="Otonom Beyin")
k_inc = input.float(0.02, "Kral έvme", step=0.01, group="Otonom Beyin")
k_max = input.float(0.20, "Kral Max", step=0.01, group="Otonom Beyin")
h_start = input.float(0.06, "Hύzlύ SAR Baώlangύη", group="Yin-Yang SAR")
h_inc = input.float(0.06, "Hύzlύ SAR έvme", group="Yin-Yang SAR")
h_max = input.float(0.30, "Hύzlύ SAR Max", group="Yin-Yang SAR")
y_start = input.float(0.01, "Yavaώ SAR Baώlangύη", group="Yin-Yang SAR")
y_inc = input.float(0.01, "Yavaώ SAR έvme", group="Yin-Yang SAR")
y_max = input.float(0.10, "Yavaώ SAR Max", group="Yin-Yang SAR")
multTight = input.float(0.7, "Zύrh έvme Ηarpanύ (+)", step=0.1, group="RMDT Kuantum Boπumu")
multWide = input.float(-0.7, "Zύrh Yorulma Ηarpanύ (-)", step=0.1, group="RMDT Kuantum Boπumu")
// DNA Girdileri
atrLen = input.int(14, "ATR Periyodu", group="DNA Gizli Tetik")
minConfidence = input.int(75, "Min Gόvenilirlik %", group="DNA Gizli Tetik")
volSmaLen = input.int(20, "Hacim SMA Uzunluπu", group="DNA Gizli Tetik")
// ─────────────────────────────────────────────────────────────────
// 3. ADAPTέF MATS ZIRHI VE OTONOM BEYέN
// ─────────────────────────────────────────────────────────────────
string tf = timeframe.period
float aktif_zirh = na
if tf == "1"
aktif_zirh := f_mats(34)
else if tf == "3"
aktif_zirh := f_mats(21)
else if tf == "5"
aktif_zirh := f_mats(13)
else if tf == "15"
aktif_zirh := f_mats(8)
else if tf == "60"
aktif_zirh := f_mats(5)
else if tf == "240"
aktif_zirh := f_mats(3)
else
aktif_zirh := f_mats(2)
type SARState
float sar_value
float extreme_point
float accel_factor
bool isLong
int trend_age
int bounce_count
bool was_touching
method f_updateState(SARState state, float high_val, float low_val, float close_val, float accel_start, float accel_inc, float accel_max, float decay_limit, float atr_val) =>
bool isInit = false
bool t_change = false
if na(state.sar_value)
if close_val > close_val[1]
state.isLong := true
state.extreme_point := high_val
state.sar_value := low_val[1]
else
state.isLong := false
state.extreme_point := low_val
state.sar_value := high_val[1]
isInit := true
state.accel_factor := accel_start
state.trend_age := 0
else
state.trend_age += 1
state.sar_value += state.accel_factor * (state.extreme_point - state.sar_value)
if state.isLong
if state.sar_value > low_val
isInit := true
t_change := true
state.isLong := false
state.sar_value := math.max(high_val, state.extreme_point)
state.extreme_point := low_val
state.accel_factor := accel_start
state.trend_age := 0
else
if state.sar_value < high_val
isInit := true
t_change := true
state.isLong := true
state.sar_value := math.min(low_val, state.extreme_point)
state.extreme_point := high_val
state.accel_factor := accel_start
state.trend_age := 0
if t_change
state.bounce_count := 0
state.was_touching := false
else
float tol = atr_val * 0.2
bool is_touch = state.isLong ? (low_val <= state.sar_value + tol) : (high_val >= state.sar_value - tol)
if is_touch and not state.was_touching
state.bounce_count += 1
state.was_touching := is_touch
float decay = math.max(0.01, 1.0 - (state.trend_age / decay_limit))
float y_inc = accel_inc * decay
if not isInit
if state.isLong
if high_val > state.extreme_point
state.extreme_point := high_val
state.accel_factor := math.min(state.accel_factor + y_inc, accel_max)
else
if low_val < state.extreme_point
state.extreme_point := low_val
state.accel_factor := math.min(state.accel_factor + y_inc, accel_max)
if bar_index > 2
if state.isLong
state.sar_value := math.min(math.min(state.sar_value, low_val[1]), low_val[2])
else
state.sar_value := math.max(math.max(state.sar_value, high_val[1]), high_val[2])
state
var float[] fibs = array.from(1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 21.0, 34.0, 55.0)
var states = array.new<SARState>()
if barstate.isfirst
for i = 0 to 8
states.push(SARState.new(na, na, k_start, false, 0, 0, false))
float gercek_oynaklik = ta.atr(14)
for i = 0 to 8
states.get(i).f_updateState(high, low, close, k_start, k_inc, k_max, fibs.get(i), gercek_oynaklik)
var int king_idx = 5
int new_king = -1
for i = 0 to 8
if states.get(i).bounce_count >= 2
new_king := i
break
if new_king != -1
king_idx := new_king
bool kral_yon = states.get(king_idx).isLong
// ─────────────────────────────────────────────────────────────────
// 4. KUANTUM BOΠUMU HESAPLAMASI (RMDT KALKAN)
// ─────────────────────────────────────────────────────────────────
f_rmsd(src, bench, len) =>
float sum_sq = 0.0
for i = 0 to len - 1
sum_sq += math.pow(nz(src[i]) - nz(bench[i]), 2)
math.sqrt(sum_sq / len)
rmsdVal = f_rmsd(close, aktif_zirh, 20)
devRaw = rmsdVal > 0 ? (close - aktif_zirh) / rmsdVal : 0.0
devSig = ta.ema(devRaw, 6)
sigAbs = math.abs(devSig)
sigPeak = ta.highest(sigAbs, 50)
sigNorm = sigPeak > 0 ? math.min(sigAbs / sigPeak, 1.0) : 0.0
mult = multWide - sigNorm * (multWide - multTight)
bandwidth = rmsdVal * mult
float trailRaw = kral_yon ? (aktif_zirh - bandwidth) : (aktif_zirh + bandwidth)
float trail = ta.ema(trailRaw, 3)
// ─────────────────────────────────────────────────────────────────
// 5. CANDLE DNA ANALYZER (GέZLέ KESKέN NέήANCI TETέΠέ)
// ─────────────────────────────────────────────────────────────────
candleRange = high - low
bodySize = math.abs(close - open)
upperWick = high - math.max(close, open)
lowerWick = math.min(close, open) - low
bodyRatio = candleRange > 0 ? (bodySize / candleRange) * 100 : 0.0
upperRatio = candleRange > 0 ? (upperWick / candleRange) * 100 : 0.0
lowerRatio = candleRange > 0 ? (lowerWick / candleRange) * 100 : 0.0
atrVal = ta.atr(atrLen)
rangeVsAtr = atrVal > 0 ? (candleRange / atrVal) * 100 : 0.0
volSma = ta.sma(volume, volSmaLen)
volRelative = volSma > 0 ? (volume / volSma) * 100 : 100.0
closePos = candleRange > 0 ? ((close - low) / candleRange) * 100 : 50.0
isBullish = close > open
isBearish = close < open
// Ηekiη (Hammer) Skoru
float hammerScore = 0.0
hammerScore += (lowerRatio > 60 ? 30.0 : lowerRatio > 40 ? 15.0 : 0.0)
hammerScore += (upperRatio < 10 ? 25.0 : upperRatio < 20 ? 10.0 : 0.0)
hammerScore += (bodyRatio < 35 ? 20.0 : bodyRatio < 45 ? 10.0 : 0.0)
hammerScore += (closePos > 65 ? 15.0 : closePos > 50 ? 8.0 : 0.0)
hammerScore += (volRelative > 120 ? 10.0 : 0.0)
bool isHammer = hammerScore >= minConfidence
// Kayan Yύldύz (Shooting Star) Skoru
float starScore = 0.0
starScore += (upperRatio > 60 ? 30.0 : upperRatio > 40 ? 15.0 : 0.0)
starScore += (lowerRatio < 10 ? 25.0 : lowerRatio < 20 ? 10.0 : 0.0)
starScore += (bodyRatio < 35 ? 20.0 : bodyRatio < 45 ? 10.0 : 0.0)
starScore += (closePos < 35 ? 15.0 : closePos < 50 ? 8.0 : 0.0)
starScore += (volRelative > 120 ? 10.0 : 0.0)
bool isStar = starScore >= minConfidence
// Yutan Boπa (Bullish Engulfing) Skoru
float engulfBullScore = 0.0
float prevBody = math.abs(close[1] - open[1])
engulfBullScore += (isBullish and isBearish[1] and bodySize > prevBody ? 35.0 : 0.0)
engulfBullScore += (close > open[1] and open < close[1] ? 25.0 : 0.0)
engulfBullScore += (bodyRatio > 60 ? 15.0 : bodyRatio > 45 ? 8.0 : 0.0)
engulfBullScore += (volRelative > 110 ? 15.0 : volRelative > 90 ? 5.0 : 0.0)
engulfBullScore += (rangeVsAtr > 80 ? 10.0 : 0.0)
bool isEngulfBull = engulfBullScore >= minConfidence
// Yutan Ayύ (Bearish Engulfing) Skoru
float engulfBearScore = 0.0
engulfBearScore += (isBearish and isBullish[1] and bodySize > prevBody ? 35.0 : 0.0)
engulfBearScore += (close < open[1] and open > close[1] ? 25.0 : 0.0)
engulfBearScore += (bodyRatio > 60 ? 15.0 : bodyRatio > 45 ? 8.0 : 0.0)
engulfBearScore += (volRelative > 110 ? 15.0 : volRelative > 90 ? 5.0 : 0.0)
engulfBearScore += (rangeVsAtr > 80 ? 10.0 : 0.0)
bool isEngulfBear = engulfBearScore >= minConfidence
bool isBullPattern = isHammer or isEngulfBull
bool isBearPattern = isStar or isEngulfBear
// SAVAή BΦLGESέ FέLTRESέ (Zύrha Temas Var Mύ?)
float cloudTop = math.max(trail, aktif_zirh)
float cloudBot = math.min(trail, aktif_zirh)
bool touchesCloud = (low <= cloudTop and high >= cloudBot)
// Gizli Tetik: Mum hem dφnόώ mumu olacak, HEM DE Kalkan/Zύrh ile temas edecek!
bool dnaBullTrigger = isBullPattern and touchesCloud
bool dnaBearTrigger = isBearPattern and touchesCloud
// ─────────────────────────────────────────────────────────────────
// 6. YέN-YANG, YΦRάK VE MUM RENKLERέ
// ─────────────────────────────────────────────────────────────────
f_ozel_sar(src_h, src_l, _start, _inc, _max, _reset) =>
var int trend = 0
var float sar_v = 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_v := trend > 0 ? src_l[1] : src_h[1]
ep := trend > 0 ? src_h[1] : src_l[1]
af := _start
else
if _reset
af := _start
float n_sar = sar_v
if trend > 0
if src_h[1] > ep
ep := src_h[1]
af := math.min(_max, af + _inc)
n_sar := sar_v + af * (ep - sar_v)
n_sar := math.min(math.min(src_l[1], src_l[2]), n_sar)
if n_sar > src_l
trend := -1
n_sar := ep
ep := src_l
af := _start
else
if src_l[1] < ep
ep := src_l[1]
af := math.min(_max, af + _inc)
n_sar := sar_v + af * (ep - sar_v)
n_sar := math.max(math.max(src_h[1], src_h[2]), n_sar)
if n_sar < src_h
trend := 1
n_sar := ep
ep := src_h
af := _start
sar_v := n_sar
[sar_v, trend]
[sar_hizli, tr_hizli] = f_ozel_sar(high, low, h_start, h_inc, h_max, ta.change(time("D")) != 0)
[sar_yavas, tr_yavas] = f_ozel_sar(high, low, y_start, y_inc, y_max, ta.change(time("D")) != 0)
cc = ta.sar(0.01, 0.02, 0.2)
color col_ana = kral_yon ? color.lime : color.red
color col_yoruk = close > cc ? color.lime : color.red
bool ahenk_boga = (tr_hizli > 0) and (tr_yavas > 0)
bool ahenk_ayi = (tr_hizli < 0) and (tr_yavas < 0)
barcolor(ahenk_boga ? color.lime : ahenk_ayi ? color.red : color.new(color.gray, 60))
// ─────────────────────────────────────────────────────────────────
// 7. ΗέZέMLER (MέNέMALέST EKRAN + GέZLέ TETέK)
// ─────────────────────────────────────────────────────────────────
// 1. ZIRH VE RMDT KALKANI (Sade Bulut)
p_mats = plot(aktif_zirh, title="MATS Omurga", color=color.new(col_ana, 40), linewidth=3)
p_trail = plot(trail, title="RMDT Kalkan", color=col_ana, linewidth=1, style=plot.style_linebr)
fill(p_mats, p_trail, color=color.new(col_ana, 85), title="Adaptif Zύrh Bulutu")
// 2. YΦRάK SAR
plot(cc, "@yφrόk@", color=col_yoruk, style=plot.style_cross, linewidth=2)
// 3. DNA GέZLέ TETέK έήARETLERέ (Sadece zύrha ηarpan dφnόώ mumlarύnda yanar)
plotshape(dnaBullTrigger, title="DNA Boπa Reddi", style=shape.triangleup, location=location.belowbar, color=#00d4ff, size=size.tiny)
plotshape(dnaBearTrigger, title="DNA Ayύ Reddi", style=shape.triangledown, location=location.abovebar, color=#ff2d78, size=size.tiny)
// Alarmlar
alertcondition(dnaBullTrigger, "DNA Boπa Dφnόώό!", "Yφrόk: Fiyat Kalkan'a ηarptύ ve kusursuz bir Boπa Mumu bύraktύ (AL Tetiπi).")
alertcondition(dnaBearTrigger, "DNA Ayύ Dφnόώό!", "Yφrόk: Fiyat Kalkan'a ηarptύ ve kusursuz bir Ayύ Mumu bύraktύ (SAT Tetiπi).")
Yer έmleri