StochRSI 추세 추적 전략과 결합된 다중 기간 가우시안 채널

RSI HLC3 TR SMA BAND
생성 날짜: 2025-02-18 13:50:36 마지막으로 수정됨: 2025-02-18 13:50:36
복사: 3 클릭수: 503
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

StochRSI 추세 추적 전략과 결합된 다중 기간 가우시안 채널

개요

이 전략은 고스 스 파동과 스토흐RSI 지표에 기반한 트렌드 추적 거래 시스템이다. 이 전략은 고스 채널을 통해 시장 트렌드를 식별하고, 스토흐RSI 지표의 오버 바이 오버 셀 영역과 결합하여 진입 시기를 최적화한다. 이 시스템은 다중 모음 방법을 사용하여 고스 채널을 구성하고, 상하 궤도의 동적인 조정으로 가격 트렌드를 추적하여 시장 움직임에 대한 정확한 추적을 구현한다.

전략 원칙

이 전략의 핵심은 고스 웨이브 알고리즘에 기반한 가격 통로입니다. 구체적으로 구현하는 데는 다음과 같은 몇 가지 중요한 단계가 포함됩니다:

  1. 다항 함수 f_filt9x를 사용하여 9단 고스파를 구현하고, 극점 최적화를 통해 필터링 효과를 향상시킵니다.
  2. HLC3 가격에 기반한 주파수 선과 변동률 채널
  3. 줄인 지연 모드 (reducedLag) 를 도입하여 필러파 지연을 줄이고, 빠른 응답 모드 (fastResponse) 를 도입하여 응답 속도를 향상시킵니다.
  4. 스토치RSI 지표의 오버 바이 오버 소드 범위를 사용하여 ((8020) 거래 신호를 결정합니다.
  5. 고스 통로가 상승하고 가격이 궤도를 돌파 할 때, StochRSI 지표와 결합하여 다중 신호를 생성합니다.
  6. 가격 하락 시 중점을 두는 것

전략적 이점

  1. 고스파는 우수한 소음 억제 능력을 가지고 있으며, 시장 소음을 효과적으로 필터링 할 수 있습니다.
  2. 트렌드를 부드럽게 추적하고, 가짜 신호를 줄이기 위해 다항 모형을 사용한다.
  3. 지연 최적화 및 신속한 응답 모드를 지원하고 시장 특성에 따라 유연하게 조정할 수 있습니다.
  4. 거래 성공률을 높이기 위한 최적화된 입시 시점과 스토치RSI
  5. 동적 채널 폭을 사용하여 시장 변동률 변화에 적응

전략적 위험

  1. 고스바는 다소 지연되어 출전이나 출전 시간이 부족할 수 있습니다.
  2. 불안한 시장에서 거래 비용을 증가시키는 빈번한 거래 신호가 발생할 수 있습니다.
  3. StochRSI는 특정 시장 조건에서 지연 신호를 일으킬 수 있습니다.
  4. 매개 변수 최적화 과정은 복잡하며, 다른 시장 환경으로 매개 변수를 재조정해야 합니다.
  5. 시스템에서 컴퓨팅 자원에 대한 요구가 높고, 실시간 컴퓨팅에는 지연이 있다.

전략 최적화 방향

  1. 시장 상황에 따라 동적으로 변수를 조정하는 적응 변수 최적화 메커니즘을 도입합니다.
  2. 시장 환경 인식 모듈을 추가하여 다른 시장 조건에 따라 다른 파라미터 조합을 사용합니다.
  3. 고스피노파 알고리즘을 최적화하여 계산 지연을 더욱 줄일 수 있습니다.
  4. 신호 신뢰성을 높이기 위해 더 많은 기술 지표를 도입합니다.
  5. 지능형 손해 방지 장치 개발, 위험 관리 능력 향상

요약하다

이 전략은 고스톤 파동과 스토흐RSI 지표를 결합하여 시장 추세를 효과적으로 추적합니다. 시스템은 좋은 소음 능력과 추세를 인식하는 능력을 가지고 있지만, 약간의 지연성과 파라미터를 최적화하는 데 어려움이 있습니다. 지속적인 최적화와 개선으로 이 전략은 실제 거래에서 안정적인 수익을 얻을 수 있습니다.

전략 소스 코드
/*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)