
この戦略は,多指標の協調的なトレンド反転取引システムであり,主に相対的に強い指標 ((RSI),パラパラ線指標 ((SAR) と単純な移動平均 ((SMA) の3つの技術指標を組み合わせている.戦略の核心思想は,RSIの超買い信号によって潜在的な反転の機会を警告し,SAR指標の方向の変化を利用して反転の信号を確認し,最後に移動平均を動的ストップ・ストップ・損失参照として使用する.この多指標の協調的な検証方法は,偽の信号の干渉を効果的に軽減し,取引の信頼性を向上させる.
戦略の仕組みは主に3つのステップで構成されています.
この戦略は,RSIとSARの協調的な配合によって,比較的信頼性の高いトレンド反転取引システムを構築している.移動平均を動的リスク管理ツールとして使用することで,トレンドの有効な把握を保証するとともに,リスクの動的制御を実現している.戦略の主な優点は,複数の信号の検証と明確な取引規則にある.しかし,実際のアプリケーションでは,市場環境の識別とパラメータの動的最適化に注意する必要がある.市場環境のフィルターを追加し,ストップ・ロスの方法を最適化し,ポジション管理などの方向の改善を完善することにより,戦略の安定性と収益性をさらに向上させることができる.
/*backtest
start: 2024-07-15 00:00:00
end: 2025-02-15 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
//@version=5
strategy("SAR + RSI Strategy", overlay=true, margin_long=100, margin_short=100)
// ———————— SAR Parameters ————————
start = input(0.02, "SAR Start")
increment = input(0.02, "SAR Increment")
maximum = input(0.2, "SAR Maximum")
// ———————— RSI Parameters ————————
rsiLength = input(14, "RSI Length")
upperLevel = input(70, "RSI Upper Level")
lowerLevel = input(30, "RSI Lower Level")
// ———————— SMA Parameter ————————
smaLength = input(21, "SMA Exit Length")
// ———————— Indicators Calculation ————————
// SAR Calculation
sarValue = ta.sar(start, increment, maximum)
sarUp = sarValue < close
sarDown = sarValue > close
// RSI Calculation
rsi = ta.rsi(close, rsiLength)
rsiOverbought = ta.cross(rsi, upperLevel)
rsiOversold = ta.cross(rsi, lowerLevel)
// SMA Calculation
sma21 = ta.sma(close, smaLength)
// ———————— Entry Conditions ————————
longCondition =
// RSI oversold signal occurred in last 3 bars
(ta.barssince(rsiOversold) <= 3) and
// SAR reversal to bullish occurs now
sarUp and not sarUp[1]
shortCondition =
// RSI overbought signal occurred in last 3 bars
(ta.barssince(rsiOverbought) <= 3) and
// SAR reversal to bearish occurs now
sarDown and not sarDown[1]
// ———————— Exit Conditions ————————
exitLong = ta.crossunder(close, sma21)
exitShort = ta.crossover(close, sma21)
// ———————— Strategy Execution ————————
strategy.entry("Long", strategy.long, when=longCondition)
strategy.close("Long", when=exitLong)
strategy.entry("Short", strategy.short, when=shortCondition)
strategy.close("Short", when=exitShort)
// ———————— Visualizations ————————
// plot(sarValue, "SAR", style=plot.style_circles, color=sarUp ? color.green : color.red)
// plot(sma21, "21 SMA", color=color.orange)