モメンタム適応型ガウスチャネルマルチ期間戦略

ATR RSI HLC3 TR
作成日: 2025-02-08 14:49:15 最終変更日: 2025-02-08 14:49:15
コピー: 1 クリック数: 360
1
フォロー
1617
フォロワー

モメンタム適応型ガウスチャネルマルチ期間戦略

概要

この戦略は,高ス通路とランダムなRSI指標に基づく動態取引システムで,季節的なフィルタリングと変動率管理を組み合わせている.戦略は高ス通路に自律的に適応することで市場トレンドを認識し,ランダムなRSIを使用して動態を確認し,特定の季節的なウィンドウ内で取引を実行する.このシステムは,各取引のリスクを制御するためにATRベースのポジション管理も統合している.

戦略原則

戦略の核心は,多極点高波器に基づいて構築された価格チャネルである.このチャネルは,HLC3の価格の高波値を計算し,実際の波動幅の波動結果 ((TR)) と組み合わせて,動的な上下軌道を形成する.取引信号の生成には,以下の条件を満たす必要があります.

  1. 価格が上昇し,主波が上昇した
  2. ランダムなRSI指標はオーバーバイ状態を示しています.
  3. 設定された季節の窓内での現在の時間
  4. ポジションの規模はATRの動的計算に基づいています.

平仓シグナルは,価格が下落したときに誘発される.全システムは,複数のフィルタリングメカニズムによって取引の安定性を高めます.

戦略的優位性

  1. 高スコープフィルターは優れたノイズフィルタリング能力を持ち,実際の市場動向を効果的に捉えます.
  2. 多極設計により,価格チャネルの境界がより正確になります.
  3. 動量とトレンドの指標を統合し,信号の信頼性を高めます.
  4. 季節的なフィルタリングは,不利な市場環境を回避するのに役立ちます.
  5. ダイナミックなポジションマネジメントにより,リスクの整合性を確保
  6. システムパラメータは,異なる市場条件に応じて最適化できます

戦略リスク

  1. 高スキーフィルターの計算が複雑で実行が遅れる可能性がある
  2. 複数のフィルタリング条件により,重要な取引機会が失われる可能性があります.
  3. システムにはパラメータの設定に敏感で,慎重に最適化する必要があります
  4. 季節的な窓の固定設定は,市場の状況の変化に適応しない可能性があります.
  5. ATRベースのポジション管理は,高波動期に過度に保守的になる可能性があります.

戦略最適化の方向性

  1. 市場条件によって取引時間を動的に調整する自己適応の季節的な窓を導入
  2. 高スキーフィルターの計算効率を最適化し,実行遅延を減らす
  3. 市場変動の調節機構に加入し,異なる市場環境でフィルタリング条件を調整する
  4. リスクとリターンのバランスをとる より柔軟なポジション管理システムの開発
  5. 信号の信頼性を高めるために,多時間枠分析を追加

要約する

これは,多層のフィルタリングとリスク管理の仕組みによって取引の安定性を高める完ぺきなトレンド追跡システムを構築したものです.いくつかの最適化スペースがあるものの,全体的な設計理念は,現代の定量取引の要求に適合しています.戦略の成功の鍵は,パラメータの正確な調整と市場環境への適応性にあります.

ストラテジーソースコード
/*backtest
start: 2024-02-08 00:00:00
end: 2025-02-06 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"DIA_USDT"}]
*/

//@version=6
strategy("Demo GPT - Gold Gaussian Strategy", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1)

// ====== INPUTS ======
// Gaussian Channel
lengthGC = input.int(144, "Gaussian Period", minval=20)
poles = input.int(4, "Poles", minval=1, maxval=9)
multiplier = input.float(1.414, "Volatility Multiplier", minval=1)

// Stochastic RSI
smoothK = input.int(3, "Stoch K", minval=1)
lengthRSI = input.int(14, "RSI Length", minval=1)
lengthStoch = input.int(14, "Stoch Length", minval=1)
overbought = input.int(80, "Overbought Level", minval=50)

// Seasonal Filter (corrected)
startMonth = input.int(9, "Start Month (1-12)", minval=1, maxval=12)
endMonth = input.int(2, "End Month (1-12)", minval=1, maxval=12)

// Volatility Management
atrLength = input.int(22, "ATR Length", minval=5)
riskPercent = input.float(0.5, "Risk per Trade (%)", minval=0.1, step=0.1)

