
이 전략은 단순한 그냥 더 많이 하고, RSI 지표를 사용하여 과매매를 판단하는 전략이다. 우리는 이것을 강화하고, 중지 손실을 추가하고, 확률 모듈을 통합하여 확률을 높이고, 최근 기간 동안 수익 거래의 확률이 51%보다 크거나 같을 때만 포지션을 개설한다. 이것은 전략의 성능을 크게 향상시킨다.
이 전략은 RSI 지표를 사용하여 시장의 과매매를 판단합니다. 구체적으로, RSI가 설정된 과매 영역의 하위 한계를 넘어서면 더 많이합니다. RSI가 설정된 과매 영역의 상위 한계를 넘어서면 평소합니다. 또한, 우리는 스톱 스톱 비율을 설정합니다.
중요한 것은, 우리는 확률 판단 모듈을 통합했다. 이 모듈은 최근 기간 동안 (lookback 파라미터를 통해 설정된) 더 많은 거래를 한 것이 손실인지의 비율을 통계화한다. 최근 수익 거래의 확률이 51% 이상일 때만 더 많은 위치를 열 수 있다. 이것은 손실 거래의 가능성을 크게 줄여준다.
이 RSI 전략은 확률을 높여서 일반 RSI 전략에 비해 다음과 같은 장점을 가지고 있습니다.
이 전략에는 위험도 있습니다.
대응방법:
이 전략은 다음의 몇 가지 측면에서 더 개선될 수 있습니다.
이 전략은 간단한 RSI 전략으로, 통합 확률 판단 모듈을 강화한다. 일반 RSI 전략에 비해, 일부 손실 거래를 필터링 할 수 있으며, 전체적인 회수 및 손실 비율을 최적화 할 수 있다. 후속적으로 공백, 동적 최적화 등의 측면에서 개선할 수 있어 전략이 더 튼튼하다.
/*backtest
start: 2023-11-19 00:00:00
end: 2023-12-19 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/
// © thequantscience
//@version=5
strategy("Reinforced RSI",
overlay = true,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 100,
pyramiding = 1,
currency = currency.EUR,
initial_capital = 1000,
commission_type = strategy.commission.percent,
commission_value = 0.07)
lenght_rsi = input.int(defval = 14, minval = 1, title = "RSI lenght: ")
rsi = ta.rsi(close, length = lenght_rsi)
rsi_value_check_entry = input.int(defval = 35, minval = 1, title = "Oversold: ")
rsi_value_check_exit = input.int(defval = 75, minval = 1, title = "Overbought: ")
trigger = ta.crossunder(rsi, rsi_value_check_entry)
exit = ta.crossover(rsi, rsi_value_check_exit)
entry_condition = trigger
TPcondition_exit = exit
look = input.int(defval = 30, minval = 0, maxval = 500, title = "Lookback period: ")
Probabilities(lookback) =>
isActiveLong = false
isActiveLong := nz(isActiveLong[1], false)
isSellLong = false
isSellLong := nz(isSellLong[1], false)
int positive_results = 0
int negative_results = 0
float positive_percentage_probabilities = 0
float negative_percentage_probabilities = 0
LONG = not isActiveLong and entry_condition == true
CLOSE_LONG_TP = not isSellLong and TPcondition_exit == true
p = ta.valuewhen(LONG, close, 0)
p2 = ta.valuewhen(CLOSE_LONG_TP, close, 0)
for i = 1 to lookback
if (LONG[i])
isActiveLong := true
isSellLong := false
if (CLOSE_LONG_TP[i])
isActiveLong := false
isSellLong := true
if p[i] > p2[i]
positive_results += 1
else
negative_results -= 1
positive_relative_probabilities = positive_results / lookback
negative_relative_probabilities = negative_results / lookback
positive_percentage_probabilities := positive_relative_probabilities * 100
negative_percentage_probabilities := negative_relative_probabilities * 100
positive_percentage_probabilities
probabilities = Probabilities(look)
lots = strategy.equity/close
var float e = 0
var float c = 0
tp = input.float(defval = 1.00, minval = 0, title = "Take profit: ")
sl = input.float(defval = 1.00, minval = 0, title = "Stop loss: ")
if trigger==true and strategy.opentrades==0 and probabilities >= 51
e := close
strategy.entry(id = "e", direction = strategy.long, qty = lots, limit = e)
takeprofit = e + ((e * tp)/100)
stoploss = e - ((e * sl)/100)
if exit==true
c := close
strategy.exit(id = "c", from_entry = "e", limit = c)
if takeprofit and stoploss
strategy.exit(id = "c", from_entry = "e", stop = stoploss, limit = takeprofit)