
이 전략은 축적된 RSI 지표의 트렌드 식별을 활용하여 RSI 지표의 축적된 값이 중요한 경계를 넘어서면 구매 및 판매 작업을 수행합니다. 이 전략은 시장 소음을 효과적으로 필터링하여 더 긴 선의 트렌드 거래 기회를 잠금 할 수 있습니다.
이 전략은 주로 누적된 RSI 지표에 기반한 거래 결정을 한다. 누적된 RSI 지표는 RSI 지표의 누적값이며, 변수 cumlen을 설정하여 RSI 지표의 수치를 cumlen 일 내에 누적하여 누적된 RSI 지표를 얻을 수 있다. 이 지표는 단기 시장 소음을 필터링 할 수 있다.
축적된 RSI 지표에 볼링거 반을 통과할 때, 상위권 거래가 이루어집니다. 축적된 RSI 지표 아래에서 볼링거 반을 통과할 때, 상위권 거래가 이루어집니다. 볼링거 반 반 반은 수년간의 역사적 데이터를 통해 계산되어, 동적 변화의 기준 가격입니다.
또한, 전략은 트렌드 필터 옵션을 추가했다. 가격이 100일 이동 평균보다 높을 때만, 즉 상승 경로에 있을 때만, 거래가 이루어진다. 이 필터는 가격이 흔들릴 때 잘못된 거래를 피할 수 있다.
이 누적 RSI 돌파 전략은 전체적으로 원활하고 논리적으로 작동하며, 누적 RSI 지표를 통해 효율적으로 파동, 트렌드 판단을 증가시키고, 중·장선 트렌드를 정확하게 파악하고, 역사 재검토 성능이 우수합니다. 그러나 여전히 최적화 할 수있는 공간이 있습니다.
/*backtest
start: 2023-09-26 00:00:00
end: 2023-10-26 00:00:00
period: 1h
basePeriod: 15m
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="Cumulative RSI Strategy", shorttitle="CRSI Strategy", process_orders_on_close=true, overlay=true, commission_type=strategy.commission.cash_per_contract, commission_value=.0035, slippage = 1, margin_long = 75, initial_capital = 25000, default_qty_type=strategy.percent_of_equity, default_qty_value=110)
// Cumulative RSI Indicator Calculations //
rlen = input.int(title="RSI Length", defval=3, minval=1)
cumlen = input(3, "RSI Cumulation Length")
rsi = ta.rsi(close, rlen)
cumRSI = math.sum(rsi, cumlen)
ob = (100*cumlen*input(94, "Oversold Level")*.01)
os = (100*cumlen*input(20, "Overbought Level")*.01)
// Operational Function //
TrendFilterInput = input(false, "Only Trade When Price is Above EMA?")
ema = ta.ema(close, input(100, "EMA Length"))
TrendisLong = (close>ema)
plot(ema)
// Backtest Timeframe Inputs //
startDate = input.int(title="Start Date", defval=1, minval=1, maxval=31)
startMonth = input.int(title="Start Month", defval=1, minval=1, maxval=12)
startYear = input.int(title="Start Year", defval=2010, minval=1950, maxval=2100)
endDate = input.int(title="End Date", defval=1, minval=1, maxval=31)
endMonth = input.int(title="End Month", defval=1, minval=1, maxval=12)
endYear = input.int(title="End Year", defval=2099, minval=1950, maxval=2100)
InDateRange = (time >= timestamp(syminfo.timezone, startYear, startMonth, startDate, 0, 0)) and (time < timestamp(syminfo.timezone, endYear, endMonth, endDate, 0, 0))
// Buy and Sell Functions //
if (InDateRange and TrendFilterInput==true)
strategy.entry("Long", strategy.long, when = ta.crossover(cumRSI, os) and TrendisLong, comment="Buy", alert_message="buy")
strategy.close("Long", when = ta.crossover(cumRSI, ob) , comment="Sell", alert_message="Sell")
if (InDateRange and TrendFilterInput==false)
strategy.entry("Long", strategy.long, when = ta.crossover(cumRSI, os), comment="Buy", alert_message="buy")
strategy.close("Long", when = ta.crossover(cumRSI, ob), comment="Sell", alert_message="sell")
if (not InDateRange)
strategy.close_all()