// ====== GAUSSIAN CHANNEL ======
f_filt9x(alpha, source, iterations) =>
    float f = 0.0
    float x = 1 - alpha
    int m2 = iterations == 9 ? 36 : iterations == 8 ? 28 : iterations == 7 ? 21 : 
           iterations == 6 ? 15 : iterations == 5 ? 10 : iterations == 4 ? 6 : 
           iterations == 3 ? 3 : iterations == 2 ? 1 : 0
    
    int m3 = iterations == 9 ? 84 : iterations == 8 ? 56 : iterations == 7 ? 35 : 
           iterations == 6 ? 20 : iterations == 5 ? 10 : iterations == 4 ? 4 : 
           iterations == 3 ? 1 : 0
    
    int m4 = iterations == 9 ? 126 : iterations == 8 ? 70 : iterations == 7 ? 35 : 
           iterations == 6 ? 15 : iterations == 5 ? 5 : iterations == 4 ? 1 : 0
    
    int m5 = iterations == 9 ? 126 : iterations == 8 ? 56 : iterations == 7 ? 21 : 
           iterations == 6 ? 6 : iterations == 5 ? 1 : 0
    
    int m6 = iterations == 9 ? 84 : iterations == 8 ? 28 : iterations == 7 ? 7 : 
           iterations == 6 ? 1 : 0
    
    int m7 = iterations == 9 ? 36 : iterations == 8 ? 8 : iterations == 7 ? 1 : 0
    
    int m8 = iterations == 9 ? 9 : iterations == 8 ? 1 : 0
    int m9 = iterations == 9 ? 1 : 0
    
    f := math.pow(alpha, iterations) * nz(source) +
      iterations * x * nz(f[1]) -
      (iterations >= 2 ? m2 * math.pow(x, 2) * nz(f[2]) : 0) +
      (iterations >= 3 ? m3 * math.pow(x, 3) * nz(f[3]) : 0) -
      (iterations >= 4 ? m4 * math.pow(x, 4) * nz(f[4]) : 0) +
      (iterations >= 5 ? m5 * math.pow(x, 5) * nz(f[5]) : 0) -
      (iterations >= 6 ? m6 * math.pow(x, 6) * nz(f[6]) : 0) +
      (iterations >= 7 ? m7 * math.pow(x, 7) * nz(f[7]) : 0) -
      (iterations >= 8 ? m8 * math.pow(x, 8) * nz(f[8]) : 0) +
      (iterations == 9 ? m9 * math.pow(x, 9) * nz(f[9]) : 0)
    f

f_pole(alpha, source, iterations) =>
    float fn = na
    float f1 = f_filt9x(alpha, source, 1)
    float f2 = iterations >= 2 ? f_filt9x(alpha, source, 2) : na
    float f3 = iterations >= 3 ? f_filt9x(alpha, source, 3) : na
    float f4 = iterations >= 4 ? f_filt9x(alpha, source, 4) : na
    float f5 = iterations >= 5 ? f_filt9x(alpha, source, 5) : na
    float f6 = iterations >= 6 ? f_filt9x(alpha, source, 6) : na
    float f7 = iterations >= 7 ? f_filt9x(alpha, source, 7) : na
    float f8 = iterations >= 8 ? f_filt9x(alpha, source, 8) : na
    float f9 = iterations == 9 ? f_filt9x(alpha, source, 9) : na
    
    fn := iterations == 1 ? f1 : 
         iterations == 2 ? f2 : 
         iterations == 3 ? f3 : 
         iterations == 4 ? f4 : 
         iterations == 5 ? f5 : 
         iterations == 6 ? f6 : 
         iterations == 7 ? f7 : 
         iterations == 8 ? f8 : 
         iterations == 9 ? f9 : na
    [fn, f1]

beta = (1 - math.cos(4 * math.asin(1) / lengthGC)) / (math.pow(1.414, 2 / poles) - 1)
alpha = -beta + math.sqrt(math.pow(beta, 2) + 2 * beta)
lag = int((lengthGC - 1) / (2 * poles))

srcAdjusted = hlc3 + (hlc3 - hlc3[lag])
[mainFilter, filt1] = f_pole(alpha, srcAdjusted, poles)
[trFilter, tr1] = f_pole(alpha, ta.tr(true), poles)

upperBand = mainFilter + trFilter * multiplier
lowerBand = mainFilter - trFilter * multiplier

// ====== STOCHASTIC RSI ======
rsiValue = ta.rsi(close, lengthRSI)
k = ta.sma(ta.stoch(rsiValue, rsiValue, rsiValue, lengthStoch), smoothK)
stochSignal = k >= overbought

// ====== SEASONAL FILTER (FIXED) ======
currentMonth = month(time)
inSeason = (currentMonth >= startMonth and currentMonth <= 12) or 
         (currentMonth >= 1 and currentMonth <= endMonth)

// ====== VOLATILITY MANAGEMENT ======
atr = ta.atr(atrLength)
positionSize = math.min((strategy.equity * riskPercent/100) / atr, strategy.equity * 0.5 / close)

// ====== TRADING LOGIC ======
trendUp = mainFilter > mainFilter[1]
priceAbove = close > upperBand
longCondition = trendUp and priceAbove and stochSignal and inSeason

exitCondition = ta.crossunder(close, lowerBand)

// ====== EXECUTION ======
if longCondition
    strategy.entry("Long", strategy.long, qty=positionSize)
    
if exitCondition
    strategy.close("Long")

// ====== VISUALIZATION ======
plot(upperBand, "Upper Band", color=color.new(#00FF00, 0))
plot(lowerBand, "Lower Band", color=color.new(#FF0000, 0))
bgcolor(inSeason ? color.new(color.blue, 90) : na, title="Season Filter")