ガウスチャネルとストキャスティクスRSIに基づくマルチインジケーター適応型取引戦略

GC SRSI HLC3 TR RSI
作成日: 2025-02-21 11:28:34 最終変更日: 2025-02-21 11:28:34
コピー: 0 クリック数: 410
2
フォロー
319
フォロワー

ガウスチャネルとストキャスティクスRSIに基づくマルチインジケーター適応型取引戦略 ガウスチャネルとストキャスティクスRSIに基づくマルチインジケーター適応型取引戦略

概要

この戦略は,高スチャンネルのフィルターとランダムなRSI指標を組み合わせた総合的な取引システムである.高スチャンネルの方向の変化と価格位置によって,ランダムなRSIの超買超売りシグナルと組み合わせて取引機会を決定する.この戦略は,複雑な数学モデルを使用して,自律的なチャネルを構築し,市場騒音を効果的にフィルターし,重要な価格変動を捉える.

戦略原則

戦略の中核となるロジックは、次の主要な要素に基づいています。

  1. 高スチャネル計算: 多極高スフィルターを使用してHLC3価格データを処理し,自己適応チャネルを作成します. 波効果をベータおよびアルファパラメータで最適化し,選択的に遅滞を軽減します.
  2. チャンネル幅調整:実際の波幅 ((TR) に基づいてチャンネル幅を動的に調整し,1.414をデフォルトの倍数として使用する.
  3. ランダムなRSI信号: 14サイクルRSIとランダムな指標を組み合わせて,80以上または20以下で信号を生成する.
  4. 入場条件:高斯通路の上昇,価格の突破,ランダムなRSIトリガーシグナルの3つの条件を同時に満たす必要があります.
  5. 出場論理: 価格が高斯通路上軌道を突破すると平仓する.

戦略的優位性

  1. 信号の信頼性:複数の指標の確認メカニズムにより,取引信号の信頼性が著しく向上した.
  2. 適応性:ゴス通路は市場の変動に応じて通路の幅を自動的に調整できます.
  3. 騒音フィルター:高スキーフィルターは,市場騒音の影響を効果的に軽減します.
  4. 高柔軟性:通路周期,極点数,RSIパラメータなど,複数の調整可能なパラメータを提供します.
  5. 視覚的直感: 色の変化によってトレンドの方向と取引シグナルを直感的に表示する.

戦略リスク

  1. パラメータの感受性: 高氏経路の極点数とサンプリングサイクル設定は,戦略の性能に大きな影響を与える.
  2. 遅滞リスク: 遅滞を減らすための選択肢が提供されているにもかかわらず,指標自体は遅滞性があります.
  3. 偽の突破の危険:横盤市場では頻繁に偽の突破信号が発生する可能性があります.
  4. 資金管理不足:現在のバージョンには詳細なポジション管理メカニズムがない.

戦略最適化の方向性

  1. 市場環境の識別:トレンドの強さの指標を追加し,異なる市場環境で戦略パラメータを調整する.
  2. ダイナミックパラメータ最適化:市場の変動に応じてガースチャネルのパラメータ設定を自動的に調整する.
  3. ポジション管理の改善:変動率に基づくダイナミックなポジション管理システムを導入.
  4. 出場メカニズムの強化:移動の止損と部分的な利益の結束メカニズムの増加.
  5. タイムフレームの最適化:複数のタイムフレームで信号を検証し,取引の安定性を向上させる.

要約する

この戦略は,高位チャネルフィルターとランダムなRSI指標を組み合わせて,強い自適性を持つ取引システムを構築している.高位チャネルの数学的な基礎は,信号の滑らかさと信頼性を保証し,ランダムなRSIの配合は,入場タイミングの正確さをさらに向上させる.戦略の主要な優点は,市場のノイズを効果的にフィルターし,トレンドを正確に把握することにあるが,同時に数値的な最適化とリスク管理の問題にも注意する必要がある.

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

//@version=5
strategy(title="Gaussian Channel Strategy v3.0", overlay=true, calc_on_every_tick=false, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1, slippage=0, fill_orders_on_standard_ohlc=true)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Gaussian Filter Functions (Must be declared first)
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
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
    _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_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]

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------


// Gaussian Channel
int poles = input.int(4, "Poles", 1, 9, group="Gaussian Channel")
int period = input.int(144, "Sampling Period", 2, group="Gaussian Channel")
float mult = input.float(1.414, "True Range Multiplier", group="Gaussian Channel")
bool reducedLag = input.bool(false, "Reduced Lag Mode", group="Gaussian Channel")
bool fastResponse = input.bool(false, "Fast Response Mode", group="Gaussian Channel")

// Stochastic RSI
smoothK = input.int(3, "K", 1, group="Stochastic RSI")
smoothD = input.int(3, "D", 1, group="Stochastic RSI")
lengthRSI = input.int(14, "RSI Length", 1, group="Stochastic RSI")
lengthStoch = input.int(14, "Stochastic Length", 1, group="Stochastic RSI")

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

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

[filterMain, filter1] = f_pole(alpha, srcData, poles)
[filterTRMain, filterTR1] = f_pole(alpha, trData, poles)

finalFilter = fastResponse ? (filterMain + filter1)/2 : filterMain
finalTR = fastResponse ? (filterTRMain + filterTR1)/2 : filterTRMain

hband = finalFilter + finalTR * mult
lband = finalFilter - finalTR * mult

// Stochastic RSI
rsi = ta.rsi(close, lengthRSI)
k = ta.sma(ta.stoch(rsi, rsi, rsi, lengthStoch), smoothK)
d = ta.sma(k, smoothD)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Trading Logic
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
gaussianGreen = finalFilter > finalFilter[1]
priceAbove = close > hband
stochCondition = k > 80 or k < 20

longCondition = gaussianGreen and priceAbove and stochCondition 
exitCondition = ta.crossunder(close, hband) 

strategy.entry("Long", strategy.long, when=longCondition)
strategy.close("Long", when=exitCondition)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
// Visuals
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
filterColor = finalFilter > finalFilter[1] ? #0aff68 : #ff0a5a
plot(finalFilter, "Filter", filterColor, 2)
plot(hband, "High Band", filterColor)
plot(lband, "Low Band", filterColor)
fill(plot(hband), plot(lband), color.new(filterColor, 90), "Channel Fill")