RSI 평균 역전 거래 전략

저자:차오장, 날짜: 2023-09-12 14:37:28
태그:

이 전략은 RSI 지표의 평균 반전 특성에 기반합니다. 과잉 구매 및 과잉 판매 RSI는 다시 되돌리는 경향이 있으며 거래 기회를 창출합니다. 전략은 장기 / 단위 포지션을 체계적으로 설정하기 위해 RSI를 사용하여 과잉 구매 / 과잉 판매 상태를 식별합니다.

전략 논리:

  1. RSI 값을 계산하고 일반적으로 60과 30의 과잉 구매 및 과잉 판매 임계치를 설정합니다.

  2. RSI가 과잉 매수선을 넘어가면, 단위로 가세요.

  3. RSI가 과판선을 넘으면, 롱으로 가세요.

  4. 긴 스톱 손실은 진입 가격 * (1 - 스톱 손실 %). 짧은 스톱 손실은 진입 가격 * (1 + 스톱 손실 %).

  5. 만약 가격이 스톱 로스를 달성한다면, 포지션을 종료합니다.

장점:

  1. RSI를 이용한 트렌드 리브레이크 중에 리버전 기회를 포착합니다.

  2. 브레이크아웃 트레이딩은 트렌드 반전 시에 적시에 진입할 수 있습니다.

  3. 스톱 로스는 단일 거래 손실 금액을 제어합니다.

위험성:

  1. RSI는 잘못된 신호를 주는 경향이 있습니다. 다른 지표로 확인하세요.

  2. 너무 긴 스톱 손실은 과도한 스톱을 유발합니다. 범위를 넓히는 것을 고려하십시오.

  3. 적당한 타이밍에 진입하면 너무 큰 포지션으로 이어질 수 있습니다.

요약하자면, RSI 평균 역전 전략은 RSI 과잉 확장 거래를 수행합니다. 단일 거래에서 통제 손실로 추세를 따르지만 RSI 신뢰도는 낮습니다. 투자자는 다른 확인 지표, 최적화된 스톱과 함께 신중하게 사용해야하며 소박한 장기 수익을 기대해야합니다.


/*backtest
start: 2022-09-05 00:00:00
end: 2023-09-11 00:00:00
period: 1d
basePeriod: 1h
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/
// © relevantLeader16058

//@version=4
strategy(shorttitle='RSI Bot Strategy',title='Quadency Mean Reversion Bot Strategy', overlay=true, initial_capital = 100, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type=strategy.commission.percent, commission_value=0.08)

//Backtest dates
start = input(defval = timestamp("08 Mar 2021 00:00 -0600"), title = "Start Time", type = input.time)
finish = input(defval = timestamp("9 Mar 2021 23:59 -0600"), title = "Start Time", type = input.time)
window()  => true       // create function "within window of time"

// Complete Control over RSI inputs and source price calculations
lengthRSI = input(14, minval=1)
source = input(title="Source", type=input.source, defval=close)
strat = input(title="Strategy", defval="Long/Short", options=["Long Only", "Long/Short", "Short Only"])
strat_val = strat == "Long Only" ? 1 : strat == "Long/Short" ? 0 : -1
stoploss = input(5.00, "Stop Loss %")
oversold= input(30)
overbought= input(60)

// Standard RSI Calculation
RSI = rsi(close, lengthRSI)
stLossLong=(1-(stoploss*.01))
stLossShort=(1+(stoploss*.01))

//Long and Short Strategy Logic
GoLong = crossunder(RSI, oversold) and window()
GoShort = crossover(RSI, overbought) and window()

// Strategy Entry and Exit
if (GoLong)
    if strat_val > -1
        strategy.entry("LONG", strategy.long)
    if strat_val < 1
        strategy.close("SHORT")
    

if (GoShort)
    if strat_val > -1
        strategy.close("LONG")
    if strat_val < 1
        strategy.entry("SHORT", strategy.short)


LongStopLoss = barssince(GoLong)<barssince(GoShort) and crossunder(low, valuewhen(GoLong, close, 0)*stLossLong)

ShortStopLoss = barssince(GoLong)>barssince(GoShort) and crossover(high, valuewhen(GoShort, close, 0)*stLossShort)

if (ShortStopLoss)
    strategy.close("SHORT")
    
if (LongStopLoss)
    strategy.close("LONG")






더 많은