듀얼 타임 사이클 슈퍼 트렌드 및 RSI 전략 최적화 시스템

RSI ATR
생성 날짜: 2024-11-25 17:27:21 마지막으로 수정됨: 2024-11-25 17:27:21
복사: 0 클릭수: 464
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

듀얼 타임 사이클 슈퍼 트렌드 및 RSI 전략 최적화 시스템

개요

이 전략은 슈퍼트렌드 지표와 RSI 지표에 기반한 이중 시간 주기의 거래 시스템이다. 120분과 15분 두 개의 시간 주기의 기술 분석 지표를 결합하여, 슈퍼트렌드 지표를 통해 중간 트렌드 방향을 캡처하고, RSI 지표를 사용하여 수익을 창출한다. 전략은 자본 관리 장치를 채택하고, 지위를 분배하는 비율을 사용하며, 백분율에 기반한 중지 조건을 설정한다.

전략 원칙

이 전략의 핵심 논리는 다음과 같은 몇 가지 핵심 요소에 기반합니다.

  1. 120분 주기의 슈퍼트렌드 지표가 주요 트렌드 판단 도구로 사용되며, 이 지표는 ATR 주기가 14이고, 인수는 3.42로 설정됩니다.
  2. 가격과 슈퍼트렌드 선의 교차로 거래 신호를 결정합니다. 위쪽으로 넘어가면 다중 신호가 발생하고 아래쪽으로 넘어가면 공백 신호가 발생합니다.
  3. 15분 주기의 RSI 지표가 보조 도구로 사용되며, RSI 주기는 5로 설정되어 시장의 과열 또는 과냉을 판단합니다.
  4. RSI가 초고 구매 영역에 도달했을 때 (95) 다수 상위 포지션을 평정하고 초고 판매 영역에 도달했을 때 (5), 빈 상위 포지션을 평정합니다.
  5. 포지션 개시 평균 가격에 대한 30%의 비율을 설정

