適応型デュアルインジケータークロスオーバーインテリジェントタイミング取引戦略

RSI CCI EMA TIMEFRAME THRESHOLD
作成日: 2025-02-19 10:56:59 最終変更日: 2025-02-19 10:56:59
コピー: 2 クリック数: 435
1
フォロー
1617
フォロワー

適応型デュアルインジケータークロスオーバーインテリジェントタイミング取引戦略

概要

これは,RSIとCCIの双重技術指標に基づいた自己適応的取引戦略である. RSIとCCIの指標の交差状態を異なる時間周期で監視し,EMA均線トレンドと組み合わせて,完全な取引システムを構築する戦略である. この戦略は,自己適応性の強さ,信号の安定性などの特性を有し,市場での超買超売の機会を効果的に捉えることができる.

戦略原則

戦略の核心的な論理は以下の通りです.

  1. タイムサイクル自己適応:異なるタイムサイクル ((1分から4時間) に応じてRSIとCCIのパラメータ設定を動的に調整する.
  2. 二重指標確認:RSI (比較的強い指標) とCCI (順位指標) の組み合わせを使用して取引信号をフィルターします. RSIとCCIが同時に特定の条件を満たしている場合に取引信号が生じます.
  3. 信号継続性検証:最小の持続時間 (stayTimeFrames) を設定することで信号の安定性を確保する.
  4. ダイナミックストップストロー:入場時のRSIとCCIレベルに基づいて動的に設定されたストップストローポイント.
  5. トレンド確認: 200サイクルEMAをトレンド参照として使用する.

戦略的優位性

  1. 適応性強: 戦略は,異なる時間周期に応じてパラメータを自動的に調整することができ,適応性強である.
  2. 信号の信頼性: 双重技術指標の交叉確認により,信号の信頼性が著しく向上した.
  3. リスク管理の改善: ダイナミックストップ・ストップ・損失メカニズムを使用し,リスクを効果的に管理できます.
  4. 操作ルールは明確です. 入場・出場条件は明確で,実際の操作に便利です.
  5. 拡張性: ポリシーの枠組みは柔軟で,必要に応じて新しいフィルタリング条件を追加できます.

戦略リスク

  1. パラメータの敏感性:異なる市場環境で最適なパラメータは異なる可能性があります.
  2. 横軸の振動リスク:市場の振動の間,偽の信号が生じる可能性があります.
  3. スライドポイントの影響:HF取引はスライドポイントの影響を受ける可能性があります.
  4. 信号の遅延:複数の確認メカニズムにより,入場時間が少し遅れる可能性があります.
  5. 市場環境依存: 強いトレンドの市場では,震動の市場よりも優れている可能性があります.

戦略最適化の方向性

  1. パラメータの自適化:自適化パラメータの最適化メカニズムを導入し,市場の状況に応じてパラメータを動的に調整することができる.
  2. 市場環境認識:市場環境認識モジュールを追加し,異なる市場状態で異なる取引戦略を採用する.
  3. 波動率適応:波動率指標を導入し,波動率の大きさに応じて止損パラメータを調整する.
  4. シグナルフィルタリング: 偽信号をフィルタリングするために,より多くの技術指標と形状認識を追加します.
  5. リスク管理: 資金管理プログラムを完善し,ポジション保持時間とポジションコントロールを増加させる.

要約する

この戦略は,RSIとCCIの指標の優位性を組み合わせて,堅牢な取引システムを構築している.戦略の自己適応特性と完善したリスク管理機構は,その実用性を良好にしている.継続的な最適化と完善により,この戦略は,実際の取引でより良いパフォーマンスを期待している.

ストラテジーソースコード
/*backtest
start: 2025-01-19 00:00:00
end: 2025-02-18 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=6
strategy("RSI & CCI Strategy with Alerts", overlay=true)

// Detect current chart timeframe
tf = timeframe.period

// Define settings for different timeframes
rsiLength = tf == "1" ? 30 : tf == "5" ? 30 : tf == "15" ? 30 : tf == "30" ? 30 : 30  // Default
cciLength = tf == "1" ? 15 : tf == "5" ? 20 : tf == "15" ? 20 : tf == "30" ? 20 : 20  // Default
cciBuyThreshold = tf == "1" ? -100 : tf == "5" ? -100 : tf == "15" ? -100 : tf == "30" ? -100 : -100
cciSellThreshold = tf == "1" ? 100 : tf == "5" ? 100 : tf == "15" ? 100 : tf == "30" ? 100 : 100  // Default
stayTimeFrames = tf == "1" ? 1 : tf == "5" ? 1 : tf == "15" ? 1 : tf == "30" ? 1 : tf == "240" ? 1 : 2  // Default
stayTimeFramesOver =tf == "1" ? 1 : tf == "5" ? 2 : tf == "15" ? 2 : tf == "30" ? 3 : 2 // Default

// Calculate RSI & CCI
rsi = ta.rsi(close, rsiLength)
rsiOver = ta.rsi(close, 14)
cci = ta.cci(close, cciLength)

// EMA 50
ema200 = ta.ema(close, 200)
plot(ema200, color=color.rgb(255, 255, 255), linewidth=2, title="EMA 200")

// CCI candle threshold tracking
var int cciEntryTimeLong = na
var int cciEntryTimeShort = na

// Store entry time when CCI enters the zone
if (cci < cciBuyThreshold)
    if na(cciEntryTimeLong)
        cciEntryTimeLong := bar_index
else
    cciEntryTimeLong := na

if (cci > cciSellThreshold)
    if na(cciEntryTimeShort)
        cciEntryTimeShort := bar_index
else
    cciEntryTimeShort := na

// Confirming CCI has stayed in the threshold for required bars
cciStayedBelowNeg100 = not na(cciEntryTimeLong) and (bar_index - cciEntryTimeLong >= stayTimeFrames) and rsi >= 53
cciStayedAbove100 = not na(cciEntryTimeShort) and (bar_index - cciEntryTimeShort >= stayTimeFrames) and rsi <= 47


// CCI & RSI candle threshold tracking for Buy Over and Sell Over signals
var int buyOverEntryTime = na
var int sellOverEntryTime = na

// Track entry time when RSI and CCI conditions are met
if (rsiOver <= 31 and cci <= -120)
    if na(buyOverEntryTime)
        buyOverEntryTime := bar_index
else
    buyOverEntryTime := na

if (rsiOver >= 69 and cci >= 120)
    if na(sellOverEntryTime)
        sellOverEntryTime := bar_index
else
    sellOverEntryTime := na

// Confirm that conditions are met for the required stayTimeFrames
buyOverCondition = not na(buyOverEntryTime) and (bar_index - buyOverEntryTime >= stayTimeFramesOver)
sellOverCondition = not na(sellOverEntryTime) and (bar_index - sellOverEntryTime <= stayTimeFramesOver)

//Buy and sell for over bought or sell 
conditionOverBuy = buyOverCondition
conditionOverSell = sellOverCondition

// Buy and sell conditions
buyCondition = cciStayedBelowNeg100
sellCondition = cciStayedAbove100

// // Track open positions
var bool isLongOpen = false
var bool isShortOpen = false

// // Strategy logic for backtesting
// if (buyCondition and not isLongOpen)
//     strategy.entry("Long", strategy.long)
//     isLongOpen := true
//     isShortOpen := false

// if (sellCondition and not isShortOpen)
//     strategy.entry("Short", strategy.short)
//     isShortOpen := true
//     isLongOpen := false

// // Close positions based on EMA 50
// if (isLongOpen and exitLongCondition)
//     strategy.close("Long")
//     isLongOpen := false

// if (isShortOpen and exitShortCondition)
//     strategy.close("Short")
//     isShortOpen := false



// Track RSI at position entry
var float entryRSILong = na
var float entryRSIShort = na

// Track CCI at position entry
var float entryCCILong = na
var float entryCCIShort = na

if (buyOverCondition and not isLongOpen)
    strategy.entry("Long", strategy.long)
    entryRSILong := rsi  // Store RSI at entry
    entryCCILong := cci
    isLongOpen := true
    isShortOpen := false

if (sellOverCondition and not isShortOpen)
    strategy.entry("Short", strategy.short)
    entryRSIShort := rsi  // Store RSI at entry
    entryCCIShort := cci  // Stpre CCI at entry
    isShortOpen := true
    isLongOpen := false

exitLongRSICondition = isLongOpen and not na(entryRSILong) and rsi >= (entryRSILong + 12)  or rsi <= (entryRSILong -8)
exitShortRSICondition = isShortOpen and not na(entryRSIShort) and rsi <= (entryRSIShort - 12)  or rsi >= (entryRSIShort +8)

exitLongCCICondition = isLongOpen and not na(entryCCILong) and cci <= (entryCCILong -100)
exitShortCCICondition = isShortOpen and not na(entryCCIShort) and cci >= (entryCCIShort +100)

// Close positions based on EMA 50 or RSI change
if (isLongOpen and (exitLongRSICondition) or (exitLongCCICondition))
    strategy.close("Long")
    isLongOpen := false
    entryRSILong := na
    entryCCILong := na
    isLongOpen := false

if (isShortOpen and (exitShortRSICondition) or (exitShortCCICondition))
    strategy.close("Short")
    isShortOpen := false
    entryRSIShort := na
    entryCCIShort := na
    isShortOpen := false



// Plot buy and sell signals
plotshape(buyCondition, style=shape.labelup, location=location.belowbar, color=color.green, size=size.large, title="Buy Signal", text="BUY")
plotshape(sellCondition, style=shape.labeldown, location=location.abovebar, color=color.red, size=size.large, title="Sell Signal", text="SELL")

//Plot buy and sell OverBought
plotshape(conditionOverBuy, style=shape.labelup, location=location.belowbar, color=color.rgb(255, 238, 0), size=size.large, title="OverBuy Signal", text="Over Sell")
plotshape(conditionOverSell, style=shape.labeldown, location=location.abovebar, color=color.rgb(186, 40, 223), size=size.large, title="OverSell Signal", text="Over Buy")

// Alerts
alertcondition(buyCondition, title="Buy Alert", message="Buy Signal Triggered")
alertcondition(sellCondition, title="Sell Alert", message="Sell Signal Triggered")