
RSI 평행선 교차 전략은 암호화폐 거래에 적용되는 전략이다. 이 전략은 이동 평균을 RSI 지표에 적용하고 RSI와 이동 평균의 교차 상황에 따라 구매 및 판매 신호를 발송한다.
이 전략은 먼저 RSI 지표를 계산한다. RSI 지표는 일정 시간 동안의 하락 하락 변화를 기반으로 가격의 강점을 반영한다. RSI가 70보다 큰 것은 초고 구매 지역이며, 30보다 작은 것은 초판 판매 지역이다.
이 전략은 RSI 지표에 기반한 이동 평균을 적용한다. 이동 평균은 무작위적인 변동을 필터링하여 트렌드 방향을 판단한다. 여기에 10 주기의 RSI 이동 평균이 설정되어 있다.
RSI 상에서 이동 평균을 통과하면 구매 신호로 간주되며, RSI 아래에서 이동 평균을 통과하면 판매 신호로 간주됩니다. 이 두 신호에 따라 거래합니다.
코드에서, 먼저 length 주기의 RSI 지표를 계산한다. 그리고 10 주기의 RSI의 이동 평균 ma를 계산한다. ma가 rsi를 통과하면 구매; ma가 rsi를 통과하면 판매.
또한, rsi, ma의 선형 도형을 그리고 rsi-ma의 기둥 도형을 그렸다. rsi=70, rsi=30의 경계선을 그렸다. 그리고 매매할 때, 도표에 해당하는 신호 화살을 표시했다.
리스크에 맞게, 지표 효과를 최적화하기 위해 파라미터를 조정할 수 있으며, 포지션을 적절히 줄이고, 스톱 라인을 설정하고, 트렌드 분석과 함께 신호를 필터링 할 수 있다.
RSI 평행선 교차 전략은 트렌드 지표와 필터 지표의 장점을 결합하여 비교적 성숙하고 신뢰할 수 있습니다. 이 전략의 논리는 간단하고 이해하기 쉽고, 코드 구현도 완전하며, 전반적으로 더 나은 암호화폐 거래 전략입니다. 그러나 모든 전략에는 최적화가 필요한 곳이 있으며, 지속적인 테스트와 조정이 필요하며, 더 나은 전략 효과를 얻기 위해 트렌드 판단에 보조됩니다.
/*backtest
start: 2022-10-31 00:00:00
end: 2023-11-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("RSI w MA Strategy", shorttitle="RSI w MA Strategy", overlay=false, initial_capital=10000, currency='USD',process_orders_on_close=true)
//TIME FRAME AND BACKGROUND CONTROL/////////////////////////////////////////////
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(01, "Backtest Start Month")
testStartDay = input(01, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, 0, 0)
testStopYear = input(2022, "Backtest Stop Year")
testStopMonth = input(1, "Backtest Stop Month")
testStopDay = input(1, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, 0, 0)
testPeriodBackground = input(title="Color Background?", type=input.bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and time >= testPeriodStart and time <= testPeriodStop ?
color.teal : na
//bgcolor(testPeriodBackgroundColor, transp=50)
testPeriod() => true
////////////////////////////////////////////////////////////////////////////////
src = close, len = input(27, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
window = input(10, "RSI MA Window")
ma = sma(rsi,window)
plot(rsi, color=color.orange)
colorr= ma > rsi ? color.red : color.green
plot(ma,color=colorr)
band1 = hline(70)
band0 = hline(30)
fill(band1, band0, color=color.purple, transp=90)
diff = rsi - ma
plot(diff,style= plot.style_columns,transp=50,color = colorr)
plotshape(crossunder(rsi,ma)?rsi:na,title="top",style=shape.triangledown,location=location.absolute,size=size.tiny,color=color.red,transp=0)
plotshape(crossover(rsi,ma)?rsi:na,title="bottom",style=shape.triangleup,location=location.absolute,size=size.tiny,color=color.lime,transp=0)
buySignal = crossover(rsi,ma)
sellSignal = crossunder(rsi,ma)
//TRADE CONTROL/////////////////////////////////////////////////////////////////
if testPeriod()
if buySignal
strategy.close("Short", qty_percent = 100, comment = "Close Short")
strategy.entry("Long", strategy.long, qty=.1)
if sellSignal
strategy.close("Long", qty_percent = 100, comment = "Close Long")
strategy.entry("Short", strategy.short, qty=.1)
////////////////////////////////////////////////////////////////////////////////