
これは、2 期間の移動平均 (21 と 55)、RSI モメンタム インジケーター、およびボリュームを組み合わせたトレンド フォロー戦略です。この戦略は、価格、モメンタム、ボリュームの3つの側面から市場情報を分析します。トレンドの方向を確認しながら、RSIとボリューム指標を通じて取引シグナルをフィルタリングし、取引の精度を向上させます。この戦略では、価格が短期移動平均を突破し、RSI が移動平均を突破すると、取引量が増加することでトレンドの有効性が確認されます。
この戦略では、3 つのフィルタリング メカニズムを使用します。
購入条件は同時に満たされている必要があります:
販売条件は次のいずれかになります。
これは、テクニカル分析の 3 つの主要要素 (価格、ボリューム、モメンタム) を使用するトレンド追跡戦略です。この戦略は、複数のフィルタリングメカニズムを通じて、信号の信頼性を保証するだけでなく、一定のリスク制御機能も備えています。この戦略には固有の制限もありますが、継続的な最適化と改善を通じて、実際の取引で安定した収益が得られることが期待されます。特に、明確なトレンドと十分な流動性がある市場では、この戦略のパフォーマンスが向上する可能性があります。
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("21/55 MA with RSI Crossover", overlay=true)
// Inputs for moving averages
ma21_length = input.int(21, title="21-day Moving Average Length", minval=1)
ma55_length = input.int(55, title="55-day Moving Average Length", minval=1)
// RSI settings
rsi_length = input.int(13, title="RSI Length", minval=1)
rsi_avg_length = input.int(13, title="RSI Average Length", minval=1)
// Moving averages
ma21 = ta.sma(close, ma21_length)
ma55 = ta.sma(close, ma55_length)
// Volume settings
vol_ma_length = input.int(21, title="Volume MA Length", minval=1)
// Volume moving average
vol_ma = ta.sma(volume, vol_ma_length)
// RSI calculation
rsi = ta.rsi(close, rsi_length)
rsi_avg = ta.sma(rsi, rsi_avg_length)
// Buy condition
// buy_condition = close > ma21 and ta.crossover(rsi, rsi_avg) and volume > vol_ma
buy_condition = close > ma21 and rsi > rsi_avg and volume > vol_ma
// Sell condition
// sell_condition = close < ma55 or ta.crossunder(rsi, rsi_avg)
sell_condition = ta.crossunder(close, ma55) or ta.crossunder(rsi, rsi_avg)
// Execute trades
if (buy_condition)
strategy.entry("Buy", strategy.long, comment="Buy Signal")
if (sell_condition)
strategy.close("Buy", comment="Sell Signal")
// Plot moving averages for reference
plot(ma21, color=color.blue, title="21-day MA")
plot(ma55, color=color.red, title="55-day MA")
// Plot RSI and RSI average for reference
rsi_plot = input.bool(true, title="Show RSI?", inline="rsi")
plot(rsi_plot ? rsi : na, color=color.green, title="RSI")
plot(rsi_plot ? rsi_avg : na, color=color.orange, title="RSI Average")