이동 평균 RSI 암호화 상관관계 트렌드 전략

저자:차오장, 날짜: 2023-12-12 10:26:21
태그:

img

전반적인 설명

이것은 장기적인 암호화폐 트렌드를 따르는 전략으로 이동 평균, 상대 강도 지수 (RSI) 및 시장 상관관계를 결합하여 중장기 가격 트렌드를 식별하고, 트렌드가 시작될 때 포지션을 설정하고, 트렌드를 따라 피라미드를 만들고, 트렌드 역전 신호가 감지되면 이익을 취합니다.

전략 논리

이 전략은 주로 세 가지 지표에 기반합니다.

  1. 상대적 강도 지수 (RSI): 과잉 구매 및 과잉 판매 상태를 식별합니다. 51 이상은 과잉 구매로 간주되며 49 이하는 과잉 판매로 간주됩니다.

  2. 단순 이동 평균 (SMA): 추세 방향을 결정하기 위해 닫기 가격의 9일 SMA.

  3. 시장 상관관계: 거래 도구와의 상관관계를 계산하는 기준으로 전체 암호화 자본을 사용하며 신호 품질을 향상시키기 위해 원래 바를 상관관계 바로 대체합니다.

특히 거래 규칙은 다음과 같습니다.

롱 엔트리: RSI가 51을 넘어서고 클로즈 가격이 9일 SMA를 넘으면

단기 엔트리: RSI가 49 이하로 넘어가고 클로즈 가격이 9일 SMA 이하로 떨어지면

수익/손실 중지: 장래 거래의 1%/0.1%, 쇼트 거래의 0.05%/0.03%

또한 거래 기간을 제한하는 시간 조건이 있습니다.

이점 분석

  1. 추세와 과잉 구매/ 과잉 판매 지표를 결합하면 중장기 추세를 효과적으로 추적할 수 있습니다.

  2. 시장 상관관계는 신호 품질을 향상시키고 잘못된 추세를 피합니다.

  3. 합리적인 수익을 취하고 손해를 멈추면 손실이 커지는 것을 방지합니다.

  4. 사용자 정의 가능한 거래 기간은 다른 시장 조건에 적응합니다.

위험 분석

  1. 윙사 또는 단기적으로 변동적인 시장에서 효과적이지 않습니다.

  2. 벤치마크 반전은 거래 도구의 지연 출구로 이어질 수 있습니다.

  3. 단지 롱/쇼트만 할 때 역전 기회를 놓칠 수 있습니다.

해결책:

  1. 단기 지표를 추가합니다. 예를 들어, 시장 체제 탐지 및 중지에 대한 KC, BOLL.

  2. 적시에 퇴출을 위한 벤치마크 분석을 개선합니다.

  3. 반전을 포착하기 위해 양면적 인 도구를 거래하십시오.

최적화 방향

  1. 시장 통계에 기초한 RSI, SMA, 수익 취득/손실 중지 매개 변수 조정

  2. 보다 높은 상관관계와 유동성을 가진 더 많은 벤치마크/거래 조합을 평가합니다.

  3. 다른 전략과 결합해서 중장기 지분을 위해 이 전략을 사용하세요.

결론

이것은 중장기 암호화폐 트렌드를 따르는 최적화되고 광범위하게 적응 가능한 전략이다. 트렌드, 모멘텀 및 상관 분석을 효과적으로 결합하여 거래 결정을 향상시킵니다. 적절한 매개 변수 조정 및 복합 사용은 안정성과 수익성을 크게 향상시킬 수 있습니다. 긴 보유 기간은 또한 암호화폐 시장의 고휘발성 및 정확하게 캡처하기 어려운 성격에 적합합니다.


/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99

//@version=4
strategy(title = "Crypto swing correlation", overlay = true,  pyramiding=1,initial_capital = 1, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)

//time
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2010, title = "From Year", minval = 1970)
 //monday and session 
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)

startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = true

useCorrelation    = input(true, title="Use Correlation candles?")

symbol = input("BTC_USDT:swap", type=input.symbol)

haClose = useCorrelation ? security(symbol, timeframe.period, close) : close
haOpen  = useCorrelation ? security(symbol, timeframe.period, open) : open
haHigh  = useCorrelation ? security(symbol, timeframe.period, high) : high
haLow   = useCorrelation ? security(symbol, timeframe.period, low) : low

length = input( 50 )
overSold = input( 51 )
overBought = input( 49 )

s = input(title="Source", defval="haClose", options=["haClose", "haOpen", "haHigh", "haLow"])

price = s == "haClose" ? haClose: s == "haOpen" ? haOpen : s == "haHigh" ? haHigh : s == "haLow" ? haLow : na

len = input(8, "Length Moving average", minval=1)
src = price
ma = sma(src, len)


vrsi = rsi(price, length)
long = crossover(vrsi, overSold) and time_cond and price > ma
short = crossunder(vrsi, overBought) and time_cond and price < ma


takeProfit_long=input(1.0, step=0.005)
stopLoss_long=input(0.1, step=0.005)
takeProfit_short=input(0.05, step=0.005)
stopLoss_short=input(0.03, step=0.005)

strategy.entry("long",1,when=long)
strategy.entry("short",0,when=short)

strategy.exit("short_tp/sl", "long", profit=close * takeProfit_long / syminfo.mintick, loss=close * stopLoss_long / syminfo.mintick, comment='LONG EXIT',  alert_message = 'closeshort')
strategy.exit("short_tp/sl", "short", profit=close * takeProfit_short / syminfo.mintick, loss=close * stopLoss_short / syminfo.mintick, comment='SHORT EXIT',  alert_message = 'closeshort')


더 많은