Untitled
unknown
plain_text
2 months ago
47 kB
4
Indexable
//@version=5 //@strategy_alert_message {{strategy.order.alert_message}} strategy('Kule Trend Strategy Long Multi 3TP' , shorttitle = 'Kule Trend Strategy Long Multi 3TP' , overlay = true) // , initial_capital = 10000 // , default_qty_type = strategy.fixed // , default_qty_value = 500 // , pyramiding = 0 // , commission_value = 0.03 // , commission_type = strategy.commission.percent) tutar = input.float(title="Tutar (TL)", defval=10000, minval=1) var float islemLotu = na var float sonGirisLotu = na var int pozisyonDurumu = 0 lotHesapla() => math.floor(tutar / close) APIKEY = input.string(title="API Key", defval="") // Date Input Parameters startDate = input.time(timestamp("2024-08-01"), "Start Date") endDate = input.time(timestamp("2025-12-31"), "End Date") // ---------------------------- Theme --------------------------------------- // // Colors red = color.red green = color.rgb(21, 194, 122) brightred = color.rgb(158, 43, 35) brightgreen = color.rgb(21, 194, 122) cautioncol = color.yellow gray= color.gray aqua = color.aqua orange= color.orange darkgreen = color.rgb(21, 194, 122) darkred = color.rgb(165, 57, 66) // Groups grma = "📈 Moving Averages 📈" grhts = "Trend Seviyeleri" grt = "DCA" grll = "🩸 Leverage Liquidations 🩸" gla= "🔔 Alerts 🔔" // Constants dataType = "Custom" instructions = "Off" smaS = "Off" constant = 1>0 rsi=ta.rsi(close,14) fastLength = 12 slowLength = 26 signalLength = 9 [macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalLength) macdAboveZero = macdLine > signalLine // ------------------------- Trend State ------------------------------------ // // Code Author: © Koalafied_3 showtrend = true showbc = input(true, title='Bar Boyama Göster?',group=grhts) ts1 = 66 ts2 = 33 ts1a = 61 ts2a = 39 // Trend State var state = 0 if ta.crossover(rsi, ts1) state := 1 state if ta.crossunder(rsi, ts2) state := 2 state state := state //-----------------3 State RSI Gradient Bar Color on Chart--------------------// cbullu = brightgreen cbulld = darkgreen cbearu = brightred cbeard = darkred cbearc = brightgreen cbullc = brightred barcolor(state==1 and rsi>50?cbullu: state==1 and rsi<50?cbulld: state==2 and rsi<50 ?cbearu: state==2 and rsi>50 ?cbeard:color.new(color.from_gradient(rsi, ts2, ts1, cbearu, cbullu),0),title="Chart Bar Color", display = showbc ? display.all : display.none, editable=false) // RSI 50 Line // @ LazyBear obLevelM = 50 src = close length = 14 ep = 2 * length - 1 auc = ta.ema(math.max(src - src[1], 0), ep) adc = ta.ema(math.max(src[1] - src, 0), ep) x7 = (length - 1) * (adc * obLevelM / (100 - obLevelM) - auc) ub4 = x7 >= 0 ? src + x7 : src + x7 * (100 - obLevelM) / obLevelM plot(ub4, title='Rsn Mov', color=color.new(ub4>ub4[1]?color.green:ub4<ub4[1]?color.red:color.white, 25), linewidth=3,display = display.none) // ---------------------------- Trade Setup --------------------------------- // // Inspired by @ KioseffTrading lot_size = 1 dcaorstop = "DCA 3" // Number of Decimals for Labels pricedecimals= 2 truncateprice(number, pricedecimals) => factor = math.pow(10, pricedecimals) int(number * factor) / factor // Define a bull/bear cross bullcross= state==1 and state[1]==2 bearcross= state==2 and state[1]==1 // Detect what was last signal (long or short) long_short = 0 long_last = bullcross and (nz(long_short[1]) == 0 or nz(long_short[1]) == -1) short_last = bearcross and (nz(long_short[1]) == 0 or nz(long_short[1]) == 1) long_short := long_last ? 1 : short_last ? -1 : long_short[1] // Remove first bar for SL/TP (you can't enter a trade at bar close and THEN hit your SL on that same bar) longBar1 = ta.barssince(long_last) longBar2 = longBar1 >= 1 ? true : false shortBar1 = ta.barssince(short_last) shortBar2 = shortBar1 >= 1 ? true : false // Wen entry, sir? bullentry = ta.valuewhen(bullcross, close, 0) bearentry = ta.valuewhen(bearcross, close, 0) entin= state==1 and long_short==1?bullentry:state==2 and long_short==-1?bearentry:na entout=plot(entin, 'Giriş', color=color.new(color.green, 0), style=plot.style_circles, editable=false) // Targets // ATR TP & SL // ATR hesaplama yöntemi için seçenekler atr_method = 'hl2' // ATR kaynağı (srcATR) - Kullanıcının seçimine göre hesaplanır var float srcATR = na if atr_method == "close" srcATR := close else if atr_method == "hl2" srcATR := (high + low) / 2 else if atr_method == "hlc3" srcATR := (high + low + close) / 3 // ATR periyodu atrPeriod = 55 per = atrPeriod // ATR çarpanı atrMultiplier = 3 // ATR hesaplama atr_value = ta.atr(per) // ATR çarpanı ile çarpılmış değer atr_multiplied = atr_value * atrMultiplier atr = ta.atr(atrPeriod) ATRupper=srcATR + atr * atrMultiplier ATRlower=srcATR - atr * atrMultiplier ATRupper2=srcATR + atr * (atrMultiplier*8) ATRlower2=srcATR - atr * (atrMultiplier*8) ATRupper3=srcATR + atr * (atrMultiplier*3) ATRlower3=srcATR - atr * (atrMultiplier*3) ATRupper4=srcATR + atr * (atrMultiplier*2) ATRlower4=srcATR - atr * (atrMultiplier*2) ATRupper5=srcATR + atr * (atrMultiplier*0.5) ATRlower5=srcATR - atr * (atrMultiplier*0.5) ATRupper6=srcATR + atr * (atrMultiplier*0.382) ATRlower6=srcATR - atr * (atrMultiplier*0.382) ATRupper7=srcATR + atr * (atrMultiplier*0.236) ATRlower7=srcATR - atr * (atrMultiplier*0.236) ATRupper8=srcATR + atr * (atrMultiplier*0.146) ATRlower8=srcATR - atr * (atrMultiplier*0.146) bearse=srcATR + atr * (atrMultiplier*0.146) bullse=srcATR - atr * (atrMultiplier*0.146) bearse2=srcATR + atr * (atrMultiplier*0.236) bullse2=srcATR - atr * (atrMultiplier*0.236) bearse3=srcATR + atr * (atrMultiplier*0.5) bullse3=srcATR - atr * (atrMultiplier*0.5) ATRbulltp1=ta.valuewhen(bullcross,ATRupper,0) ATRbeartp1=ta.valuewhen(bearcross,ATRlower,0) ATRbulltp2=ta.valuewhen(bullcross,ATRupper2,0) ATRbeartp2=ta.valuewhen(bearcross,ATRlower2,0) ATRbulltp3=ta.valuewhen(bullcross,ATRupper3,0) ATRbeartp3=ta.valuewhen(bearcross,ATRlower3,0) ATRbulltp4=ta.valuewhen(bullcross,ATRupper4,0) ATRbeartp4=ta.valuewhen(bearcross,ATRlower4,0) ATRbulltp5=ta.valuewhen(bullcross,ATRupper5,0) ATRbeartp5=ta.valuewhen(bearcross,ATRlower5,0) ATRbulltp6=ta.valuewhen(bullcross,ATRupper6,0) ATRbeartp6=ta.valuewhen(bearcross,ATRlower6,0) ATRbulltp7=ta.valuewhen(bullcross,ATRupper7,0) ATRbeartp7=ta.valuewhen(bearcross,ATRlower7,0) ATRbulltp8=ta.valuewhen(bullcross,ATRupper8,0) ATRbeartp8=ta.valuewhen(bearcross,ATRlower8,0) vwbearse=ta.valuewhen(bearcross,bearse,0) vwbullse=ta.valuewhen(bullcross,bullse,0) vwbearse2=ta.valuewhen(bearcross,bearse2,0) vwbullse2=ta.valuewhen(bullcross,bullse2,0) vwbearse3=ta.valuewhen(bearcross,bearse3,0) vwbullse3=ta.valuewhen(bullcross,bullse3,0) bgrad = 80 tgrad = 95 exin = state==1 and long_short==1?ATRbulltp1:state==2 and long_short==-1?ATRbeartp1:na excol = long_short == 1 and close<ATRbulltp1?green: long_short==-1 and close>ATRbeartp1?red:color.yellow exout = plot(exin, 'Kar AL', color=color.new(excol, 0), style=plot.style_circles, editable=false) dca3in=state==1 and long_short==1?vwbullse3:state==2 and long_short==-1?vwbearse3:na dca3out=plot(dca3in, "Stop", color=color.new(color.red, 0), style=plot.style_circles, editable=false) // Trade Setup Labels // Profit bullt1profit=(((ATRbulltp1/bullentry)- 1)*100) beart1profit=((1-(bearentry/ATRbeartp1))*-100) bullt2profit=(((ATRbulltp2/bullentry)- 1)*100) beart2profit=((1-(bearentry/ATRbeartp2))*-100) bullt3profit=(((ATRbulltp3/bullentry)- 1)*100) beart3profit=((1-(bearentry/ATRbeartp3))*-100) bullt4profit=(((ATRbulltp4/bullentry)- 1)*100) beart4profit=((1-(bearentry/ATRbeartp4))*-100) bullt5profit=(((ATRbulltp5/bullentry)- 1)*100) beart5profit=((1-(bearentry/ATRbeartp5))*-100) bullt6profit=(((ATRbulltp6/bullentry)- 1)*100) beart6profit=((1-(bearentry/ATRbeartp6))*-100) bullt7profit=(((ATRbulltp7/bullentry)- 1)*100) beart7profit=((1-(bearentry/ATRbeartp7))*-100) bullt8profit=(((ATRbulltp8/bullentry)- 1)*100) beart8profit=((1-(bearentry/ATRbeartp8))*-100) //-----------------------------Liquidation levels-----------------------------// // @ mabonyi i_show_x1 = false i_nonlinear = false i_maintmargin = 0.05 maint_margin = 1 - i_maintmargin i_x1 = 100 i_showlast = 0 i_offset = 0 i_label_offset = 0 // Calculations f_leveraged(_price, _x) => _xlong = i_nonlinear ? _x + 1 : _x _xshort = i_nonlinear ? _x - 1 : _x _liq_long = _price * (1 - 1 / _xlong * maint_margin) _liq_short = _price * (1 + 1 / _xshort * maint_margin) [_liq_long, _liq_short] f_print(_y, _txt, _c) => t = time_close + (i_offset + i_label_offset) * timeframe.multiplier * 60 * 1000 var _lbl = label.new(t, _y, _txt, xloc.bar_time, yloc.price, color.white, label.style_none, _c, size.small) label.set_xy(_lbl, t, _y) label.set_text(_lbl, _txt) [x1_long, x1_short] = f_leveraged(close, i_x1) // Entry Liquidation Levels longLiquidation = ta.valuewhen(long_last, x1_long, 0) shortLiquidation = ta.valuewhen(short_last, x1_short, 0) // Liquidation Line Adaptive Coloring longliqlinecol = longLiquidation<vwbullse3 ? color.yellow:brightred shortliqlinecol = shortLiquidation>vwbearse3 ? color.yellow:brightred llcolout= long_short == 1 ? longliqlinecol : long_short==-1 ? shortliqlinecol : na // Liquidation Lines & Fill llin=long_short == 1 and i_show_x1 ? longLiquidation : long_short == -1 and i_show_x1 ? shortLiquidation : na llout=plot(llin, style=plot.style_circles, color=color.new(llcolout, 0), linewidth=1, title='Liquidation Level', editable=false) liqfiltopcol=long_short==1 and longLiquidation < vwbullse3 ? color.new(color.yellow,85) : long_short==-1 and shortLiquidation > vwbearse3 ? color.new(color.yellow,90) : na liqfilbotcol=long_short==1 and longLiquidation < vwbullse3 ? color.new(color.yellow,97) : long_short==-1 and shortLiquidation > vwbearse3 ? color.new(color.yellow,98) : na fill(llout,dca3out, long_short==1?longLiquidation: long_short==-1?shortLiquidation: na, long_short==1?vwbullse3: long_short==-1?vwbearse3: na, top_color=liqfiltopcol, bottom_color=liqfilbotcol) liqtip2 = i_show_x1 ? str.tostring(truncateprice(llin, pricedecimals)) : "None" // Liquidation Occured? longliqhit=(ta.crossunder(low, longLiquidation) or low<longLiquidation) and long_short==1 and i_show_x1 shortliqhit=(ta.crossover(high, shortLiquidation) or high>shortLiquidation) and long_short==-1 and i_show_x1 // Last Liquidations leverage= i_show_x1 ? i_x1 : 1 lastlliq = "💯 Leverage: " + str.tostring(leverage) + "x\n🩸 Long Liquidation: " + str.tostring(truncateprice(longLiquidation, pricedecimals)) + "\n📅 Last Long Liquidation: " + str.tostring(ta.barssince(longliqhit[1])) + " candles" lastsliq = "💯 Leverage: " + str.tostring(leverage) + "x\n🩸 Short Liquidation: " + str.tostring(truncateprice(shortLiquidation, pricedecimals)) + "\n📅 Last Short Liquidation: " + str.tostring(ta.barssince(shortliqhit[1])) + " candles" import HoanGhetti/SimpleTrendlines/4 as tl input_len = 20 input_pivotType = 'Normal' input_repaint = true input_targets = false input_bearC = input.color(defval = #af26266b, title = 'Bear Renk', group = 'Trend Çizimi') input_bullC = input.color(defval = #21972161, title = 'Bull Renk', group = 'Trend Çizimi') input_extend = extend.none input_style = line.style_dotted input_tstyle = line.style_dotted input_override = false input_useSrc = true input_source = low pl = fixnan(ta.pivotlow(input_override ? input_source : low, input_pivotType == 'Normal' ? input_len : 1, input_len)) ph = fixnan(ta.pivothigh(input_override ? input_source : high, input_pivotType == 'Normal' ? input_len : 1, input_len)) pivot(float pType) => pivot = pType == pl ? pl : ph xAxis = ta.valuewhen(ta.change(pivot), bar_index, 0) - ta.valuewhen(ta.change(pivot), bar_index, 1) prevPivot = ta.valuewhen(ta.change(pivot), pivot, 1) pivotCond = ta.change(pivot) and (pType == pl ? pivot > prevPivot : pivot < prevPivot) pData = tl.new(x_axis = xAxis, offset = input_len, strictMode = true, strictType = pType == pl ? 0 : 1) pData.drawLine(pivotCond, prevPivot, pivot, input_override ? input_source : na) pData breakout(tl.Trendline this, float pType) => var bool hasCrossed = false if ta.change(this.lines.startline.get_y1()) hasCrossed := false this.drawTrendline(not hasCrossed) confirmation = not hasCrossed and (input_repaint ? not hasCrossed : barstate.isconfirmed) if (pType == pl ? (input_override and input_useSrc ? input_source : close) < this.lines.trendline.get_y2() : (input_override and input_useSrc ? input_source : close) > this.lines.trendline.get_y2()) and confirmation hasCrossed := true this.lines.startline.set_xy2(this.lines.trendline.get_x2(), this.lines.trendline.get_y2()) this.lines.trendline.set_xy2(na, na) this.lines.startline.copy() hasCrossed plData = pivot(pl) phData = pivot(ph) style(tl.Trendline this, color col) => this.lines.startline.set_color(col), this.lines.trendline.set_color(col) this.lines.startline.set_width(2), this.lines.trendline.set_width(2) this.lines.trendline.set_style(input_style), this.lines.trendline.set_extend(input_extend) style(plData, input_bearC), style(phData, input_bullC) cu = breakout(plData, pl) co = breakout(phData, ph) // Target Levels [v4 Update] phData_target = tl.new(phData.values.changeInX) plData_target = tl.new(plData.values.changeInX) phData_target.drawLine(ta.change(phData.values.y1) and input_targets, phData.values.y2, phData.values.y2) plData_target.drawLine(ta.change(plData.values.y1) and input_targets, plData.values.y2, plData.values.y2) target_style(tl.Trendline this, color col) => this.lines.startline.set_style(input_tstyle) this.lines.trendline.set_style(input_tstyle) this.lines.startline.set_color(col) this.lines.trendline.set_color(col) target_style(plData_target, input_bearC) target_style(phData_target, input_bullC) breakout(phData_target, ph) breakout(plData_target, pl) // --------------------------------- Trade Labels --------------------------- // //-------------------- Backtesting // @ Capissimo bidask = close tbase = (time - time[1]) / 1000 tcurr = (timenow - time_close[1]) / 1000 barlife = tcurr / tbase var float start_long_trade = bidask var float long_trades = 0. var float start_short_trade = bidask var float short_trades = 0. var int wins = 0 var int trade_count = 0 longtphit = ta.crossover(hl2, ATRbulltp1) and longBar2 longstophit = ta.crossunder(low, vwbullse3) and dcaorstop =="Stop" and longBar2 shorttphit = ta.crossunder(low, ATRbeartp1) and shortBar2 shortstophit = ta.crossover(high, vwbearse3) and dcaorstop =="Stop" and shortBar2 if bullcross //enter bull start_long_trade := bidask start_long_trade if bearcross or (i_show_x1?longliqhit:na) or longtphit or (dcaorstop=="Stop"?longstophit:na)//exit bull ldiff = bidask - start_long_trade // long profit in dollars wins := ldiff > 0 ? 1 : 0 long_trades := ldiff * lot_size trade_count := 1 trade_count if bearcross //enter bear start_short_trade := bidask start_short_trade if bullcross or (i_show_x1?shortliqhit:na) or shorttphit or (dcaorstop=="Stop"?shortstophit:na)//exitbear sdiff = start_short_trade - bidask // short profit in dollars wins := sdiff > 0 ? 1 : 0 short_trades := sdiff * lot_size trade_count := 1 trade_count bullcprofit=((bidask-start_long_trade)/start_long_trade) bearcprofit=((start_short_trade-bidask)/start_short_trade) cumbull = ta.cum(long_trades) cumbear = ta.cum(short_trades) cumpbull = ta.cum(bullcprofit) cumpbear = ta.cum(bearcprofit) cumreturn = ta.cum(long_trades) + ta.cum(short_trades) // sum of both short profit and long profit in $ cumpreturn = ta.cum(bullcprofit) + ta.cum(bearcprofit) // sum of both short profit and long profit in % totaltrades = ta.cum(trade_count) //# trades totalwins = ta.cum(wins) totallosses = totaltrades - totalwins == 0 ? 1 : totaltrades - totalwins avgreturn = cumreturn / totaltrades avgpreturn = cumpreturn / totaltrades avgbulltp = bullentry*(1+ta.valuewhen(bullcross,avgpreturn,0)) avgbeartp = bearentry*(1-ta.valuewhen(bearcross,avgpreturn,0)) avgtp = long_short==1?avgbulltp:long_short==-1?avgbeartp:na avgtpcol = long_short == 1 and avgtp>bullentry?green:long_short == 1 and avgtp<bullentry?red: long_short==-1 and avgtp<bearentry?red: long_short==-1 and avgtp>bearentry?red:na // plot(avgtp, "Avg TP", color=color.new(avgtpcol,50), style=plot.style_circles) info = "\n\n 📈 Backtest 📈" + '\nKar: ' + str.tostring(cumbull, '#.##') +'\nZarar: ' + str.tostring(cumbear, '#.##') + '\nTotal Kar: ' + str.tostring(cumreturn, '#.##') + '\nAverage Total Kar: ' + str.tostring(avgreturn, '#.##') + '\nKarlı Yüzde: ' + str.tostring(cumpbull, '#.## %') +'\nZararlı Yüzde: ' + str.tostring(cumpbear, '#.## %') + '\nTotal Yüzde: ' + str.tostring(cumpreturn, '#.## %') + '\nAverage Total Yüzde: ' + str.tostring(avgpreturn, '#.## %') + '\nBaşarılı: ' + str.tostring(totalwins, '#') + '\nBaşarısız: ' + str.tostring(totallosses, '#') + '\nTotal İşem Adedi: ' + str.tostring(totaltrades, '#') + '\nBaşarılı/İşlem: ' + str.tostring(totalwins / totaltrades, '#.## %') // Crossover profit bullxprofit = (((close - bullentry)/bullentry)*100) bearxprofit = (((close - bearentry)/bearentry)*-100) curbullprof = close-bullentry curbearprof = bearentry-close tradelabsize = size.normal tradetime = ta.barssince(bullcross or bearcross) // Plot Labels bullentrytt = " Entry: " + (long_short==1?" AL @ ":long_short==-1?" SAT @ ":na) + str.tostring(truncateprice(bullentry, pricedecimals)) bearentrytt = " Entry: " + (long_short==1?" AL @ ":long_short==-1?" SAT @ ":na) + str.tostring(truncateprice(bearentry, pricedecimals)) var label signal = na if bullcross label.new(bar_index,low,yloc=yloc.belowbar,text='\AL',textcolor=color.green, style=label.style_arrowup, tooltip=bullentrytt, size = size.large) alertsyntax_golong= " AL \n" + bullentrytt if bearcross label.new(bar_index,high,yloc=yloc.abovebar,text='\SAT',textcolor=color.red, style=label.style_arrowdown, tooltip=bearentrytt, size = size.large) alertsyntax_goshort= " SAT \n" + bearentrytt // var label dca3 = na // if state==1 and long_short==1 and barstate.islast // dca3 := label.new(bar_index, y=vwbullse3, text=str.tostring(truncateprice(vwbullse3, pricedecimals)), size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor=color.new(color.gray, 0), tooltip="📍: " + str.tostring(truncateprice(vwbullse3, pricedecimals)) + "\n-" + str.tostring(truncateprice(atrMultiplier*0.382, pricedecimals)) + "x " + "ATR " + str.tostring(atrPeriod)) //, tooltip=str.tostring(truncateprice(bullt8profit, pricedecimals)) + " %") // label.delete(dca3[1]) // if state==2 and long_short==-1 and barstate.islast // dca3 := label.new(bar_index, y=vwbearse3, text=str.tostring(truncateprice(vwbearse3, pricedecimals)), size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor=color.new(color.gray, 0), tooltip="📍: " + str.tostring(truncateprice(vwbearse3, pricedecimals)) + "\n-" + str.tostring(truncateprice(atrMultiplier*0.382, pricedecimals)) + "x " + "ATR " + str.tostring(atrPeriod)) //, tooltip=str.tostring(truncateprice(beart8profit, pricedecimals)) + " %") // label.delete(dca3[1]) // var label cp = na // if state==1 and long_short==0 and barstate.islast // cp := label.new(bar_index, y=high, text=str.tostring(truncateprice(bullxprofit*leverage, pricedecimals)) + " %", size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor=color.new(green,0), tooltip="🚦 Giriş: " + str.tostring(truncateprice(bullentry, pricedecimals)) + "\n💵 Kar: " + str.tostring(curbullprof, '#.##') + "\n📈 Kar Yüzde: " + str.tostring(bullcprofit*leverage, '#.## %') + (i_show_x1?("\n💯 Leverage: " + str.tostring(leverage) + "x"):na) + info) // + (automan=="Auto"?optMAtip:na) + info) //, tooltip=str.tostring(truncateprice(bullt8profit, pricedecimals)) + " %") // label.delete(cp[1]) // if state==2 and long_short==0 and barstate.islast // cp := label.new(bar_index, y=low, text=str.tostring(truncateprice(bearxprofit*leverage, pricedecimals)) + " %", size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor=color.new(red,0), tooltip="🚦 Giriş: " + str.tostring(truncateprice(bearentry, pricedecimals)) + "\n💵 Kar: " + str.tostring(curbearprof, '#.##') + "\n📈 Kar Yüzde: " + str.tostring(bearcprofit*leverage, '#.## %')+ (i_show_x1?("\n💯 Leverage: " + str.tostring(leverage) + "x"):na) + info) // + (automan=="Auto"?optMAtip:na) + info) //, tooltip=str.tostring(truncateprice(beart8profit, pricedecimals)) + " %") // label.delete(cp[1]) // var label liq = na // if state==1 and long_short==1 and i_show_x1 and barstate.islast // liq := label.new(bar_index, y=longLiquidation, text=str.tostring(truncateprice(longLiquidation, pricedecimals)), size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor= longLiquidation < vwbullse3 ? color.yellow : brightred, tooltip=lastlliq) // label.delete(liq[1]) // if state==2 and long_short==-1 and i_show_x1 and barstate.islast // liq := label.new(bar_index, y=shortLiquidation, text=str.tostring(truncateprice(shortLiquidation, pricedecimals)), size=tradelabsize, style=label.style_label_left, color=color.new(color.white,100), textcolor= shortLiquidation > vwbearse3 ? color.yellow : brightred, tooltip=lastsliq) // label.delete(liq[1]) //------------Reset long_short if SL/TP hit during bar------------------------// tpreset = true longclose = longtphit or longstophit shortclose = shorttphit or shortstophit bullstopp = ((vwbullse3 - bullentry)/bullentry)*100 bearstopp = ((bearentry - vwbearse3)/bearentry)*100 bulltpp = ((ATRbulltp1 - bullentry)/bullentry)*100 beartpp = ((bearentry - ATRbeartp1)/bearentry)*100 long_short := (long_short == 1 or long_short == 0) and (longclose or longliqhit) and tpreset ? 0 : (long_short == -1 or long_short == 0) and (shortclose or shortliqhit) and tpreset ? 0 : long_short bgcol2 = state==1 and state[1]==2 ?color.green : state==2 and state[1]==1 ? color.red :na // Candle Color Logic var color candle_col = na if bullcross candle_col := brightgreen if bearcross candle_col := brightred // Plot Candles plotcandle(open, high, low, close, title = 'Title', color = candle_col, wickcolor = candle_col, bordercolor = candle_col) // Plot Trend State barcolor(state==1 and rsi>50?brightgreen: state==1 and rsi<50?darkgreen: state==2 and rsi<50 ?brightred: state==2 and rsi>50 ?darkred:color.new(color.from_gradient(rsi, ts2, ts1, brightred, brightgreen),0),title="Chart Bar Color", display = showbc ? display.all : display.none, editable=false) // trend Alarm Koşulları TrendAlarmal= state==1 and state[1]==2 TrendAlarmsat= state==2 and state[1]==1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Mevcut Barın Zamanı currentTime = time // Strateji sadece belirtilen tarih aralığında çalışacak isInDateRange = (currentTime >= startDate and currentTime <= endDate) ////////////////////////////////////////////////////////////////// TİMUR İNCİ ////////////////////////////////////////////////////////////////////////////////////// // TP Yöntemini Seçme tpMethod = input.string("ATR_Standart", "TP Hesaplama Yöntemi", options=["ATR_Standart", "Fibonacci", "Swing", "ADM", "Bollinger", "Pivot", "Zaman_Bazli", "Harmonik", "RSI_Bazli"]) // Diğer Hesaplama Parametreleri lookbackPeriod = input.int(55, "Lookback Periyodu") basisPeriod = input.int(20, "Basis Periyodu") pivotLeftBars = input.int(5, "Pivot Sol Barlar") pivotRightBars = input.int(5, "Pivot Sağ Barlar") // TP Oranları tp1Oran = input.float(0.40, "TP1 Oran", minval=0.01, maxval=1.0, step=0.01) tp2Oran = input.float(0.30, "TP2 Oran", minval=0.01, maxval=1.0, step=0.01) tp3Oran = input.float(0.30, "TP3 Oran", minval=0.01, maxval=1.0, step=0.01) // Pozisyon Durum Değişkenleri var bool positionActive = false var bool tp1Executed = false var bool tp2Executed = false var float tp1Lot = na var float tp2Lot = na var float tp3Lot = na var float kalanLot = na // Fibonacci Uzantıları ile Hesaplama calculateFibonacci(entryPrice) => moveSize = atr * atrMultiplier tp1 = entryPrice + moveSize * 0.618 tp2 = entryPrice + moveSize * 1.0 tp3 = entryPrice + moveSize * 1.618 [tp1, tp2, tp3] calculateSwing() => swingLow = ta.lowest(low, lookbackPeriod) swingHigh = ta.highest(high, lookbackPeriod) priceRange = swingHigh - swingLow entryPrice = close // Add this line to define entryPrice tp1 = entryPrice + priceRange * 0.33 tp2 = entryPrice + priceRange * 0.66 tp3 = entryPrice + priceRange * 1.0 [tp1, tp2, tp3] // Ortalama Hareket Mesafesi (ADM) Kullanımı calculateADM() => dailyRange = high - low avgDailyRange = ta.sma(dailyRange, lookbackPeriod) entryPrice = close tp1 = entryPrice + avgDailyRange * 1.0 tp2 = entryPrice + avgDailyRange * 2.0 tp3 = entryPrice + avgDailyRange * 3.0 [tp1, tp2, tp3] // Bollinger Bantları Tabanlı Hedefler calculateBollinger() => basis = ta.sma(close, basisPeriod) dev = ta.stdev(close, basisPeriod) tp1 = basis + dev * 1 tp2 = basis + dev * 2 tp3 = basis + dev * 3 [tp1, tp2, tp3] // Pivot Noktaları Tabanlı Hedefler calculatePivot() => pivotHigh = ta.pivothigh(high, pivotLeftBars, pivotRightBars) pivotLow = ta.pivotlow(low, pivotLeftBars, pivotRightBars) var float lastPivotHigh = na var float lastPivotLow = na if (pivotHigh) lastPivotHigh := high[pivotRightBars] if (pivotLow) lastPivotLow := low[pivotRightBars] priceRange = lastPivotHigh - lastPivotLow entryPrice = close tp1 = entryPrice + priceRange * 0.33 tp2 = entryPrice + priceRange * 0.66 tp3 = entryPrice + priceRange * 1.0 [tp1, tp2, tp3] // Zaman Bazlı Faktörler Ekleme calculateTimeBasedFactors() => isVolatileSession = dayofweek == 1 or dayofweek == 5 volatilityMultiplier = isVolatileSession ? 1.5 : 1.0 entryPrice = close tp1 = entryPrice + (atr * 2 * volatilityMultiplier) tp2 = entryPrice + (atr * 4 * volatilityMultiplier) tp3 = entryPrice + (atr * 6 * volatilityMultiplier) [tp1, tp2, tp3] // Harmonik Desenler ile Hedef Belirleme calculateHarmonic() => moveAB = ta.highest(high, lookbackPeriod) - ta.lowest(low, lookbackPeriod) entryPrice = close tp1 = entryPrice + moveAB * 0.382 tp2 = entryPrice + moveAB * 0.618 tp3 = entryPrice + moveAB * 0.786 [tp1, tp2, tp3] // RSI Tabanlı Dinamik Ayarlama calculateRSIBased() => rsiValue = ta.rsi(close, 14) rsiMultiplier = rsiValue < 37 ? 1.5 : (rsiValue > 66 ? 0.8 : 1.0) entryPrice = close tp1 = entryPrice + (atr * 2 * rsiMultiplier) tp2 = entryPrice + (atr * 4 * rsiMultiplier) tp3 = entryPrice + (atr * 6 * rsiMultiplier) [tp1, tp2, tp3] // Seçilen Yönteme Göre TP Seviyelerini Hesapla [tp1Level, tp2Level, tp3Level] = switch tpMethod "ATR_Standart" => [ta.valuewhen(bullcross, ATRupper4, 0), ta.valuewhen(bullcross, ATRupper3, 0), ta.valuewhen(bullcross, ATRupper2, 0)] "Fibonacci" => calculateFibonacci(ta.valuewhen(bullcross, close, 0)) "Swing" => calculateSwing() "ADM" => calculateADM() "Bollinger" => calculateBollinger() "Pivot" => calculatePivot() "Zaman_Bazli" => calculateTimeBasedFactors() "Harmonik" => calculateHarmonic() "RSI_Bazli" => calculateRSIBased() => [ta.valuewhen(bullcross, ATRupper4, 0), ta.valuewhen(bullcross, ATRupper3, 0), ta.valuewhen(bullcross, ATRupper2, 0)] // Default // Stop Seviyesi stopLevel = ta.valuewhen(bullcross, srcATR - atr, 0) // TP Tetikleme Kontrolleri tp1Hit = ta.crossover(high, tp1Level) and positionActive and not tp1Executed and longBar2 tp2Hit = ta.crossover(high, tp2Level) and positionActive and tp1Executed and not tp2Executed and longBar2 tp3Hit = ta.crossover(high, tp3Level) and positionActive and tp1Executed and tp2Executed and longBar2 stopHit = ta.crossunder(low, stopLevel) and positionActive and longBar2 // EMA Göstergesi ema14_1h = request.security(syminfo.tickerid, "60", ta.ema(close, 14)) plot(ema14_1h, title="1H EMA", color=#000000, linewidth=2) // Strateji Giriş ve Çıkış Koşulları if (isInDateRange and bullcross and not positionActive) and close > ema14_1h and barstate.isconfirmed sonGirisLotu := lotHesapla() kalanLot := sonGirisLotu tp1Lot := math.floor(sonGirisLotu * tp1Oran) tp2Lot := math.floor(sonGirisLotu * tp2Oran) tp3Lot := sonGirisLotu - tp1Lot - tp2Lot strategy.entry("Long", strategy.long, qty=sonGirisLotu) alert('{"name": "🚀' + "İşleme girdi" + '", "symbol": "' + syminfo.ticker + '", "orderSide": "buy", "orderType": "mktbest", "price": "' + str.tostring(close) + '", "quantity": "' + str.tostring(sonGirisLotu) + '", "timeInForce": "day", "apiKey": "' + APIKEY + '"}', alert.freq_once_per_bar_close) positionActive := true tp1Executed := false tp2Executed := false if (isInDateRange and tp1Hit) strategy.exit("TP1", "Long", qty=tp1Lot, limit=tp1Level, comment="TP1") alert('{"name": "💸' + "TP1 - İlk Kısmi Çıkış" + '", "symbol": "' + syminfo.ticker + '", "orderSide": "sell", "orderType": "mktbest", "price": "' + str.tostring(tp1Level) + '", "quantity": "' + str.tostring(tp1Lot) + '", "timeInForce": "day", "apiKey": "' + APIKEY + '"}', alert.freq_once_per_bar_close) kalanLot := kalanLot - tp1Lot tp1Executed := true if (isInDateRange and tp2Hit) strategy.exit("TP2", "Long", qty=tp2Lot, limit=tp2Level, comment="TP2") alert('{"name": "💸' + "TP2 - İkinci Kısmi Çıkış" + '", "symbol": "' + syminfo.ticker + '", "orderSide": "sell", "orderType": "mktbest", "price": "' + str.tostring(tp2Level) + '", "quantity": "' + str.tostring(tp2Lot) + '", "timeInForce": "day", "apiKey": "' + APIKEY + '"}', alert.freq_once_per_bar_close) kalanLot := kalanLot - tp2Lot tp2Executed := true // BearCross'ta kalan lotları çıkış if (isInDateRange and bearcross and positionActive) strategy.close("Long", comment="Bear Cross") alert('{"name": "🔄' + "Trend Değişimi - Çıkış" + '", "symbol": "' + syminfo.ticker + '", "orderSide": "sell", "orderType": "mktbest", "price": "' + str.tostring(close) + '", "quantity": "' + str.tostring(kalanLot) + '", "timeInForce": "day", "apiKey": "' + APIKEY + '"}', alert.freq_once_per_bar_close) kalanLot := 0 positionActive := false tp1Executed := false tp2Executed := false // Çizimler p_tp1 = plot(positionActive ? tp1Level : na, "TP1 Seviyesi", color=color.new(color.green, 0), style=plot.style_line, linewidth=2, show_last=55) p_tp2 = plot(positionActive ? tp2Level : na, "TP2 Seviyesi", color=color.new(color.blue, 0), style=plot.style_line, linewidth=2, show_last=55) p_tp3 = plot(positionActive ? tp3Level : na, "TP3 Seviyesi", color=color.new(color.purple, 0), style=plot.style_line, linewidth=2, show_last=55) p_stop = plot(positionActive ? stopLevel : na, "Stop Seviyesi", color=color.new(color.red, 0), style=plot.style_line, linewidth=2, show_last=55) // Son barda etiket gösterimi if (barstate.islast) label.new(bar_index, tp1Level, "TP1 ", style=label.style_label_right, color=color.green, textcolor=color.white) label.new(bar_index, tp2Level, "TP2 ", style=label.style_label_right, color=color.blue, textcolor=color.white) label.new(bar_index, tp3Level, "TP3 ", style=label.style_label_right, color=color.purple, textcolor=color.white) label.new(bar_index, stopLevel, "STOP ", style=label.style_label_right, color=color.red, textcolor=color.white) ////////////////////////////////////////////////////////////////// TİMUR İNCİ ////////////////////////////////////////////////////////////////////////////////////// // // Copy below code to end of the desired strategy script // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // monthly pnl performance by Dr. Maurya @MAURYA_ALGO_TRADER // // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // show_performance = input.bool(true, 'AYLIK PERFORMANS TABLOSU ?', group='AYLIK Performance') // dash_loc_mp = input.session("Bottom Right","Location" ,options=["Top Right","Bottom Right","Top Left","Bottom Left", "Middle Right","Bottom Center"] ,group='AYLIK Performance', inline = "performance") // text_size_mp = input.session('Small',"Size" ,options=["Tiny","Small","Normal","Large"] ,group='AYLIK Performance', inline = "performance") // bg_c = input.color( color.rgb(91, 91, 94, 38), "Background Color", group='AYLIK Performance') // text_head_color = input.color( #ffffff, "Month/Year Heading Color", group='AYLIK Performance') // tab_month_c = input.color( color.white, "Month PnL Data Color", group='AYLIK Performance') // tab_year_c = input.color( color.rgb(0,0,0), "Year PnL Data Color", group='AYLIK Performance') // border_c = input.color( color.white, "Table Border Color", group='AYLIK Performance') // var table_position_mp = dash_loc_mp == 'Top Left' ? position.top_left : // dash_loc_mp == 'Bottom Left' ? position.bottom_left : // dash_loc_mp == 'Middle Right' ? position.middle_right : // dash_loc_mp == 'Bottom Center' ? position.bottom_center : // dash_loc_mp == 'Top Right' ? position.top_right : position.bottom_right // var table_text_size_mp = text_size_mp == 'Tiny' ? size.tiny : // text_size_mp == 'Small' ? size.small : // text_size_mp == 'Normal' ? size.normal : size.large // ///////////////// // ///////////////////////////////////////////// // // var bool new_month = na // new_month = ta.change(month) //> 0 ? true : false // newest_month = new_month and strategy.closedtrades >= 1 // // profit // only_profit = strategy.netprofit // initial_balance = strategy.initial_capital // // month number // var int month_number = na // month_number := (ta.valuewhen(newest_month, month(time), 0)) //and month(time) > 1 ? (ta.valuewhen(newest_month, month(time), 0) - 1) : 12 //1 to 12 // //month_year // var int month_time = na // month_time := ta.valuewhen(newest_month, time, 0) - 2419200000 // var int m_counter = 0 // if newest_month // m_counter += 1 // // current month values // var bool new_year = na // new_year := ta.change(year) ? true : false // curr_m_pnl = only_profit - nz(ta.valuewhen(newest_month, only_profit, 0), 0) // curr_m_number = newest_month ? ta.valuewhen(newest_month, month(time), 0) : month(time) // curr_y_pnl = (only_profit - nz(ta.valuewhen(new_year, only_profit, 0),0)) // var float [] net_profit_array = array.new_float() // var int [] month_array = array.new_int() // var int [] month_time_array = array.new_int() // if newest_month // array.push(net_profit_array, only_profit) // array.push(month_array, month_number) // array.push(month_time_array, month_time) // var float [] y_pnl_array = array.new_float() // var int [] y_number_array = array.new_int() // var int [] y_time_array = array.new_int() // newest_year = new_year and strategy.closedtrades >= 1 // get_yearly_pnl = nz(ta.valuewhen(newest_year, strategy.netprofit, 0) - nz(ta.valuewhen(newest_year, strategy.netprofit, 1), 0), 0) // get_m_year = ta.valuewhen(newest_year, year(time), 2) // get_y_time = ta.valuewhen(newest_year, time, 0) // if newest_year // array.push(y_pnl_array, get_yearly_pnl) // array.push(y_number_array, get_m_year) // array.push(y_time_array, get_y_time) // var float monthly_profit = na // var int column_month_number = na // var int row_month_time = na // var int row_y = na // var testTable = table.new(position = table_position_mp, columns = 14, rows = 40, bgcolor = bg_c, border_color = border_c, border_width = 1) // if barstate.islastconfirmedhistory and show_performance // table.cell(table_id = testTable, column = 0, row = 0, text = "YIL", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 1, row = 0, text = "OCK", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 2, row = 0, text = "SBT", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 3, row = 0, text = "MAR", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 4, row = 0, text = "NİS", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 5, row = 0, text = "MAY", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 6, row = 0, text = "HAZ", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 7, row = 0, text = "TEM", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 8, row = 0, text = "AUG", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 9, row = 0, text = "EYL", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 10, row = 0, text = "EKM", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 11, row = 0, text = "KAS", text_color = text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 12, row = 0, text = "ARL", text_color =text_head_color, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 13, row = 0, text = "YIL P/L", text_color = text_head_color, text_size=table_text_size_mp) // for i = 0 to (array.size(y_number_array) == 0 ? na : array.size(y_number_array) - 1) // row_y := year(array.get(y_time_array, i)) - year(array.get(y_time_array, 0)) + 1 // table.cell(table_id = testTable, column = 13, row = row_y, text = str.tostring(array.get(y_pnl_array , i), "##.##") + '\n' + '(' + str.tostring(array.get(y_pnl_array , i)*100/initial_balance, "##.##") + ' %)', bgcolor = array.get(y_pnl_array , i) > 0 ? color.green : array.get(y_pnl_array , i) < 0 ? color.red : color.gray, text_color = tab_year_c, text_size=table_text_size_mp) // curr_row_y = array.size(month_time_array) == 0 ? 1 : (year(array.get(month_time_array, array.size(month_time_array) - 1))) - (year(array.get(month_time_array, 0))) + 1 // table.cell(table_id = testTable, column = 13, row = row_y >= 0 ? row_y + 1 : 1, text = str.tostring(curr_y_pnl, "##.##") + '\n' + '(' + str.tostring(curr_y_pnl*100/initial_balance, "##.##") + ' %)', bgcolor = curr_y_pnl > 0 ? color.green : curr_y_pnl < 0 ? color.red : color.gray, text_color = tab_year_c, text_size=table_text_size_mp) // for i = 0 to (array.size(net_profit_array) == 0 ? na : array.size(net_profit_array) - 1) // monthly_profit := i > 0 ? ( array.get(net_profit_array, i) - array.get(net_profit_array, i - 1) ) : array.get(net_profit_array, i) // column_month_number := month(array.get(month_time_array, i)) // row_month_time :=((year(array.get(month_time_array, i))) - year(array.get(month_time_array, 0)) ) + 1 // table.cell(table_id = testTable, column = column_month_number, row = row_month_time, text = str.tostring(monthly_profit, "##.##") + '\n' + '(' + str.tostring(monthly_profit*100/initial_balance, "##.##") + ' %)', bgcolor = monthly_profit > 0 ? color.green : monthly_profit < 0 ? color.red : color.gray, text_color = tab_month_c, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 0, row =row_month_time, text = str.tostring(year(array.get(month_time_array, i)), "##.##"), text_color = text_head_color, text_size=table_text_size_mp) // // curr_row_m = array.size(month_time_array) == 0 ? 1 : (year(array.get(month_time_array, array.size(month_time_array) - 1))) - (year(array.get(month_time_array, 0))) + 1 // table.cell(table_id = testTable, column = curr_m_number, row = nz(row_month_time) <= 0 ? 1 : row_month_time, text = str.tostring(curr_m_pnl, "##.##") + '\n' + '(' + str.tostring(curr_m_pnl*100/initial_balance, "##.##") + ' %)', bgcolor = curr_m_pnl > 0 ? color.green : curr_m_pnl < 0 ? color.red : color.gray, text_color = tab_month_c, text_size=table_text_size_mp) // table.cell(table_id = testTable, column = 0, row =nz(row_month_time) <= 0 ? 1 : row_month_time, text = str.tostring(year(time), "##.##"), text_color = text_head_color, text_size=table_text_size_mp) //============================================================================================================================================================================ // 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_left, 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 Muti 3TP", 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) //@strategy_alert_message {{strategy.order.alert_message}}
Editor is loading...
Leave a Comment