PHP Code://@version=6
strategy(":] Öz ST + Mizan 100 (Çıkış Disiplini)", overlay=true, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.04)
// ==========================================
// 1. AYARLAR
// ==========================================
float ayar_genislik = input.float(1.0, "Ana Atmosfer Çarpanı", minval=0.1, maxval=2.0, step=0.1)
// ==========================================
// 2. ÇIKIŞ DİSİPLİNİ AYARLARI (YENİ)
// ==========================================
float tp_carpan = input.float(1.5, "Kâr Al (TP) Çarpanı", step=0.1, group="Çıkış Disiplini", tooltip="İşleme girerkenki atmosferin kaç katı kâr hedeflensin?")
float sl_carpan = input.float(1.0, "Zarar Kes (SL) Çarpanı", step=0.1, group="Çıkış Disiplini", tooltip="İşleme girerkenki atmosferin kaç katı terste kalınca işlem kapatılsın?")
// ==========================================
// 3. MOTOR BLOKLARI (PARAMETRELER)
// ==========================================
float s_fast_1 = ta.sar(0.08, 0.05, 0.2)
float s_fast_2 = ta.sar(0.01, 0.05, 0.2)
float s_fast_3 = ta.sar(0.04, 0.04, 0.2)
float avg_fast = (s_fast_1 + s_fast_2 + s_fast_3) / 3
// ==========================================
// 4. YAPAY ZEKA (DL) ATMOSFERİ (GENİŞLİK HESABI)
// ==========================================
tanh_fn(v) => (1 - math.exp(-2 * v)) / (1 + math.exp(-2 * v))
td_fn(s) => nz((s - nz(s[1])) / nz(s[1]))
var w_c = array.from(22.4271, -26.6917, 4.9371, 9.0349, -10.6929, -38.2880, 10.0500, -44.7063, -17.8163, 30.5662, -33.9954, 14.5017, -43.2865, -13.3874, 24.7080, -14.3929, 28.4830, -22.9793, -7.6582, -5.6505, 28.8379, -26.3544, 0.5206, 25.0049, -17.8832, -4.8113, -4.0364, -8.3327, -1.1571, 0.4667, -22.0533, 3.6525, -4.3904, 2.1030, 20.0272, 11.5101, -0.4150)
n_in = array.from(tanh_fn(td_fn(open)), tanh_fn(td_fn(high)), tanh_fn(td_fn(low)), tanh_fn(td_fn(close)))
f_calc_dl(n_arr, w_arr) =>
float out = 0.0
for i = 0 to 5
float s = 0.0
for j = 0 to 3
s += array.get(n_arr, j) * array.get(w_arr, (i * 5) + j)
out += tanh_fn(s + array.get(w_arr, (i * 5) + 4)) * array.get(w_arr, 30 + i)
tanh_fn(out + array.get(w_arr, 36))
float dl_val = f_calc_dl(n_in, w_c)
float ai_factor = (0.2 + (math.abs(dl_val) * 0.5)) * ayar_genislik
// Atmosferik Sınır (Kalkan Genişliği)
float dist_base = math.abs(close - s_fast_1) * ai_factor
float dist_swing = dist_base * 2.0
// ==========================================
// 5. MİZAN 100 (KADİM EKSEN)
// ==========================================
f_hakiki_mizan(_sar, _sm) =>
float _delta = math.abs(close - _sar)
float _raw = close > _sar ? close + _delta : close - _delta
float _mirror = ta.hma(_raw, _sm)
bool _dondu_asagi = _mirror < _mirror[1] and _mirror[1] > _mirror[2]
bool _dondu_yukari = _mirror > _mirror[1] and _mirror[1] < _mirror[2]
var float _tepe = na
var float _dip = na
if _dondu_asagi
_tepe := _mirror[1]
if _dondu_yukari
_dip := _mirror[1]
(_tepe + _dip) / 2
float mizan_100 = f_hakiki_mizan(s_fast_1, 100)
plot(mizan_100, "Mizan 100 (Ana Eksen)", color=color.new(color.fuchsia, 0), linewidth=4)
// ==========================================
// 6. ÖZ ÇEKİRDEK SUPERTREND (HIZLI GEZEGEN)
// ==========================================
float ust_band = avg_fast + dist_swing
float alt_band = avg_fast - dist_swing
var int oz_st_yon = 1
var float oz_st_cizgi = na
if oz_st_yon == 1
oz_st_cizgi := math.max(nz(oz_st_cizgi[1], alt_band), alt_band)
if close < oz_st_cizgi
oz_st_yon := -1
oz_st_cizgi := ust_band
else
oz_st_cizgi := math.min(nz(oz_st_cizgi[1], ust_band), ust_band)
if close > oz_st_cizgi
oz_st_yon := 1
oz_st_cizgi := alt_band
bool mizan_AL_onayi = close > mizan_100
bool mizan_SAT_onayi = close < mizan_100
// SuperTrend Renginin Mizan'a İtaat Etmesi
color oz_st_renk = (oz_st_yon == 1 and mizan_AL_onayi) ? color.new(color.lime, 0) :
(oz_st_yon == -1 and mizan_SAT_onayi) ? color.new(color.red, 0) :
color.new(color.gray, 80)
plot(oz_st_cizgi, "Öz SuperTrend", color=oz_st_renk, style=plot.style_stepline, linewidth=2)
// ==========================================
// 7. KUSURSUZ İTTİFAK SİNYALLERİ
// ==========================================
bool st_AL_kesti = oz_st_yon == 1 and oz_st_yon[1] == -1
bool st_SAT_kesti = oz_st_yon == -1 and oz_st_yon[1] == 1
bool ittifak_AL = st_AL_kesti and mizan_AL_onayi
bool ittifak_SAT = st_SAT_kesti and mizan_SAT_onayi
plotshape(ittifak_AL, title="MİZAN+ST AL", text="ST+M100\nAL", style=shape.labelup, location=location.belowbar, color=color.rgb(0, 230, 119), textcolor=color.white, size=size.normal)
plotshape(ittifak_SAT, title="MİZAN+ST SAT", text="ST+M100\nSAT", style=shape.labeldown, location=location.abovebar, color=color.rgb(255, 82, 82), textcolor=color.white, size=size.normal)
// ==========================================
// 8. SAVAŞ MEYDANI VE DİNAMİK ÇIKIŞ EMİRLERİ
// ==========================================
// İşleme girdiğimiz andaki atmosfer genişliğini hafızaya al
var float kayitli_mesafe = na
if ittifak_AL or ittifak_SAT
kayitli_mesafe := dist_swing
if ittifak_AL
strategy.entry("Kusursuz_AL", strategy.long)
if ittifak_SAT
strategy.entry("Kusursuz_SAT", strategy.short)
// Şahini Geri Çağırma (Dinamik TP / SL)
if strategy.position_size > 0
float sl_seviyesi = strategy.opentrades.entry_price(0) - (kayitli_mesafe * sl_carpan)
float tp_seviyesi = strategy.opentrades.entry_price(0) + (kayitli_mesafe * tp_carpan)
strategy.exit("AL_Kapat", from_entry="Kusursuz_AL", limit=tp_seviyesi, stop=sl_seviyesi)
if strategy.position_size < 0
float sl_seviyesi = strategy.opentrades.entry_price(0) + (kayitli_mesafe * sl_carpan)
float tp_seviyesi = strategy.opentrades.entry_price(0) - (kayitli_mesafe * tp_carpan)
strategy.exit("SAT_Kapat", from_entry="Kusursuz_SAT", limit=tp_seviyesi, stop=sl_seviyesi)
// İMZA
var table ytd_table = table.new(position.bottom_center, 1, 1)
if barstate.islast
table.cell(ytd_table, 0, 0, "(Aİ) eğitim çalışmasıdır. Yatırım tavsiyesi KULLANILAMAZ.", text_color=color.new(color.white, 50), text_size=size.small)

Alıntı yaparak yanıtla
Yer İmleri