Untitled
unknown
plain_text
2 months ago
3.7 kB
3
Indexable
// Kullanıcı Ayarı - Tabloyu Göster/Gizle show_table = input.bool(defval=true, title="Tabloyu Göster") // Tablo Tanımlama var table tablePerformance = table.new(position=position.bottom_right, columns=10, rows=10, border_width=2) // 📌 **Metrikler Hesaplamaları** 📌 // 🔹 **İşlem Sayıları** totalTrades = strategy.closedtrades openTrades = strategy.opentrades closedTrades = totalTrades - openTrades winTrades = strategy.wintrades loseTrades = strategy.losstrades // 🔹 **Net Kâr ve Yüzdesi** netProfit = strategy.netprofit initialCapital = strategy.initial_capital netProfitPercent = (netProfit / initialCapital) * 100 // 🔹 **Kazanç Katsayısı (Profit Factor)** profitFactor = strategy.grossloss == 0 ? na : strategy.grossprofit / strategy.grossloss // 🔹 **Karlılık Yüzdesi** percentProfitable = totalTrades == 0 ? na : (winTrades / totalTrades) * 100 var float peakEquity = na var float maxDrawdownValue = 0.0 var float maxDrawdownPercent = 0.0 // En yüksek özsermaye noktasını takip et peakEquity := na(peakEquity) ? strategy.equity : math.max(peakEquity, strategy.equity) // Güncel düşüşü hesapla drawdown = peakEquity - strategy.equity // Eğer yeni bir maksimum kayıp oluşursa güncelle if drawdown > maxDrawdownValue maxDrawdownValue := drawdown maxDrawdownPercent := (maxDrawdownValue / peakEquity) * 100 // Yüzde olarak hesapla // 📌 **Tabloya Ekleme** 📌 if (bar_index % 5 == 0) and show_table // ✅ **Net Kâr + Yüzdesi** table.cell(tablePerformance, 1, 0, "NET KAZANÇ", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 1, 1, str.tostring(netProfit, format.volume) + " TRY (" + str.tostring(netProfitPercent, format.percent) + ")", bgcolor=color.blue, text_color=color.white) // ✅ **Maksimum Kayıp + Yüzdesi** table.cell(tablePerformance, 2, 0, "MAKS. KAYIP", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 2, 1, str.tostring(maxDrawdownValue, format.volume) + " TRY (" + str.tostring(maxDrawdownPercent, format.percent) + ")", bgcolor=color.red, text_color=color.white) // ✅ **Karlılık Oranı** table.cell(tablePerformance, 3, 0, "KARLI %", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 3, 1, str.tostring(percentProfitable, format.percent), bgcolor=color.blue, text_color=color.white) // ✅ **Kazanç Katsayısı** table.cell(tablePerformance, 4, 0, "KAZANÇ KTS.", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 4, 1, str.tostring(profitFactor, "#.##"), bgcolor=color.blue, text_color=color.white) // ✅ **Açık Pozisyonlar** table.cell(tablePerformance, 5, 0, "AÇIK PZS.", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 5, 1, str.tostring(openTrades), bgcolor=color.blue, text_color=color.white) // ✅ **Kapanmış Pozisyonlar** table.cell(tablePerformance, 6, 0, "KAPANMIŞ PZS.", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 6, 1, str.tostring(closedTrades), bgcolor=color.blue, text_color=color.white) // ✅ **Kazançlı Pozisyonlar** table.cell(tablePerformance, 7, 0, "KAZANÇLI PZS.", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 7, 1, str.tostring(winTrades), bgcolor=color.green, text_color=color.white) // ✅ **Kayıplı Pozisyonlar** table.cell(tablePerformance, 8, 0, "KAYIPLI PZS.", bgcolor=color.black, text_color=color.white) table.cell(tablePerformance, 8, 1, str.tostring(loseTrades), bgcolor=color.red, text_color=color.white)
Editor is loading...
Leave a Comment