SMA-RSI-MACD 다중 지표 조합 동적 제한 가격 거래 전략

SMA RSI MACD EMA
생성 날짜: 2024-12-11 15:15:49 마지막으로 수정됨: 2024-12-11 15:15:49
복사: 2 클릭수: 435
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

SMA-RSI-MACD 다중 지표 조합 동적 제한 가격 거래 전략

개요

이 전략은 여러 기술 지표들을 결합한 거래 시스템으로, 주로 EMA 평평선 교차, RSI 과매매, MACD 금포크 삼중 신호 확인을 기반으로 입장을 열고, 동적 제한 가격 단일 입점 및 다중 퇴출 메커니즘을 통해 위험을 관리한다. 전략은 9주기 및 21주기 지수 이동 평균을 (EMA) 주요 트렌드 지표로 사용하고, 상대적으로 약한 지수 (RSI) 와 이동 평균 트렌드가 지표 (MACD) 에 뒤떨어진다. 거래 신호를 필터링하고, 제한 가격 단위 거리와 고정 스톱 손실 수를 설정하여 위험을 제어한다.

전략 원칙

이 전략의 핵심 거래 논리는 다음과 같은 핵심 요소를 포함합니다.

  1. 입력 신호는 9주기 EMA에 기초하여 21주기 EMA를 통과할 때 트리거된다.
  2. 입점 가격은 9주기 EMA 아래에서 지점을 지정하는 제한 가격표를 설정합니다.
  3. 거래 확인은 동시에 RSI가 설정된 마이너스보다 낮고 MACD 골드 포크를 충족해야 합니다.
  4. 출구 신호는 MACD 사다리, 고정 스톱 스톱 손실 점수 및 폐쇄 의무 평정 포지션을 포함한다
  5. 거래시간은 오전 9시 30분 이후부터 오후 3시 10분까지로 제한된다.

전략은 한정 가격 단일 입장을 채택하여 더 나은 가격 위치에 입장을 세울 수 있으며, 다중 기술 지표의 조합을 통해 거래의 정확성을 향상시킬 수 있습니다.

전략적 이점

  1. 다중 신호 확인 메커니즘이 거래의 신뢰성을 높여줍니다.
  2. 제한 가격 단독 입장으로 더 나은 거래 가격을 얻을 수 있습니다.
  3. 고정 스톱 스톱 손실 점수는 위험을 제어합니다.
  4. 이명박 정부와 대북정부 간의 협상과 협상
  5. 거래 시간 제한은 오픈 변동성을 피했습니다.
  6. EMA 지표가 트렌드에 더 빠르게 반응합니다.
  7. RSI와 MACD의 조합은 가짜 신호를 필터링 할 수 있습니다.

전략적 위험

  1. 다중 신호 확인으로 인해 일부 거래 기회를 놓칠 수 있습니다.
  2. 가격 상승으로 인해 거래가 불가능할 수 있는 한계 가격
  3. 고정 점수 정지 손실은 높은 변동 기간에 큰 손실이 발생할 수 있습니다.
  4. MACD 신호가 지연될 수 있습니다.
  5. 전략은 시장 변동률의 영향을 고려하지 않았습니다.
  6. 매개 변수 최적화에는 과도한 적합성의 위험이 있습니다.

전략 최적화 방향

  1. 시장의 변동에 따라 동적으로 조정되는 적응된 스톱포인트 수를 도입합니다.
  2. 추가적인 확인 신호로서 거래량 지표를 증가시키는 것
  3. 트렌드 강도 필터를 추가하는 것을 고려하십시오.
  4. 제한 가격 단거리 계산 방법을 최적화하여 ATR 동적 조정을 고려할 수 있습니다.
  5. 불리한 시장 환경을 필터링하기 위해 시장 정서 지표를 추가합니다.
  6. 포지션 관리 메커니즘에 가입하여 신호 강도에 따라 포지션 개수를 조정합니다.

요약하다

이것은 구조가 완전하고, 논리가 명확한 다중 지표 거래 전략이며, 동선 시스템으로 트렌드를 식별하고, RSI와 MACD 필터 신호, 제한 가격 주문 및 다중 손실 장치로 위험을 제어한다. 전략의 장점은 신호 신뢰성이 높고, 위험 제어가 완벽하지만, 신호 지연 및 파라미터 최적화 등의 문제가 있습니다. 동적 파라미터 조정 및 보조 지표를 추가함으로써 전략에는 큰 최적화 공간이 있습니다.

전략 소스 코드
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("SMA 9 & 21 with RSI and MACD Buy Strategy", overlay=true)

// Inputs for Simple Moving Averages
sma_short = ta.ema(close, 9)
sma_long = ta.ema(close, 21)

// Plotting SMA
plot(sma_short, color=color.green, title="SMA 9")
plot(sma_long, color=color.red, title="SMA 21")

// RSI Calculation
rsi_length = input.int(14, title="RSI Length")
rsi_threshold = input.int(70, title="RSI Threshold")
rsi = ta.rsi(close, rsi_length)

// MACD Calculation
macd_fast = input.int(8, title="MACD Fast Length")
macd_slow = input.int(18, title="MACD Slow Length")
macd_signal = input.int(6, title="MACD Signal Length")
[macd_line, signal_line, _] = ta.macd(close, macd_fast, macd_slow, macd_signal)

// Inputs for Limit Order Offset
limit_offset = input.int(50, title="Limit Order Offset", minval=1)  // 50 points below 9 EMA

// User input for specific date
simulationStartDate = input(timestamp("2024-12-01 00:00"), title="Simulation Start Date", group = "Simulation Dates")
simulationEndDate = input(timestamp("2024-12-30 00:00"), title="Simulation End Date", group = "Simulation Dates")

// Declare limit_price as float
var float limit_price = na

// Calculate Limit Order Price
if (sma_short[1] < sma_long[1] and sma_short > sma_long)  // 9 EMA crosses above 21 EMA
    limit_price := sma_short - limit_offset

// Buy Signal Condition (only on the specified date)
buy_condition = not na(limit_price) and rsi < rsi_threshold and ta.crossover(macd_line, signal_line) 

// Sell Signal Condition (MACD crossover down)
sell_condition = ta.crossunder(macd_line, signal_line)

// Track Entry Price for Point-Based Exit
var float entry_price = na

if (buy_condition )
    strategy.order("Buy", strategy.long, comment="Limit Order at 9 EMA - Offset", limit=limit_price)
    label.new(bar_index, limit_price, "Limit Buy", style=label.style_label_up, color=color.green, textcolor=color.white)
    entry_price := limit_price  // Set entry price

// Exit Conditions
exit_by_macd = sell_condition
exit_by_points = not na(entry_price) and ((close >= entry_price + 12) or (close <= entry_price - 12))  // Adjust as per exit points

// Exit all positions at the end of the day
if hour == 15 and minute > 10 and strategy.position_size > 0
    strategy.close_all()  // Close all positions at the end of the day
    strategy.cancel_all()  

// Exit based on sell signal or point movement
if (exit_by_macd or exit_by_points  and strategy.position_size > 0 )
    strategy.close("Buy")
    label.new(bar_index, close, "Close", style=label.style_label_down, color=color.red, textcolor=color.white)