
이 전략은 상대적으로 강한 지수 ((RSI) 를 기반으로 역전 추세를 추적하는 ETF 거래 전략이다. RSI 지표를 통해 단기 오버 바이 오버 소드를 판단하고, 역전 엔트리와 엑시트를 수행하며, 200 일 이동 평균을 결합하여 전반적인 경향 방향을 판단한다.
이 전략의 핵심 논리는 RSI 지표의 역전 원칙에 기초한다. RSI 지표는 일정 기간 동안의 평균 상승률을 계산하여 거래 품종이 과매매 상태인지 여부를 판단한다. RSI가 70보다 높으면 과매매를 의미하고 RSI가 30보다 낮으면 과매를 의미한다.
이 전략은 이 원칙을 사용하여 당일 RSI를 조정 가능한 변수보다 낮게 설정합니다.TodaysMinRSI3일 전 RSI가 조정 가능한 변수보다 낮았습니다.Day3RSIMax시점에, 구매를 할 수 있다. 이것은 가격이 단기 오버셀 영역에 있을 수 있음을 의미하며, 반전이 있을 가능성이 있다. 또한 3일 이내에 RSI가 하향 경향을 보이고, 즉 RSI가 계속 하락하기 전에 구매를 하고, 가짜 반전을 피한다.
전략의 출구 메커니즘은 RSI 지표가 다시 조정 가능한 변수를 초과 할 때입니다.Exit RSI이 때, 평준출장마사지 (平仓退出) 가 진행된다.
이 전략은 또한 200일 이동 평균을 전체적인 추세를 판단하기 위해 도입한다. 가격이 200일선보다 높을 때만 구매를 할 수 있다. 이것은 추세 상향 단계에서만 구매를 보장하고 역전 거래의 위험을 피하는 데 도움이 된다.
이 전략은 RSI 지표의 클래식 구매 판매 포인트 원리를 사용하여 오버 구매 오버 판매 지역을 판단하여 역전입 및 출구를 수행한다. 큰 추세 판단과 변수 최적화 공간을 고려하면서 신뢰성이 높은 단기 역전 ETF 전략이다. 추가 최적화를 통해 실전 효과의 양적 전략이 될 수 있다.
/*backtest
start: 2024-01-14 00:00:00
end: 2024-01-21 00:00:00
period: 3m
basePeriod: 1m
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/
// @version = 5
// Author = TradeAutomation
strategy(title="R3 ETF Strategy", shorttitle="R3 ETF Strategy", overlay=true)
// Backtest Date Range Inputs //
StartTime = input(defval=timestamp('01 Jan 2012 05:00 +0000'), title='Start Time')
EndTime = input(defval=timestamp('01 Jan 2099 00:00 +0000'), title='End Time')
InDateRange = true
// Calculations and Inputs //
RSILen = input.int(2, "RSI Length")
RSI = ta.rsi(close, RSILen)
TodaysMinRSI = input.int(10, "Today's Min RSI for Entry", tooltip = "The RSI must be below this number today to qualify for trade entry")
Day3RSIMax = input.int(60, "Max RSI 3 Days Ago for Entry", tooltip = "The RSI must be below this number 3 days ago to qualify for trade entry")
EMA = ta.ema(close, 200)
// Strategy Rules //
Rule1 = close>ta.ema(close, 200)
Rule2 = RSI[3]<Day3RSIMax and RSI<TodaysMinRSI
Rule3 = RSI<RSI[1] and RSI[1]<RSI[2] and RSI[2]<RSI[3]
Exit = ta.crossover(RSI, input.int(70, "Exit RSI", tooltip = "The strategy will sell when the RSI crosses over this number"))
// Plot //
plot(EMA, "200 Day EMA")
// Entry & Exit Functions //
if (InDateRange)
strategy.entry("Long", strategy.long, when = Rule1 and Rule2 and Rule3)
// strategy.close("Long", when = ta.crossunder(close, ATRTrailingStop))
strategy.close("Long", when = Exit)
if (not InDateRange)
strategy.close_all()