ADX,RSI,SMA 다중 지표 결합 거래 전략

저자:차오장, 날짜: 2023-09-14 16:19:46
태그:

전략 논리

이 전략은 다양한 기술적 지표를 결합하여 트렌드 방향과 거래 신호에 대한 과잉 구매 / 과잉 판매 수준을 식별합니다.

사용된 주요 지표는 다음과 같습니다.

  1. 평균 방향 지수 (ADX): 트렌드 강도

  2. 상대적 강도 지수 (RSI): 과잉 구매/ 과잉 판매

  3. 단순 이동 평균 (SMA): 단기 트렌드

  4. 슈퍼트렌드: 장기/단기 트렌드

  5. 채널 브레이크: 트렌드 브레이크 엔트리

거래의 논리는 다음과 같습니다.

  1. ADX는 트렌드 존재와 강도를 보여줍니다

  2. 슈퍼트렌드는 장기/단기 트렌드의 조화를 확인합니다.

  3. RSI는 과잉 구매/ 과잉 판매 지역을 식별합니다.

  4. SMA 크로스오버에 입력

  5. 채널 브레이크에 입력

다중 지표 조합은 신호 정확성을 향상시킵니다. 다양한 전략이 체계적인 접근으로 결합됩니다.

장점

  • 여러 지표가 품질을 향상시킵니다

  • 체계적인 진입을 위한 전략 결합

  • ADX는 트렌드, RSI 과잉 구매/ 과잉 판매를 식별합니다.

  • 슈퍼트렌드는 트렌드, SMA 및 채널 브레이크 엔트리를 포착합니다.

위험성

  • 멀티 파라미터 조정 최적화 요구

  • 합동 상태는 덜 자주 발생합니다.

  • 해결하기 어려운 상반된 지표 신호

요약

이 전략은 다양한 지표의 강점을 완전히 활용하여 견고한 시스템을 구축합니다. 그러나 매개 변수 최적화는 이상적인 거래 빈도에 핵심입니다. 전반적으로 강력한 트렌드 식별과 효율적인 항목을 결합합니다.


/*backtest
start: 2023-09-12 00:00:00
end: 2023-09-13 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// strategy("Combined Strategy", overlay=true, default_qty_value=100, initial_capital=1000, margin_long=0.1)

adxlen = input(7, title="ADX Smoothing")
dilen = input(7, title="DI Length")
dirmov(len) =>
    up = ta.change(high)
    down = -ta.change(low)
    plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
    minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
    truerange = ta.rma(ta.tr, len)
    plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
    minus = fixnan(100 * ta.rma(minusDM, len) / truerange)
    [plus, minus]

adx(dilen, adxlen) =>
    [plus, minus] = dirmov(dilen)
    sum = plus + minus
    adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
sig = adx(dilen, adxlen)

// The same on Pine Script™
pine_supertrend(factor, atrPeriod) =>
    src = hl2
    atr = ta.atr(atrPeriod)
    upperBand = src + factor * atr
    lowerBand = src - factor * atr
    prevLowerBand = nz(lowerBand[1])
    prevUpperBand = nz(upperBand[1])

    lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
    upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
    int direction = na
    float superTrend = na
    prevSuperTrend = superTrend[1]
    if na(atr[1]) and ta.rsi(close, 21) < 66 and ta.rsi(close,3) > 80 and ta.rsi(close, 28) > 49 and sig > 20
        direction := 1
    else if prevSuperTrend == prevUpperBand
        direction := close > upperBand ? -1 : 1
    else
        direction := close < lowerBand ? 1 : -1
    superTrend := direction == -1 ? lowerBand : upperBand
    [superTrend, direction]

[pineSupertrend, pineDirection] = pine_supertrend(3, 10)
upTrend = pineDirection < 0
downTrend = pineDirection > 0

// Define the 20-period SMA
sma20 = ta.sma(close, 20)

a = ta.rsi(close,14)
OB = input(70)
OS = input(30)
os = a > OB
ob = a < OS

if upTrend and close > pineSupertrend and close > sma20 and os
    strategy.entry("Buy", strategy.long)

if ta.crossunder(close, sma20) or ob
    strategy.close_all()

//define when to breakout of channel 
//("ChannelBreakOutStrategy", overlay=true)
length = input.int(title="Length", minval=1, maxval=1000, defval=5)
upBound = ta.highest(high, length)
downBound = ta.lowest(low, length)
if (not na(close[length]))
	strategy.entry("ChBrkLE", strategy.long, stop=upBound + syminfo.mintick, comment="ChBrkLE")
strategy.entry("ChBrkSE", strategy.short, stop=downBound - syminfo.mintick, comment="ChBrkSE")


더 많은