// ***************************************************************************** // 1. İşlem Dönemi: Son 6 Ay // timenow milisaniye cinsinden güncel zamanı verir. 6 ay ≈ 15778800000 ms (ortalama 6x30.44 gün) sixMonthsAgo = timenow - 15778800000 allowedTrade = time >= sixMonthsAgo // Sadece son 6 ay içindeki barlarda işlem yap
// ***************************************************************************** // 2. Teknik Göstergeler ve Parametre Ayarları
// ***************************************************************************** // 3. Piyasa Trend Analizi // Genel trend, günlük, haftalık ve aylık EMA değerleri üzerinden yorumlanır. trendUp = (close > emaShort) and (close > emaLong) and (close > emaWeekly) and (close > emaMonthly) trendDown = (close < emaShort) and (close < emaLong) and (close < emaWeekly) and (close < emaMonthly)
// ***************************************************************************** // 4. Giriş ve Çıkış Sinyalleri // Alım: Yukarı yönlü trend, MACD’nin yukarı kesişimi, ADX’in güçlü trend sinyali ve fiyatın PSAR’ın üzerinde oluşması // Satım: Aşağı yönlü trend, MACD’nin aşağı kesişimi, ADX’in güçlü trend sinyali ve fiyatın PSAR’ın altında oluşması
longCondition = allowedTrade and trendUp and ta.crossover(macdLine, signalLine) and (adxValue > adxThreshold) and (rsiValue < rsiOverbought) and (close > psarValue) shortCondition = allowedTrade and trendDown and ta.crossunder(macdLine, signalLine) and (adxValue > adxThreshold) and (rsiValue > rsiOversold) and (close < psarValue)
// ***************************************************************************** // 5. Risk Yönetimi ve Pozisyon Büyüklüğü // ATR tabanlı stop loss ve take profit atrPeriod = input.int(14, "ATR Periyodu") atrMultiplierSL = input.float(2.0, "ATR Stop Loss Çarpanı") atrMultiplierTP = input.float(3.0, "ATR Take Profit Çarpanı") atrValue = ta.atr(atrPeriod)
// İşlem girişlerinde, pozisyon açıldıktan sonra otomatik olarak stop loss ve take profit seviyeleri belirlenir. if (longCondition) strategy.entry("Long", strategy.long) strategy.exit("Long Exit", "Long", stop = close - atrMultiplierSL * atrValue, limit = close + atrMultiplierTP * atrValue)
if (shortCondition) strategy.entry("Short", strategy.short) strategy.exit("Short Exit", "Short", stop = close + atrMultiplierSL * atrValue, limit = close - atrMultiplierTP * atrValue)
// ***************************************************************************** // 6. Grafiksel Gösterimler ve Raporlama
plot(emaShort, color=color.blue, title="EMA 20") plot(emaLong, color=color.orange, title="EMA 50") plot(psarValue, style=plot.style_circles, color=color.red, title="Parabolic SAR") plot(bbBasis, color=color.gray, title="BB Temel (SMA)") plot(upperBB, color=color.green, title="BB Üst Bant") plot(lowerBB, color=color.green, title="BB Alt Bant")
// ***************************************************************************** // 7. Notlar ve Açıklamalar // - Bu strateji, son 6 ayı kapsayacak şekilde filtreleme yapmaktadır. // - Giriş/çıkış sinyalleri, trendin güçlü olduğu durumları hedefleyip, çoklu teknik gösterge kombinasyonu ile teyit edilmektedir. // - Risk yönetimi, ATR tabanlı dinamik stop loss ve take profit seviyeleri ile sağlanmaktadır. // - Stratejiyi çalıştırmadan önce, farklı zaman dilimlerinde ve semboller üzerinde optimizasyon yapmanız önerilir.