Untitled
unknown
plain_text
19 days ago
4.9 kB
4
Indexable
// Kullanıcı Ayarı - Tabloyu Göster/Gizle show_table = input.bool(defval=true, title="Tabloyu Göster") // Değişken tanımlamaları var float peakEquity = na var float maxDrawdownValue = 0.0 var float maxDrawdownPercent = 0.0 var float firstTradePrice = na var table tablePerformance = table.new(position=position.bottom_right, columns=2, rows=10, border_color=color.gray, border_width=2, bgcolor=color.rgb(0, 0, 0), frame_color=color.rgb(71, 71, 71), frame_width=1) // 📌 Metrikler Hesaplamaları totalTrades = strategy.closedtrades openTrades = strategy.opentrades closedTrades = totalTrades - openTrades winTrades = strategy.wintrades loseTrades = strategy.losstrades netProfit = strategy.netprofit initialCapital = strategy.initial_capital netProfitPercent = (netProfit / initialCapital) * 100 profitFactor = strategy.grossloss == 0 ? na : math.abs(strategy.grossprofit / strategy.grossloss) percentProfitable = totalTrades == 0 ? na : (winTrades / totalTrades) * 100 // Drawdown hesaplamaları peakEquity := na(peakEquity) ? strategy.equity : math.max(peakEquity, strategy.equity) drawdown = peakEquity - strategy.equity if drawdown > maxDrawdownValue maxDrawdownValue := drawdown maxDrawdownPercent := (drawdown / peakEquity) * 100 // Buy & Hold hesaplamaları if na(firstTradePrice) and strategy.position_size != 0 firstTradePrice := close buyHoldReturnPercent = na(firstTradePrice) ? na : ((close - firstTradePrice) / firstTradePrice) * 100 buyHoldReturnAmount = na(firstTradePrice) ? na : ((close / firstTradePrice) * initialCapital) - initialCapital // Eğer yeni bir maksimum kayıp oluşursa güncelle if drawdown > maxDrawdownValue maxDrawdownValue := drawdown maxDrawdownPercent := (maxDrawdownValue / peakEquity) * 100 // Yüzde olarak hesapla // 🔹 **Buy & Hold Getirisi (Tutar ve Yüzde)** if na(firstTradePrice) and strategy.position_size != 0 firstTradePrice := close // İlk işlem anındaki kapanış fiyatını al // Tabloya Ekleme if (bar_index % 5 == 0) and show_table // Strateji İsmi table.cell(tablePerformance, 0, 0, "⚙️ STRATEJİ: Kule 2TP ORJ", bgcolor=color.rgb(27, 27, 27), text_color=color.white) // Net Kâr + Yüzdesi table.cell(tablePerformance, 0, 1, "NET KAZANÇ", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 1, str.tostring(netProfit, "#.##") + " TRY (" + str.tostring(netProfitPercent, "#.##") + "%)", bgcolor=netProfit > 0 ? color.rgb(0, 150, 0) : color.rgb(150, 0, 0), text_color=color.white) // Maksimum Kayıp + Yüzdesi table.cell(tablePerformance, 0, 2, "MAKS. KAYIP", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 2, str.tostring(maxDrawdownValue, "#.##") + " TRY (" + str.tostring(maxDrawdownPercent, "#.##") + "%)", bgcolor=color.rgb(150, 0, 0), text_color=color.white) // Karlılık Oranı table.cell(tablePerformance, 0, 3, "KARLI %", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 3, str.tostring(percentProfitable, "#.##") + "%", bgcolor=color.rgb(0, 0, 150), text_color=color.white) // Al Tut table.cell(tablePerformance, 0, 4, "AL TUT", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 4, str.tostring(buyHoldReturnAmount, "#.##") + " TRY (" + str.tostring(buyHoldReturnPercent, "#.##") + "%)", bgcolor=buyHoldReturnAmount > 0 ? color.rgb(0, 150, 0) : color.rgb(150, 0, 0), text_color=color.white) // Kazanç Katsayısı table.cell(tablePerformance, 0, 5, "KAZANÇ KTS.", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 5, str.tostring(profitFactor, "#.##"), bgcolor=color.rgb(0, 0, 150), text_color=color.white) // Açık Pozisyonlar table.cell(tablePerformance, 0, 6, "AÇIK PZS.", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 6, str.tostring(openTrades), bgcolor=color.rgb(0, 0, 150), text_color=color.white) // Kapanmış Pozisyonlar table.cell(tablePerformance, 0, 7, "KAPANMIŞ PZS.", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 7, str.tostring(closedTrades), bgcolor=color.rgb(0, 0, 150), text_color=color.white) // Kazançlı Pozisyonlar table.cell(tablePerformance, 0, 8, "KARLI İŞL.", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 8, str.tostring(winTrades), bgcolor=color.rgb(0, 150, 0), text_color=color.white) // Kayıplı Pozisyonlar table.cell(tablePerformance, 0, 9, "ZARARLI İŞL.", bgcolor=color.rgb(27, 27, 27), text_color=color.white) table.cell(tablePerformance, 1, 9, str.tostring(loseTrades), bgcolor=color.rgb(150, 0, 0), text_color=color.white)
Editor is loading...
Leave a Comment