MACD 및 RSI 표시를 결합하는 오시일레이터 시장을 위한 거래 전략

저자:차오장, 날짜: 2023-09-13 15:14:43
태그:

이 전략은 MACD와 RSI 지표를 결합한 오스실레이션 시장을 위한 거래 전략 (Trading Strategy for Oscillating Markets Combining MACD and RSI Indicators) 이라고 불립니다. 최근 오스실레이션 및 범위의 암호화 시장에 특별히 설계되어 트렌드 지표 MACD와 모멘텀 오스실레이터 RSI를 통합하여 거래 신호를 생성합니다.

MACD는 이동 평균 회전 분차 지표로 시장 추세와 반전을 판단합니다. 느린 선 위에 빠른 선이 넘어가면서 MACD 크로스오버는 구매 신호를 생성하고, 아래의 크로스오버는 판매 신호를 생성합니다.

RSI는 상대적 강도 지표로, 과소비와 과소비 조건을 측정합니다. RSI 50 이상은 과소비 상태를 제안하고, 50 이하는 과소비입니다. 이 전략은 MACD에서 소란 신호를 필터하기 위해 RSI를 사용합니다.

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

MACD 크로스오버가 느린 라인의 위의 빠른 라인을 넘어서면 단기 트렌드가 하위에서 상향으로 변화한다는 것을 나타냅니다. 그러나 구매 신호는 RSI가 낮은 수준 (예정 매개 변수 이하) 에 있을 때만 확인됩니다.

MACD 크로스오버가 느린 라인 아래의 빠른 라인을 넘어서면, 단기 트렌드가 위에서 아래로 반전되는 것을 표시하지만, 판매 신호는 RSI가 높은 수준 (예정 매개 변수 이상) 에 도달 할 때만 확인됩니다.

이 전략은 수익을 위해 현재 오스실레이션 및 범위의 암호화 시장에 적합합니다. 그러나 단일 거래 손실을 제한하기 위해 스톱 로스를 적용해야합니다. 또한 MACD 및 RSI 매개 변수는 신뢰할 수있는 신호를 위해 시장 조정 최적화가 필요합니다.

결론적으로, MACD와 RSI를 결합하면 변동 시장의 전략 효과를 향상시킬 수 있습니다. 그러나 어떤 지표도 완벽하게 시장을 예측할 수 없습니다. 거래자는 여전히 건전한 시장 트렌드 판단과 유연한 전략 조정이 필요합니다.


/*backtest
start: 2022-09-06 00:00:00
end: 2023-03-11 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Range Strat - MACD/RSI", 
     overlay=true,
     default_qty_type=strategy.percent_of_equity,
     default_qty_value=100, precision=2, initial_capital=100,
     pyramiding=2,
     commission_value=0.05)

// Make input options that configure backtest date range
startDate = input(title="Start Date", defval=13)
startMonth = input(title="Start Month", defval=6)
startYear = input(title="Start Year", defval=2022)

endDate = input(title="End Date", defval=1)
endMonth = input(title="End Month", defval=7)
endYear = input(title="End Year", defval=2200)

// Look if the close time of the current bar
// falls inside the date range
inDateRange = (time >= timestamp(syminfo.timezone, startYear,
         startMonth, startDate, 0, 0)) and
     (time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0))

// RSI Settings
length = input( 14 )
overSold = input( 55 )
overBought = input( 50 )
price = open
vrsi = ta.rsi(price, length)
cu = (vrsi <= overSold)
co = (vrsi >= overBought)

//MACD Settings
fastLength = input(12)
slowlength = input(26)
MACDLength = input(9)
MACD = ta.ema(open, fastLength) - ta.ema(open, slowlength)
aMACD = ta.ema(MACD, MACDLength)
delta = MACD - aMACD
MACDco = ta.crossover(delta, 0)
MACDcu = ta.crossunder(delta, 0)

// Strategy Entry
if (not na(vrsi))
	if (inDateRange and MACDco and cu)
		strategy.entry("LONG", strategy.long, comment="LONG")
	if (inDateRange and MACDcu and co)
		strategy.entry("SHORT", strategy.short, comment="SHORT")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)



더 많은