
この戦略は,相対的に強い指数 ((RSI) とSupertrendの2つの技術指標を組み合わせて,市場動向を捉え,潜在的な取引機会を識別する.戦略の主な構想は,RSIを使用して市場の過剰買いと過剰販売状態を判断し,同時にSupertrendの指標を使用してトレンドの方向を確認する.RSIとSupertrendの指標が同時に特定の条件を満たしているときに,戦略は買入または売り出し信号を生成する.
RSI+Supertrendのトレンド追跡取引戦略は,RSIとSupertrendの2つの技術指標を組み合わせることで,市場トレンドを効果的に捕捉し,取引信号を生成できます.戦略の優点は,論理的に明確で,実行しやすいこと,動力とトレンド要因を考慮することにある.しかし,戦略には,頻繁な取引やパラメータ設定の限界などのいくつかのリスクもあります.戦略のパフォーマンスをさらに向上させるために,他の指標の導入,パラメータの最適化,リスク管理の強化,継続的な監視と調整を検討することができます.
/*backtest
start: 2024-05-21 00:00:00
end: 2024-05-28 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("RSI + Supertrend Strategy", overlay=true)
// Input parameters
rsiLength = input.int(14, title="RSI Length")
rsiOverbought = input.int(58, title="RSI Overbought Level")
rsiOversold = input.int(38, title="RSI Oversold Level")
supertrendLength = input.int(10, title="Supertrend Length")
supertrendMultiplier = input.int(3, title="Supertrend Multiplier")
// Calculate indicators
rsiValue = ta.rsi(close, rsiLength)
[supertrend, _] = ta.supertrend(supertrendLength, supertrendMultiplier)
// Plot Supertrend on main chart
plot(supertrend, color = supertrend < close ? color.green : color.red, linewidth = 2, title="Supertrend")
// Plot RSI
hline(rsiOverbought, "Overbought", color.red)
hline(rsiOversold, "Oversold", color.green)
plot(rsiValue, title="RSI", color=color.blue)
// Strategy
var float entryPrice = na
// Long conditions
longCondition = (rsiValue > rsiOverbought) and (supertrend < close)
// Short conditions
shortCondition = (rsiValue < rsiOversold) and (supertrend > close)
// Exit conditions
longExitCondition = (rsiValue < 50) and (supertrend > close)
shortExitCondition = (rsiValue > 45) and (supertrend < close)
// Execute strategy
if (longCondition)
strategy.entry("Long", strategy.long)
entryPrice := close
if (shortCondition)
strategy.entry("Short", strategy.short)
entryPrice := close
if (longExitCondition and strategy.position_size > 0)
strategy.close("Long")
if (shortExitCondition and strategy.position_size < 0)
strategy.close("Short")
// Date and time range for backtest
startDate = timestamp("2023-01-01 00:00")
endDate = timestamp("2024-01-01 00:00")
if (time < startDate or time > endDate)
strategy.close_all()