듀얼 타임 피리어드 슈퍼 트렌드 RSI 지능형 트레이딩 전략

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

듀얼 타임 피리어드 슈퍼 트렌드 RSI 지능형 트레이딩 전략

개요

이 전략은 5분 및 60분 두 개의 시간 주기를 통해 초상 추세 지표와 연동하고, RSI 지표와 결합하여 거래 신호를 확인하며, 완벽한 포지션 관리 메커니즘을 갖추고 있습니다. 이 전략은 일간 거래 및 포지션 거래 두 가지 모드를 지원하며, 유연한 스톱 손실 및 모바일 스톱 손실 설정 옵션을 제공합니다.

전략 원칙

이 전략은 다음과 같은 핵심 논리를 기반으로 거래합니다.

  1. ATR 주기는 10이고, 요소는 3.0이며, 5분 및 60분 시간 주기에서 계산된다.
  2. 5분과 60분 사이클에서, 초상향 지표는 다방향이며, RSI가 60보다 크면, 다중 신호를 트리거한다.
  3. 5분과 60분 사이클에서, 초상향 지표는 공허 방향이고 RSI가 40보다 작으면, 공허 신호를 유발한다.
  4. 5분 주기 초 트렌드 지표가 변할 때, 평점 지점은 해당 방향의 지점을 유지한다.
  5. 60분 초 트렌드 지표가 상수일 때는 공백을 허용하지 않으며, 60분 초 트렌드 지표가 공백일 때는 더 많은 공백을 허용하지 않는다.
  6. 점수나 비율에 기반한 스톱, 스로즈, 모바일 스로즈 기능을 제공한다.
  7. 일일 거래 모드에서는 지정된 거래 시간 내에만 포지션을 개설한다.

전략적 이점

  1. 다주기 연동: 다른 시간주기를 결합한 초트렌드 지표를 통해 가짜 신호를 효과적으로 감소시킨다.
  2. RSI 확인: RSI 지표를 사용하여 트렌드를 확인하고 거래의 신뢰성을 향상시킵니다.
  3. 완벽한 풍력 제어: 고정된 손실, 비율 손실 및 이동 손실을 포함하여 다양한 스톱 스톱 프로그램을 제공합니다.
  4. 유연성: 거래자의 요구에 따라 일간 또는 포지션 모드를 선택할 수 있으며 거래 시간을 사용자 정의 할 수 있습니다.
  5. 트렌드 추적: 초트렌드 지표의 방향 변화를 통해 자동 평정 포지션을 사용하여 트렌드 전환점을 효과적으로 파악한다.

전략적 위험

  1. 흔들림 시장 위험: 가로판 흔들림 시장에서 거래 신호가 자주 발생하여 과도한 거래가 발생할 수 있습니다.
  2. 슬라이드 포인트 위험: 시장의 격렬한 변동이 있을 때, 슬라이드 포인트로 인해 스톱 손실 또는 스톱 가격이 예상에서 벗어날 수 있다.
  3. 신호 지연: 60 분 주기 지표를 사용했기 때문에 트렌드 전환점에서 신호 지연이 발생할 수 있습니다.
  4. 자금 관리 위험: 만약 스톱 로즈 설정이 잘못되면, 한 번에 너무 큰 손실이 발생할 수 있습니다.

전략 최적화 방향

  1. 변동율 자조를 도입한다: 시장 변동율 동력에 따라 조정할 수 있는 초트렌드 인자 및 ATR 주기.
  2. 트래픽 지표 증가: 트래픽 분석을 결합하여 신호 신뢰도를 향상시킵니다.
  3. 최적 RSI 마이너스 (RSI Optimization): RSI 매매 마이너스 (RSI Buy/Sell) 를 최적화하기 위한 데이터의 재검토를 통해 최적의 RSI 매매 마이너스 (RSI Buy/Sell) 를 결정한다.
  4. 포지션 관리를 개선: 동적 포지션 관리 메커니즘을 추가하고, 시장의 위험도에 따라 포지션 개설 비율을 자동으로 조정한다.
  5. 트렌드 강도 필터를 추가: 트렌드 강도 지표를 도입하여 약한 트렌드 환경에서의 거래 신호를 필터링하십시오.

요약하다

이것은 합리적이고 논리적으로 엄격한 트렌드 추적 전략을 설계했다. 다중 주기 연동 및 RSI 확인 메커니즘을 통해 거래 신호의 신뢰성을 효과적으로 향상시켰다. 완벽한 위험 제어 메커니즘과 유연한 파라미터 설정으로 실전 응용 가치가있다. 거래자는 실장에서 사용하기 전에 각 파라미터를 충분히 테스트하고 특정 거래 유형과 시장 환경에 따라 타겟팅 최적화를 수행하도록 권장한다.

