StrategyStrategy Adjustment and Finalization

Strategy Adjustment and Finalization

I finalized the strategy by adding alerts and making slight numerical adjustments to improve the win rate.

The win rate is now 52.37%. Further improvements could be achieved by filtering based on “time of day” or “day of the week,” or by adjusting the risk-reward ratio.

While I’d prefer a slightly higher win rate, the strategy has a trend-following characteristic, which allows for lot size adjustments to optimize returns.

Additionally, the current setup uses a fixed 30 pips, but volatility has changed significantly compared to 10–20 years ago. Therefore, it might be better to focus on data from the last 3–5 years for further adjustments.

RSI Strategy (USDJPY 5min) Final
//@version=6
strategy("RSI Strategy (USDJPY 5min) Final", overlay=true, default_qty_type=strategy.percent_of_equity, pyramiding=1, initial_capital=5000000, currency="JPY", default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.0, margin_long=1/100, margin_short=1/100)
 
// 期間を2に変更、RSI overSold、overBoughtを1と99に
length = input(2)
overSold = input(1)
overBought = input(99)
longLength = input.int(200, "Long MA Length")
price = close
vrsi = ta.rsi(price, length)
longma = ta.sma(close, longLength)
 
// overSoldかoverBought
co = ta.crossover(vrsi, overSold) and strategy.position_size == 0 and close > longma
cu = ta.crossunder(vrsi, overBought) and strategy.position_size == 0 and close < longma
 
// maをチャートに表示
plot(longma, title="Long MA", color=color.new(color.gray, 0), linewidth=2, style=plot.style_line)
 
// 損切と利確の設定
stop_loss_pips = input.float(30, "Stop Loss (in pips)")
take_profit_pips = input.float(30, "Take Profit (in pips)")
 
// 利確損切Pips計算
pips_multiplier = syminfo.mintick * 10
adjusted_stop_loss = stop_loss_pips * pips_multiplier
adjusted_take_profit = take_profit_pips * pips_multiplier
 
if (not na(vrsi))
    if (co)
        alert("RSI and MA conditions met for a Long Entry.")
        strategy.entry("RsiLE", strategy.long, comment="RsiLE")
    strategy.exit("RsiLE Exit", stop=strategy.position_avg_price - adjusted_stop_loss, limit=strategy.position_avg_price + adjusted_take_profit)
    if (cu)
        alert("RSI and MA conditions met for a Short Entry.")
        strategy.entry("RsiSE", strategy.short, comment="RsiSE")
    strategy.exit("RsiSE Exit", stop=strategy.position_avg_price + adjusted_stop_loss, limit=strategy.position_avg_price - adjusted_take_profit)

Hello