複数期間のガウスチャネルとStochRSIトレンド追跡戦略の組み合わせ

RSI HLC3 TR SMA BAND
作成日: 2025-02-18 13:50:36 最終変更日: 2025-02-18 13:50:36
コピー: 3 クリック数: 503
1
フォロー
1617
フォロワー

複数期間のガウスチャネルとStochRSIトレンド追跡戦略の組み合わせ

概要

この戦略は,高斯波とStochRSI指標に基づくトレンド追跡取引システムである.この戦略は,高斯通路を通じて市場トレンドを識別し,StochRSI指標の超買い超売り区間と組み合わせて,入場タイミングを最適化する.このシステムは,多項的フィットメント方法を使用して高斯通路を構築し,上下軌道の動態調整によって価格トレンドを追跡し,市場動きの正確な追跡を実現する.

戦略原則

戦略の核心は高波アルゴリズムに基づいて構築された価格チャネルである.具体的には以下のいくつかの重要なステップが含まれています:

  1. 多項関数f_filt9xを使用して9次高士波を実現し,極点最適化により波効果を向上させる
  2. HLC3価格に基づく主線と波動率チャネル計算
  3. Reduced Lag モードを導入することで,波の遅延が軽減され,fastResponse モードが応答速度を向上させる.
  4. ストックRSIの超買超売区間 ((8020) を使って取引シグナルを決定する
  5. 高ス通路が上昇し,価格が軌道に突破すると,StochRSI指標と組み合わせて多動信号が生成されます.
  6. 価格が上位に下がった時に平仓に出る

戦略的優位性

  1. 高ステンボールは優れた減噪能力を持ち,市場騒音を効果的にフィルターします.
  2. 多項式マッチングによりトレンドをスムーズに追跡し,偽信号を減らす
  3. 遅延最適化と迅速な応答モードをサポートし,市場の特徴に応じて柔軟に調整できます.
  4. 取引成功率を向上させるための最適化入場時刻とStochRSIの組み合わせ
  5. ダイナミックチャネル幅を利用し,市場の変動率の変化に自律的に適応する

戦略リスク

  1. 高斯波の遅滞により,足し算の遅延が起こりうる.
  2. 波動的な市場では,取引コストを増加させる可能性のある頻繁に取引のシグナル
  3. StochRSIは,特定の市場条件下で遅滞シグナルを発揮する可能性があります.
  4. パラメータ最適化プロセスは複雑で,異なる市場環境でパラメータを再調整する必要があります.
  5. システムの計算資源要求は高い,リアルタイム計算には一定の遅延がある

戦略最適化の方向性

  1. 適応パラメータ最適化メカニズムを導入し,市場の状況に応じてパラメータを動的に調整する
  2. 市場環境認識モジュールを追加し,異なる市場条件で異なるパラメータの組み合わせを使用する
  3. 高波アルゴリズムを最適化し,計算の遅延をさらに削減
  4. 信号信頼性を高めるために,より多くの技術指標を導入し,クロス検証
  5. リスク管理能力の向上のためのインテリジェント・ストップ・メカニズム開発

要約する

この戦略は高波とStochRSIの指標を組み合わせて,市場動向の効果的な追跡を可能にします.システムは,良好な減噪能力とトレンド認識能力を持っていますが,一定の遅れとパラメータの最適化が困難です.継続的な最適化と改善により,この戦略は,実際の取引で安定した収益を期待しています.

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

//@version=5
strategy(title="Demo GPT - Gaussian Channel Strategy v3.0", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=0, default_qty_type=strategy.percent_of_equity, default_qty_value=250)

// ============================================
// Gaussian Functions (Must be at top)
// ============================================
f_filt9x(_a, _s, _i) =>
    var int _m2 = 0, var int _m3 = 0, var int _m4 = 0, var int _m5 = 0, var int _m6 = 0,
    var int _m7 = 0, var int _m8 = 0, var int _m9 = 0, var float _f = 0.0
    _x = 1 - _a
    _m2 := _i == 9 ? 36 : _i == 8 ? 28 : _i == 7 ? 21 : _i == 6 ? 15 : _i == 5 ? 10 : _i == 4 ? 6 : _i == 3 ? 3 : _i == 2 ? 1 : 0
    _m3 := _i == 9 ? 84 : _i == 8 ? 56 : _i == 7 ? 35 : _i == 6 ? 20 : _i == 5 ? 10 : _i == 4 ? 4 : _i == 3 ? 1 : 0
    _m4 := _i == 9 ? 126 : _i == 8 ? 70 : _i == 7 ? 35 : _i == 6 ? 15 : _i == 5 ? 5 : _i == 4 ? 1 : 0
    _m5 := _i == 9 ? 126 : _i == 8 ? 56 : _i == 7 ? 21 : _i == 6 ? 6 : _i == 5 ? 1 : 0
    _m6 := _i == 9 ? 84 : _i == 8 ? 28 : _i == 7 ? 7 : _i == 6 ? 1 : 0
    _m7 := _i == 9 ? 36 : _i == 8 ? 8 : _i == 7 ? 1 : 0
    _m8 := _i == 9 ? 9 : _i == 8 ? 1 : 0
    _m9 := _i == 9 ? 1 : 0
    _f := math.pow(_a, _i) * nz(_s) + _i * _x * nz(_f[1]) - (_i >= 2 ? _m2 * math.pow(_x, 2) * nz(_f[2]) : 0) + (_i >= 3 ? _m3 * math.pow(_x, 3) * nz(_f[3]) : 0) - (_i >= 4 ? _m4 * math.pow(_x, 4) * nz(_f[4]) : 0) + (_i >= 5 ? _m5 * math.pow(_x, 5) * nz(_f[5]) : 0) - (_i >= 6 ? _m6 * math.pow(_x, 6) * nz(_f[6]) : 0) + (_i >= 7 ? _m7 * math.pow(_x, 7) * nz(_f[7]) : 0) - (_i >= 8 ? _m8 * math.pow(_x, 8) * nz(_f[8]) : 0) + (_i == 9 ? _m9 * math.pow(_x, 9) * nz(_f[9]) : 0)
    _f

f_pole(_a, _s, _i) =>
    _f1 = f_filt9x(_a, _s, 1)
    _f2 = _i >= 2 ? f_filt9x(_a, _s, 2) : 0.0
    _f3 = _i >= 3 ? f_filt9x(_a, _s, 3) : 0.0
    _f4 = _i >= 4 ? f_filt9x(_a, _s, 4) : 0.0
    _f5 = _i >= 5 ? f_filt9x(_a, _s, 5) : 0.0
    _f6 = _i >= 6 ? f_filt9x(_a, _s, 6) : 0.0
    _f7 = _i >= 7 ? f_filt9x(_a, _s, 7) : 0.0
    _f8 = _i >= 8 ? f_filt9x(_a, _s, 8) : 0.0
    _f9 = _i == 9 ? f_filt9x(_a, _s, 9) : 0.0
    _fn = _i == 1 ? _f1 : _i == 2 ? _f2 : _i == 3 ? _f3 : _i == 4 ? _f4 : _i == 5 ? _f5 : _i == 6 ? _f6 : _i == 7 ? _f7 : _i == 8 ? _f8 : _i == 9 ? _f9 : na
    [_fn, _f1]

// ============================================
// Date Filter
// ============================================
startDate = input(timestamp("1 Jan 2018"), "Start Date", group="Time Settings")
endDate = input(timestamp("31 Dec 2069"), "End Date", group="Time Settings")
timeCondition = true

// ============================================
// Stochastic RSI (Hidden Calculations)
// ============================================
stochRsiK = input.int(3, "Stoch RSI K", group="Stochastic RSI", tooltip="Only for calculations, not visible")
stochRsiD = input.int(3, "Stoch RSI D", group="Stochastic RSI")
rsiLength = input.int(14, "RSI Length", group="Stochastic RSI")
stochLength = input.int(14, "Stochastic Length", group="Stochastic RSI")

rsiValue = ta.rsi(close, rsiLength)
k = ta.sma(ta.stoch(rsiValue, rsiValue, rsiValue, stochLength), stochRsiK)
d = ta.sma(k, stochRsiD)

// ============================================
// Gaussian Channel
// ============================================
gaussianSrc = input(hlc3, "Source", group="Gaussian")
poles = input.int(4, "Poles", minval=1, maxval=9, group="Gaussian")
samplingPeriod = input.int(144, "Sampling Period", minval=2, group="Gaussian")
multiplier = input.float(1.414, "Multiplier", step=0.1, group="Gaussian")
reducedLag = input.bool(false, "Reduced Lag Mode", group="Gaussian")
fastResponse = input.bool(false, "Fast Response Mode", group="Gaussian")

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

srcData = reducedLag ? gaussianSrc + (gaussianSrc - gaussianSrc[lag]) : gaussianSrc
trData = reducedLag ? ta.tr(true) + (ta.tr(true) - ta.tr(true)[lag]) : ta.tr(true)

[mainFilter, filter1] = f_pole(alpha, srcData, poles)
[trFilter, trFilter1] = f_pole(alpha, trData, poles)

finalFilter = fastResponse ? (mainFilter + filter1) / 2 : mainFilter
finalTrFilter = fastResponse ? (trFilter + trFilter1) / 2 : trFilter

upperBand = finalFilter + finalTrFilter * multiplier
lowerBand = finalFilter - finalTrFilter * multiplier

// ============================================
// Trading Logic
// ============================================
longCondition = 
  finalFilter > finalFilter[1] and      // Green Channel
  close > upperBand and                 // Price above upper band
  (k >= 80 or k <= 20) and             // Stoch RSI condition
  timeCondition

exitCondition = ta.crossunder(close, upperBand)

if longCondition
    strategy.entry("Long", strategy.long)

if exitCondition
    strategy.close("Long")

// ============================================
// Visuals (Gaussian Only)
// ============================================
bandColor = finalFilter > finalFilter[1] ? color.new(#00ff00, 0) : color.new(#ff0000, 0)
plot(finalFilter, "Filter", bandColor, 2)
plot(upperBand, "Upper Band", bandColor)
plot(lowerBand, "Lower Band", bandColor)
fill(plot(upperBand), plot(lowerBand), color.new(bandColor, 90))

barcolor(close > open and close > upperBand ? color.green : 
         close < open and close < lowerBand ? color.red : na)