전략 소스 코드
/*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"}]
*/

//@version=5
// Author: Debabrata Saha
strategy("Supertrend Dual Timeframe with RSI", overlay=true)

// Input for System Mode (Positional/Intraday)
systemMode = input.string("Intraday", title="System Mode", options=["Intraday", "Positional"])

// Input for Intraday Session Times
startSession = input(timestamp("2023-10-01 09:15"), title="Intraday Start Session (Time From)")
endSession = input(timestamp("2023-10-01 15:30"), title="Intraday End Session (Time To)")

// Input for Target Settings (Off/Points/%)
targetMode = input.string("Off", title="Target Mode", options=["Off", "Points", "%"])
target1Value = input.float(10, title="Target 1 Value", step=0.1)
target2Value = input.float(20, title="Target 2 Value", step=0.1)

// Input for Stoploss Settings (Off/Points/%)
stoplossMode = input.string("Off", title="Stoploss Mode", options=["Off", "Points", "%"])
stoplossValue = input.float(10, title="Stoploss Value", step=0.1)

// Input for Trailing Stop Loss (Off/Points/%)
trailStoplossMode = input.string("Off", title="Trailing Stoploss Mode", options=["Off", "Points", "%"])
trailStoplossValue = input.float(5, title="Trailing Stoploss Value", step=0.1)

// Supertrend settings
atrPeriod = input(10, title="ATR Period")
factor = input(3.0, title="Supertrend Factor")

// Timeframe definitions
timeframe5min = "5"
timeframe60min = "60"

// Supertrend 5-min and 60-min (ta.supertrend returns two values: [Supertrend line, Buy/Sell direction])
[st5minLine, st5minDirection] = ta.supertrend(factor, atrPeriod)
[st60minLine, st60minDirection] = request.security(syminfo.tickerid, timeframe60min, ta.supertrend(factor, atrPeriod))

// RSI 5-min
rsi5min = ta.rsi(close, 14)

// Conditions for Buy and Sell signals
isSupertrendBuy = (st5minDirection == 1) and (st60minDirection == 1)
isSupertrendSell = (st5minDirection == -1) and (st60minDirection == -1)

buyCondition = isSupertrendBuy and (rsi5min > 60)
sellCondition = isSupertrendSell and (rsi5min < 40)

// Exit conditions
exitBuyCondition = st5minDirection == -1
exitSellCondition = st5minDirection == 1

// Intraday session check
inSession = true

// Strategy Logic (Trades only during the intraday session if systemMode is Intraday)
if (buyCondition and inSession)
    strategy.entry("Buy", strategy.long)

if (sellCondition and inSession)
    strategy.entry("Sell", strategy.short)

// Exit logic using strategy.close() to close the position at market price
if (exitBuyCondition)
    strategy.close("Buy")

if (exitSellCondition)
    strategy.close("Sell")

// No Sell when 60-min Supertrend is green and no Buy when 60-min Supertrend is red
if isSupertrendSell and (st60minDirection == 1)
    strategy.close("Sell")

if isSupertrendBuy and (st60minDirection == -1)
    strategy.close("Buy")

// Target Management
if (targetMode == "Points")
    strategy.exit("Target 1", "Buy", limit=close + target1Value)
    strategy.exit("Target 2", "Sell", limit=close - target2Value)
if (targetMode == "%")
    strategy.exit("Target 1", "Buy", limit=close * (1 + target1Value / 100))
    strategy.exit("Target 2", "Sell", limit=close * (1 - target2Value / 100))

// Stoploss Management
if (stoplossMode == "Points")
    strategy.exit("Stoploss", "Buy", stop=close - stoplossValue)
    strategy.exit("Stoploss", "Sell", stop=close + stoplossValue)
if (stoplossMode == "%")
    strategy.exit("Stoploss", "Buy", stop=close * (1 - stoplossValue / 100))
    strategy.exit("Stoploss", "Sell", stop=close * (1 + stoplossValue / 100))

// Trailing Stop Loss
if (trailStoplossMode == "Points")
    strategy.exit("Trail SL", "Buy", trail_price=na, trail_offset=trailStoplossValue)
    strategy.exit("Trail SL", "Sell", trail_price=na, trail_offset=trailStoplossValue)
if (trailStoplossMode == "%")
    strategy.exit("Trail SL", "Buy", trail_price=na, trail_offset=trailStoplossValue / 100 * close)
    strategy.exit("Trail SL", "Sell", trail_price=na, trail_offset=trailStoplossValue / 100 * close)