merhaba kendime ait bir stratejim var bu stratejiyi bir parite kurmak ve back test yani geçmişe yönelik performans yapmak istiyorum bunun için bir video var mı matriks iq deneme hesabı kullanıyorum.
ayrıca elimdeki kodu matirks iq çevirebilir misiniz? grafiklerden haisinki ashi seçili olması şartıyla. Teşekkür ederim..
kod:
//@version=5
strategy("UT Bot Al-Sat Stratejisi", overlay=true)
// Input for key value
keyvalue = input.float(3, title='Anahtar Değeri. \'Bu hassasiyeti değiştirir\'', step=.5)
// Input for ATR period
atrperiod = input(10, title='ATR Periyodu')
// Calculate ATR
xATR = ta.atr(atrperiod)
// Calculate normal loss
nLoss = keyvalue * xATR
// Calculate trailing stop
var float xATRTrailingStop = na
iff_1 = close > nz(xATRTrailingStop[1], 0) ? close - nLoss : close + nLoss
iff_2 = close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), close + nLoss) : iff_1
xATRTrailingStop := close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), close - nLoss) : iff_2
// Position management
pos = 0
iff_3 = close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0) ? -1 : nz(pos[1], 0)
pos := close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0) ? 1 : iff_3
// Color
xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue
// Plot trailing stop
plot(xATRTrailingStop, color=xcolor, title='Trailing Stop')
// Buy and sell signals
buySignal = ta.crossover(close, xATRTrailingStop)
sellSignal = ta.crossunder(close, xATRTrailingStop)
// Entry and exit logic
if (buySignal)
strategy.entry("Al", strategy.long)
if (sellSignal)
strategy.close("Al")
strategy.entry("Sat", strategy.short) // Kısa pozisyon aç
// Plot shapes for buy and sell signals
plotshape(buySignal, title='Buy', text='Buy', style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(sellSignal, title='Sell', text='Sell', style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)
// Bar colors
barcolor(close > xATRTrailingStop ? color.green : color.red)
// Alerts
alertcondition(buySignal, title='UT BOT Al', message='UT BOT Al')
alertcondition(sellSignal, title='UT BOT Sat', message='UT BOT Sat')