
この戦略は,単純移動平均 ((SMA)) と比較的強い指標 ((RSI)) を組み合わせたトレンド追跡取引システムである. それは,短期および長期の移動平均の交差によってトレンドの方向性を認識し,RSIを使用して動量確認を行い,市場の中で高い確率の取引機会を探します. この戦略には,取引ごとにリスクを効果的に制御するための完全なリスク管理モジュールが含まれています.
この戦略のコアロジックは、2 つのテクニカル指標を組み合わせて使用することに基づいています。
これは,構造的で,論理的に明確なトレンド追跡戦略である. SMAとRSIを組み合わせることで,トレンドを捉えながら,過剰な取引区域での取引を避けることができる. 組み込まれたリスク管理機構は,戦略の安定性を保証する.
/*backtest
start: 2025-02-16 00:00:00
end: 2025-02-23 00:00:00
period: 6m
basePeriod: 6m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=6
strategy("WEN - SMA with RSI Strategy", overlay=true)
// Define input parameters
// SMA Inputs
shortLength = input(8, title="Short MA Length")
longLength = input(21, title="Long MA Length")
// RSI Inputs
rsiLength = input(14, title="RSI Length")
rsiOverbought = input(70, title="RSI Overbought")
rsiOversold = input(30, title="RSI Oversold")
// Calculate indicators
// Moving Averages
shortMA = ta.sma(close, shortLength)
longMA = ta.sma(close, longLength)
// RSI
rsi = ta.rsi(close, rsiLength)
// Plot indicators
plot(shortMA, title="Short MA", color=color.blue)
plot(longMA, title="Long MA", color=color.red)
// RSI is typically plotted in a separate panel in trading platforms
// Entry conditions with RSI confirmation
smaLongCondition = ta.crossover(shortMA, longMA)
smaShortCondition = ta.crossunder(shortMA, longMA)
rsiLongCondition = rsi < rsiOverbought // Not overbought for long entry
rsiShortCondition = rsi > rsiOversold // Not oversold for short entry
// Combined entry conditions
longCondition = smaLongCondition and rsiLongCondition
shortCondition = smaShortCondition and rsiShortCondition
// Execute trades
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.close("Long")
strategy.entry("Short", strategy.short)
// Set stop loss and take profit
stopLoss = input(1, title="Stop Loss (%)") / 100
takeProfit = input(2, title="Take Profit (%)") / 100
longStopLossPrice = strategy.position_avg_price * (1 - stopLoss)
longTakeProfitPrice = strategy.position_avg_price * (1 + takeProfit)
shortStopLossPrice = strategy.position_avg_price * (1 + stopLoss)
shortTakeProfitPrice = strategy.position_avg_price * (1 - takeProfit)
strategy.exit("Take Profit / Stop Loss", from_entry="Long", stop=longStopLossPrice, limit=longTakeProfitPrice)
strategy.exit("Take Profit / Stop Loss", from_entry="Short", stop=shortStopLossPrice, limit=shortTakeProfitPrice)