EMA RSI 추세 추종 및 모멘텀 전략


생성 날짜: 2024-03-29 16:30:42 마지막으로 수정됨: 2024-03-29 16:30:42
복사: 0 클릭수: 612
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

EMA RSI 추세 추종 및 모멘텀 전략

개요

Bybit EMA RSI 트렌드 추적과 동력 전략은 지수 이동 평균 ((EMA) 과 상대적으로 강한 지수 ((RSI) 를 결합한 양적 거래 전략이다. 이 전략은 두 개의 다른 주기의 EMA를 사용하여 시장의 흐름을 판단하고 RSI 지수를 사용하여 트렌드의 유효성을 확인한다. 빠른 EMA 상에서 느린 EMA를 통과하고 RSI가 특정 하위 한계보다 낮으면 전략은 여러 신호를 발생시킨다. 반대로, 빠른 EMA 아래에서 느린 EMA를 통과하고 RSI가 특정 상위 한계보다 높으면 전략은 빈 신호를 발생시킨다. 이 전략은 또한 Bybit 계정 계층에 따라 다양한 연금 비율을 설정하고 내장된 중지 손실 기능을 사용하여 위험을 효과적으로 제어 할 수 있습니다.

전략 원칙

  1. 빠른 EMA와 느린 EMA를 계산하고, 순환은 각각 90과 300이다.
  2. RSI를 계산합니다.
  3. 빠른 EMA 상에서 느린 EMA를 통과하고 RSI가 45보다 낮으면 다중 신호가 발생하며, 빠른 EMA 아래에서 느린 EMA를 통과하고 RSI가 85보다 높으면 공백 신호가 발생한다.
  4. Bybit 계정 레벨에 따라 수수료 비율이 다르며 VIP 0의 0.075%에서 VIP 4의 0.035%에 달한다.
  5. 수료가 포함된 개시 가격으로 계산한다.
  6. 정해진 스톱 스톱 손실 비율 ((5%와 3%) 에 따라 스톱 스톱 가격과 스톱 손실 가격을 계산한다.
  7. 차트에 개시 가격, 중지 선 및 중지 선을 그리십시오.
  8. 거래 신호에 따라 포지션 개시 작업을 수행한다.

전략적 이점

  1. 트렌드 추적과 동력 지표가 결합되어 시장의 흐름을 더 잘 포착할 수 있습니다.
  2. 내장된 스톱 손해 방지 기능으로 위험을 효과적으로 제어할 수 있다.
  3. Bybit 계정 레벨에 따라 다른 수수료 비율을 설정하여 다른 사용자의 거래 조건에 맞게 설정합니다.
  4. 포지션 개시 가격, 정지선 및 정지선을 차트에 그리며 직관적인 거래 신호 확인을 제공합니다.

전략적 위험

  1. EMA와 RSI의 선택은 모든 시장 환경에 적합하지 않을 수 있으며 실제 상황에 따라 최적화가 필요합니다.
  2. 이 전략은 불안정한 시장에서 거래 신호를 자주 발생시켜 거래 비용을 높일 수 있습니다.
  3. 정지 손실의 설정은 너무 보수적이거나 급진적일 수 있으며, 개인의 위험 선호도에 따라 조정할 필요가 있다.

전략 최적화 방향

  1. EMA와 RSI의 파라미터를 최적화하여 다른 시장 환경에 맞게 조정한다. 역추적과 파라미터 스캔을 통해 최적의 파라미터 조합을 찾을 수 있다.
  2. 거래 신호의 정확성을 높이기 위해 브린 띠, MACD 등과 같은 다른 기술 지표를 도입한다.
  3. 스톱 스톱 손실의 설정을 최적화하십시오. 예를 들어, 이동 스톱 또는 동적 스톱 손실 방법을 사용하여 수익을 더 잘 보호하고 위험을 제어하십시오.
  4. 시장의 변동성과 거래량과 같은 요소를 고려하여 거래 신호를 필터링하여 거래 빈도의 비용을 절감하십시오.

요약하다

Bybit EMA RSI 트렌드 추적과 동력 전략은 트렌드 추적과 동력 지표를 결합한 정량 거래 전략으로, EMA와 RSI의 조화를 통해 시장의 흐름을 더 잘 포착할 수 있다. 이 전략은 내장된 스톱 손실 기능과 Bybit 계정 수준에 따라 수수료를 설정하는 기능을 통해 위험을 효과적으로 제어하고 사용자의 다른 거래 조건에 적응할 수 있다. 그러나 이 전략에는 여전히 최적화 할 여지가 있습니다.

전략 소스 코드
/*backtest
start: 2024-03-21 00:00:00
end: 2024-03-28 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// @BryanAaron

//@version=5
strategy("Bybit EMA RSI Strategy", overlay=true)

// Input parameters
fastLength = input(90, title="Fast EMA Length")
slowLength = input(300, title="Slow EMA Length")
rsiLength = input(5, title="RSI Length")
rsiUpperThreshold = input(85, title="RSI Upper Threshold")
rsiLowerThreshold = input(45, title="RSI Lower Threshold")
takeProfitPerc = input(5, title="Take Profit %")
stopLossPerc = input(3, title="Stop Loss %")
bybitAccountLevel = input.string("VIP 0", title="Bybit Account Level", options=["VIP 0", "VIP 1", "VIP 2", "VIP 3", "VIP 4"])

// Calculate moving averages
fastMA = ta.ema(close, fastLength)
slowMA = ta.ema(close, slowLength)

// Calculate RSI
rsi = ta.rsi(close, rsiLength)

// Trading conditions
longCondition = (fastMA > slowMA) and (rsi < rsiLowerThreshold)
shortCondition = (fastMA < slowMA) and (rsi > rsiUpperThreshold)

// Set commission based on Bybit account level
commissionPerc = switch bybitAccountLevel
    "VIP 0" => 0.075
    "VIP 1" => 0.065
    "VIP 2" => 0.055
    "VIP 3" => 0.045
    "VIP 4" => 0.035
    => 0.075

// Calculate entry prices with commission
var float longEntryPrice = na
var float shortEntryPrice = na

longEntryPriceWithCommission = close * (1 + commissionPerc / 100)
shortEntryPriceWithCommission = close * (1 - commissionPerc / 100)

// Calculate take profit and stop loss prices
takeProfitPrice(entryPrice) => entryPrice * (1 + takeProfitPerc / 100)
stopLossPrice(entryPrice) => entryPrice * (1 - stopLossPerc / 100)

// Plot entry prices
plotchar(longCondition, title="Long Entry Price", char="LE", location=location.belowbar, color=color.green)
plotchar(shortCondition, title="Short Entry Price", char="SE", location=location.abovebar, color=color.red)

// Draw position on the chart
longColor = color.green
shortColor = color.red
profitColor = color.new(color.green, 80)
lossColor = color.new(color.red, 80)

plotshape(longCondition and strategy.position_size > 0, title="Long Position", text="Long", location=location.belowbar, style=shape.labelup, size=size.small, color=longColor, textcolor=color.white)
plotshape(shortCondition and strategy.position_size < 0, title="Short Position", text="Short", location=location.abovebar, style=shape.labeldown, size=size.small, color=shortColor, textcolor=color.white)

if (strategy.position_size > 0)
    line.new(bar_index, longEntryPrice, bar_index + 1, longEntryPrice, color=longColor, width=2)
    
    longProfitLine = line.new(bar_index, takeProfitPrice(longEntryPrice), bar_index + 1, takeProfitPrice(longEntryPrice), color=profitColor, width=1)
    longLossLine = line.new(bar_index, stopLossPrice(longEntryPrice), bar_index + 1, stopLossPrice(longEntryPrice), color=lossColor, width=1)
    

else if (strategy.position_size < 0)
    line.new(bar_index, shortEntryPrice, bar_index + 1, shortEntryPrice, color=shortColor, width=2)
    
    shortProfitLine = line.new(bar_index, stopLossPrice(shortEntryPrice), bar_index + 1, stopLossPrice(shortEntryPrice), color=profitColor, width=1)
    shortLossLine = line.new(bar_index, takeProfitPrice(shortEntryPrice), bar_index + 1, takeProfitPrice(shortEntryPrice), color=lossColor, width=1)
    


// Entry
if (longCondition)
    strategy.entry("Long", strategy.long)
    longEntryPrice := longEntryPriceWithCommission
else if (shortCondition)
    strategy.entry("Short", strategy.short)
    shortEntryPrice := shortEntryPriceWithCommission