RSI와 이동 평균의 브레이크업 전략

저자:차오장, 날짜: 2024-01-24 14:31:01
태그:

img

전반적인 설명

RSI 및 이동 평균 브레이크아웃 전략은 RSI 지표와 이동 평균 라인을 모두 활용하여 거래 기회를 결정하는 양적 전략이다. 이 전략의 핵심 아이디어는 RSI가 과소매 또는 과소매 수준에 도달 할 때 이동 평균의 방향으로 더 나은 브레이크아웃 포인트를 찾는 것입니다.

전략 논리

  1. 사용자 정의 매개 변수를 기반으로 RSI 지표와 간단한 이동 평균 라인을 계산합니다.

  2. RSI가 oversold 라인 (디폴트 30) 을 넘을 때, 가격이 LONG 출구 이동 평균 이하라면 긴 신호가 생성됩니다.

  3. RSI가 과잉 매수 라인 (디폴트 70) 아래를 넘을 때, 가격이 SHORT 출구 이동 평균보다 높으면 짧은 신호가 생성됩니다.

  4. 사용자는 트렌드 이동 평균 라인을 기반으로 신호를 필터링할 수 있습니다. 가격이 필터링 이동 평균보다 높거나 낮을 때만 신호가 생성됩니다.

  5. 출구는 LONG 및 SHORT 출구 이동 평균 라인에 의해 결정됩니다.

이점 분석

  1. 이중 지표 설계는 두 가지 주요 시장 요인을 통합함으로써 정확도를 향상시킵니다.

  2. RSI의 평균 반전 특성을 효과적으로 활용하여 전환점을 찾습니다.

  3. 이동평균을 가진 추가 필터는 상위와 하위를 쫓는 것을 피하기 위해 논리적 엄격성을 증가시킵니다.

  4. 사용자 정의 가능한 매개 변수는 다양한 제품과 시간 프레임에 최적화를 허용합니다.

  5. 간단한 논리는 그것을 이해하기 쉽고 수정하기 쉽습니다.

위험 분석

  1. Whipsaws는 RSI에서 흔한 현상입니다. 밀도 지표가 도움이 될 수 있습니다.

  2. RSI는 더 큰 시간 프레임에서 실패하는 경향이 있습니다. 매개 변수를 조정하거나 추가 지표가 도움이 될 수 있습니다.

  3. 이동평균은 지연 효과를 가지고, 길이가 단축되거나 MACD와 같은 지표가 도움이 될 수 있습니다.

  4. 기본 논리 때문에 신호를 검증하기 위해 더 많은 지표가 도입되어야 합니다.

최적화 방향

  1. RSI 매개 변수를 최적화하거나 거짓 신호를 줄이기 위해 밀도 지표를 도입합니다.

  2. 트렌드와 지원을 찾기 위해 DMI와 BOLL와 같은 트렌드 및 변동성 지표를 포함합니다.

  3. 이동 평균 판단을 대체하거나 보완하기 위해 MACD를 도입하십시오.

  4. 불리한 탈출을 피하기 위해 입력 신호에 더 많은 논리적 조건을 추가합니다.

결론

RSI와 이동평균 브레이크아웃 전략은 이론적으로 평균회복 기회를 활용하기 위해 RSI의 과잉 구매 과잉 판매 검출과 이동평균의 트렌드 결정을 결합합니다. 전략은 직관적이고 초보자에게 사용하기 쉽고 다양한 제품에 최적화 될 수 있으므로 권장되는 시작량 전략입니다. 더 많은 보조 지표를 도입하여 신호를 더욱 검증하고 수익성을 향상시킬 수 있습니다.


/*backtest
start: 2024-01-16 00:00:00
end: 2024-01-23 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Global Market Signals: RSI Strategy.
//@version=4
strategy("GMS: RSI Strategy", overlay=true)

LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
RSILength = input(title="RSI Length", type = input.integer ,defval=14)
RSIUpper = input(title="Upper Threshold", type = input.float ,defval=70)
RSILower = input(title="Lower Threshold", type = input.float ,defval=30)
LongExit = input(title="Long Exit SMA Length", type = input.integer ,defval=5)
ShortExit = input(title="Short Exit SMA Length", type = input.integer ,defval=5)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TrendLength = input(title="Trend SMA Length", type = input.integer ,defval=200)


//Long Side

if LongShort =="Long Only" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Long Only" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close>sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit) and close<sma(close,TrendLength))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("LONG", true, when = rsi(close,RSILength)<RSILower and close< sma(close,LongExit))
    strategy.close("LONG", when = close>sma(close,LongExit))
    
    
//SHORT SIDE

if LongShort =="Short Only" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Short Only" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Above"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close>sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Below"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit) and close<sma(close,TrendLength))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
if LongShort =="Both" and AboveBelow == "Don't Include"
    strategy.entry("SHORT", false, when = rsi(close,RSILength)>RSIUpper and close> sma(close,ShortExit))
    strategy.close("SHORT", when = close<sma(close,ShortExit))
    
    
    
    
    
    
   





더 많은