전략적 이점

  1. 다중 시간 주기 조합은 신호의 신뢰성을 높이고, 가짜 신호의 영향을 감소시킨다.
  2. 슈퍼 트렌드 지표의 파라미터 최적화는 트렌드에 대한 감수성을 보장하고 과도한 민감성으로 인한 빈번한 거래를 방지합니다.
  3. RSI 지표의 극한값 설정은 매우 엄격하다 ((5과 95), 극한 상황에서만 평점을 유발하고 조기 퇴장을 피합니다.
  4. 재무관리 계좌의 당기순금액의 고정 비율을 사용함 ((35%)), 효과적으로 위험을 통제하면서 수익 공간을 보장함
  5. 새로운 포지션을 개설하기 전에 자동으로 반전 포지션을 청산하여 동시에 빈 포지션을 보유하는 위험을 피합니다.

전략적 위험

  1. 이중 시간 주기의 전략은 흔들리는 시장에서 지연 효과를 일으킬 수 있으며, 통제된 회귀에 주의해야 합니다.
  2. RSI 지표의 극한값이 너무 엄격하게 설정되어 있기 때문에 수익을 올릴 기회를 놓칠 수 있습니다.
  3. 30%의 막점 설정이 급진적이어서 큰 변동이 있는 시장에서 조기 수익을 얻을 수 있습니다.
  4. 전략은 정지 조건을 설정하지 않았으며, 트렌드가 급격히 역전되면 큰 손실을 입을 수 있습니다.
  5. 35%의 포지션은 비교적 급진적이며, 시장의 급격한 변동이 있을 때 위험합니다.

전략 최적화 방향

  1. ATR 기반의 트래킹 스톱로스를 고려할 수 있는 다이내믹 스톱로스 메커니즘을 추가하는 것이 좋습니다.
  2. RSI의 오버 바이 오버 소드 경계는 적절하게 느려질 수 있으며, 10과 90으로 조정하는 것이 좋습니다.
  3. 신호의 신뢰성을 높이기 위해 보조 확인으로 교류량 지표를 추가할 수 있습니다.
  4. ATR 또는 변동성 지표를 사용하여 시장의 변동성에 따라 역동적으로 조정되는 포지션 비율을 고려하십시오
  5. DMI 또는 ADX 지표와 같은 추세 강도 필터를 추가하여 약한 추세 상황을 필터링하는 것이 좋습니다.

요약하다

이것은 구조가 완전하고, 논리가 명확한 트렌드 추적 전략이다. 다양한 시간 주기에서 기술 지표를 조합하여 트렌드를 파악하면서도 위험 통제에 주의한다. 최적화 할 수있는 공간이 있지만, 전체적인 디자인 아이디어는 정량 거래의 기본 원칙에 부합한다. 거래자는 실장에 사용하기 전에 먼저 역측정을 통해 각 변수를 최적화하고, 자신의 위험 견딜 능력에 따라 포지션 조율을 조정하는 것이 좋습니다.

전략 소스 코드
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © felipemiransan

//@version=5
strategy("Supertrend Strategy", overlay=true)

// Function for Supertrend
supertrend(_factor, _atrPeriod) =>
    [out, _] = ta.supertrend(_factor, _atrPeriod)
    out

// Supertrend Settings
factor = input.float(3.42, title="Supertrend Factor")
atrPeriod = input.int(14, title="ATR Period")
tf2 = input.timeframe("120", title="Supertrend Timeframe")

// RSI Settings
rsi_tf = input.timeframe("15", title="RSI Timeframe")
rsiLength = input.int(5, title="RSI Length")
rsiUpper = input.int(95, title="RSI Upper Limit")  
rsiLower = input.int(5, title="RSI Lower Limit")   

// RSI Timeframe
rsi_tf_value = request.security(syminfo.tickerid, rsi_tf, ta.rsi(close, rsiLength), lookahead=barmerge.lookahead_off, gaps=barmerge.gaps_off)

// Supertrend Timeframe
supertrend_tf2 = request.security(syminfo.tickerid, tf2, supertrend(factor, atrPeriod), lookahead=barmerge.lookahead_off, gaps=barmerge.gaps_off)

// Take Profit Settings (Percentage in relation to the average price)
takeProfitPercent = input.float(30, title="Take Profit", step=0.1) / 100

// Entry conditions based on price crossover with Supertrend Timeframe
longCondition = ta.crossover(close, supertrend_tf2) and barstate.isconfirmed
shortCondition = ta.crossunder(close, supertrend_tf2) and barstate.isconfirmed

// Execution of reversal orders with closing of previous position
if (longCondition)
    // Close a short position before opening a long position
    if (strategy.position_size < 0)
        strategy.close("Short", comment="Close Short for Long Entry")
    strategy.entry("Long", strategy.long)

if (shortCondition)
    // Close long position before opening short position
    if (strategy.position_size > 0)
        strategy.close("Long", comment="Close Long for Short Entry")
    strategy.entry("Short", strategy.short)

// Calculate take profit levels relative to the average entry price
if (strategy.position_size > 0)
    takeProfitLong = strategy.position_avg_price * (1 + takeProfitPercent)
    strategy.exit("Take Profit Long", "Long", limit=takeProfitLong)

if (strategy.position_size > 0 and (rsi_tf_value >= rsiUpper))
    strategy.close("Long", comment="RSI Take Profit Long")

if (strategy.position_size < 0)
    takeProfitShort = strategy.position_avg_price * (1 - takeProfitPercent)
    strategy.exit("Take Profit Short", "Short", limit=takeProfitShort)

if (strategy.position_size < 0 and (rsi_tf_value <= rsiLower))
    strategy.close("Short", comment="RSI Take Profit Short")

// Plot Supertrend timeframe with commit check to avoid repainting
plot(barstate.isconfirmed ? supertrend_tf2 : na, color=color.blue, title="Supertrend Timeframe (120 min)", linewidth=1)

// Plot RSI for visualization
plot(rsi_tf_value, "RSI", color=color.purple)
hline(rsiUpper, "RSI Upper", color=color.red)
hline(rsiLower, "RSI Lower", color=color.green)