
この戦略は,相対的に強い弱指数 ((RSI) と2つのシンプル移動平均 ((SMA) を主要な指標として採用し,1時間の時間枠で多頭と空頭シグナルを生成する. RSIとSMAの条件設定を緩和することで,シグナルを誘発する頻度が向上する. 同時に,戦略は,平均リアル波幅 ((ATR) の指標をリスク管理のために使用し,動的にストップとストップ・ロスを設定する.
戦略の基本は以下の通りです.
この戦略は,RSIと双均線を組み合わせた2つの簡単な使いやすい技術指標を組み合わせて,1時間の時間枠でトレンド追跡信号を生成し,ATR指標を活用して動的リスク管理を行う.戦略の論理は明確で,理解しやすく,実装し,初心者の学習と使用に適しています.しかし,戦略には,頻繁に取引,市場の不良パフォーマンス,トレンドの欠如などの潜在的なリスクもあります.したがって,実際のアプリケーションでは,戦略の安定性と収益性を高めるために,パラメータ最適化,シグナルフィルター,ダイナミック権限再調整,ストップダメージ最適化,マルチフレーム分析などの戦略のさらなる最適化と改善が必要です.
/*backtest
start: 2024-02-01 00:00:00
end: 2024-02-29 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Debugged 1H Strategy with Liberal Conditions", shorttitle="1H Debug", overlay=true, pyramiding=0)
// Parameters
rsiLength = input.int(14, title="RSI Length")
rsiLevel = input.int(50, title="RSI Entry Level") // More likely to be met than the previous 70
fastLength = input.int(10, title="Fast MA Length")
slowLength = input.int(21, title="Slow MA Length")
atrLength = input.int(14, title="ATR Length")
atrMultiplier = input.float(1.5, title="ATR Multiplier for SL")
riskRewardMultiplier = input.float(2, title="Risk/Reward Multiplier")
// Indicators
rsi = ta.rsi(close, rsiLength)
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
atr = ta.atr(atrLength)
// Trades
longCondition = ta.crossover(fastMA, slowMA) and rsi < rsiLevel
shortCondition = ta.crossunder(fastMA, slowMA) and rsi > rsiLevel
// Entry and Exit Logic
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", profit=atrMultiplier * atr, loss=atr)
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", profit=atrMultiplier * atr, loss=atr)
// Debugging: Visualize when conditions are met
bgcolor(longCondition ? color.new(color.green, 90) : na)
bgcolor(shortCondition ? color.new(color.red, 90) : na)