PHP Code://@version=5
indicator("Yörük [Sistem 1: Renk Zýrhý]", overlay=true, max_lines_count=500, max_labels_count=500)
// ─────────────────────────────────────────────────────────────────
// 1. TEMEL MATEMATÝKSEL FONKSÝYONLAR
// ─────────────────────────────────────────────────────────────────
bool_to_float(bool source) => source ? 1 : 0
ema(source)=>
var float ema = 0.0
var int count = 0
count := nz(count[1]) + 1
ema := (1.0 - 2.0 / (count + 1.0)) * nz(ema[1]) + 2.0 / (count + 1.0) * source
ema
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
// MATS Hesaplama Fonksiyonu
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 = 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 or ll), _len), 2)
smooth := nz(smooth[1] + tc * (src - smooth[1]), src)
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. MATS MOTORLARI (34, 55, 89)
// ─────────────────────────────────────────────────────────────────
mats_34 = f_mats(34)
mats_55 = f_mats(55)
mats_89 = f_mats(89)
// ─────────────────────────────────────────────────────────────────
// 3. MUM BOYAMA (RENK MANTIÐI)
// ─────────────────────────────────────────────────────────────────
color durum_rengi = na
if close > mats_34
durum_rengi := color.new(#00E676, 0) // YEÞÝL: 34 Üstü (Güvenli Bölge)
else if close <= mats_34 and close >= mats_55
durum_rengi := color.new(color.yellow, 0) // SARI: 34-55 Arasý (Dikkat/Yavaþlama)
else if close < mats_89
durum_rengi := color.new(#FF1744, 0) // KIRMIZI: 89 Altý (Düþüþ/Tehlike)
else
durum_rengi := color.new(color.gray, 0) // GRÝ: 55-89 Arasý (Uçurum Kenarý / Nötr)
// Grafikteki mumlarý renklendirir
barcolor(durum_rengi)
// ─────────────────────────────────────────────────────────────────
// 4. ÇÝZGÝLER (Görsel Destek)
// ─────────────────────────────────────────────────────────────────
plot(mats_34, "MATS 34", color=color.new(#00E676, 0), linewidth=1)
plot(mats_55, "MATS 55", color=color.new(color.yellow, 0), linewidth=1)
plot(mats_89, "MATS 89 (Zýrh)", color=color.new(#FF1744, 0), linewidth=2)


Alýntý yaparak yanýtla
Yer Ýmleri