
この戦略は、複数の移動平均クロスオーバーと RSI インジケーターに基づいたトレンド追跡取引システムです。この戦略は、EMA20、EMA50、SMA200の3つの移動平均を組み合わせ、移動平均の位置関係で市場の動向を判断し、RSIインジケーターを使用して取引シグナルをフィルタリングし、価格が前回の高値を突破したときに取引します。この戦略は固定の利益確定条件と損切り条件を設定し、1 時間レベルと日次レベルで実行するのに適しています。
戦略の中核となるロジックは、次の主要な条件に基づいています。
この戦略は、完全な構造と明確なロジックを備えたトレンド追跡システムです。複数のテクニカル指標を連携して使用することで、市場の動向を効果的に捉えるとともに、完全なリスク管理メカニズムも実現します。戦略には最適化の余地が大きく、継続的な改善により戦略の安定性と収益性がさらに高まります。中期および長期のトレーダーにとって、これは試してみる価値のある戦略フレームワークです。
/*backtest
start: 2025-01-02 00:00:00
end: 2025-01-09 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA/SMA Strategy", overlay=false)
// Input parameters
ema20Length = input(20, title="20 EMA Length")
ema50Length = input(50, title="50 EMA Length")
sma200Length = input(200, title="200 SMA Length")
rsiLength = input(14, title="RSI Length")
rsiThreshold = input(40, title="RSI Threshold")
// Calculate indicators
ema20 = ta.ema(close, ema20Length)
ema50 = ta.ema(close, ema50Length)
sma200 = ta.sma(close, sma200Length)
rsiValue = ta.rsi(close, rsiLength)
// Conditions
emaCondition = ema20 > ema50 and sma200 < ema20 and sma200 < ema50
priceNearEMA = (close <= ema20 * 1.01 and close >= ema20 * 0.99) or (close <= ema50 * 1.01 and close >= ema50 * 0.99)
rsiCondition = rsiValue > rsiThreshold
// Entry condition: Price crosses previous candle high
entryCondition = priceNearEMA and rsiCondition and emaCondition and (close > high[1])
// Strategy entry
if entryCondition
strategy.entry("Long", strategy.long)
// Take profit and stop loss settings
takeProfitLevel = strategy.position_avg_price * 1.25 // Take profit at +25%
stopLossLevel = strategy.position_avg_price * 0.90 // Stop loss at -10%
// Exit conditions
if strategy.position_size > 0
strategy.exit("Take Profit", from_entry="Long", limit=takeProfitLevel)
strategy.exit("Stop Loss", from_entry="Long", stop=stopLossLevel)
// Plotting indicators for visualization
plot(ema20, color=color.blue, title="20 EMA")
plot(ema50, color=color.red, title="50 EMA")
plot(sma200, color=color.green, title="200 SMA")
hline(rsiThreshold, "RSI Threshold", color=color.orange)