Hi,
I need help to modify a PRT code from pine.
(I use it on dax3m and get 70%+ results on backtest)
If you have a beter alternative/TWEAK to get better results your free to change it. Please take your time and check. Code is posted below. And I hope i´ve posted this in the right forum because im new on this site.
//@version=4
strategy(“My Strategy”, overlay=true)
sourceInput = input(close)
emaLengthInput = input(defval=62, title=”EMA Length”, type=input.integer)
rsiInput = input(defval=14, title=”RSI Length”, type=input.integer)
// stoch
stochLengthInput = input(defval=14, title=”Stoch Length”, type=input.integer)
stochFastInput = input(defval=3, title=”Stoch Fast”, type=input.integer)
stochSlowInput = input(defval=3, title=”Stoch Slow”, type=input.integer)
stochBuySignalInput = input(defval=20, title=”Stoch Buy Signal Input”, type=input.integer)
stochSellSignalInput = input(defval=80, title=”Stoch Sell Signal Input”, type=input.integer)
// rsi
rsi = rsi(sourceInput, rsiInput)
// ichi
tenkanPeriods = input(9, minval=1, title=”Tenkan-sen period”)
kijunPeriods = input(26, minval=1, title=”Kijun-sen period”)
senkouSpanBPeriods = input(52, minval=1, title=”SenkouSpanB period”)
chikouDisplacement = input(26, minval=1, title=”Chikou displacement”)
// calcs
ema = ema(sourceInput, emaLengthInput)
stoch = stoch(close, high, low, stochLengthInput)
stochFast = sma(stoch, stochFastInput)
stochSlow = sma(stochFast, stochSlowInput)
donchian(len) => avg(lowest(len), highest(len))
tenkan = donchian(tenkanPeriods)
kijun = donchian(kijunPeriods)
senkouA = avg(tenkan, kijun)
senkouB = donchian(senkouSpanBPeriods)
chikou = sourceInput
plot(chikou, offset= -chikouDisplacement + 1, color=#000000)
buySignal = false
// sell
stochSellSignal = stochFast > stochSellSignalInput and crossunder(stochFast, stochSlow)
rsiSignal = change(rsi) < 0
ichiSellSignal = chikou < sourceInput[chikouDisplacement-1]
sellSignal = stochSellSignal and rsiSignal and ichiSellSignal
shortProfitPerc = input(title=”Short Take Profit (%)”, minval=0.0, step=0.1, defval=0.5) / 100
shortLossPerc = input(title=”Short Stop Loss (%)”, minval=0.0, step=0.1, defval=0.5) / 100
if(sellSignal)
strategy.entry(“Short”, long=false)
if (strategy.position_size < 0)
shortExitPrice = strategy.position_avg_price * (1 – shortProfitPerc)
shortStopPrice = strategy.position_avg_price * (1 + shortLossPerc)
strategy.exit(id=”XS CloseShort”, limit=shortExitPrice, stop=shortStopPrice)
if hour == 17 and minute == 28
strategy.close_all()
plot(kijun, color=color.new(color.red, 0))
plot(ema, color=color.new(color.blue, 0))
barcolor(buySignal ? color.new(color.blue, 0) : sellSignal ? color.new(color.red, 0) : na)