EMA 내일 스칼핑 전략

저자:차오장날짜: 2024-01-24 15:43:31
태그:

img

전반적인 설명

이 전략은 EMA 교차와 촛불 방향에 기반한 구매 및 판매 신호를 식별하기 위해 9일 및 15일 기하급수적 이동 평균 (EMA) 을 계산합니다. 9EMA가 15EMA를 넘어서 마지막 촛불이 상승하고 9EMA가 15EMA를 넘어서 마지막 촛불이 하락할 때 구매 신호를 생성하고 판매 신호를 만듭니다. 전략은 ATR 기반의 스톱 로스도 포함합니다.

전략 논리

  1. 9일 EMA와 15일 EMA를 계산합니다
  2. 마지막 촛불의 방향 (승향 또는 하락) 을 식별
  3. 9EMA가 15EMA를 넘어서고 마지막 촛불이 상승하면 구매 신호를 생성합니다.
  4. 9EMA가 15EMA 아래로 넘어가고 마지막 촛불이 하락하면 판매 신호를 생성합니다.
  5. 거래 중 스톱 로스를 그리기 위해 ATR 표시기를 사용하여 ATR 값을 계산합니다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. EMA 조합을 사용하여 중장기 동향을 파악합니다.
  2. 촛불 방향을 사용하여 잘못된 신호를 필터
  3. 리스크를 제어하기 위해 동적 ATR 스톱 손실을 사용합니다.
  4. 내일 스칼핑에 적합한 짧은 기간
  5. 구현하기 쉽다

위험 분석

위험은 다음과 같습니다.

  1. EMA는 지연 효과, 일부 가격 움직임을 놓칠 수 있습니다.
  2. EMA 크로스오버가 윙사우를 일으킬 수 있습니다.
  3. 내일 거래에서 가격 변동에 취약한 경우
  4. 너무 긴 스톱 손실은 타격을 받기 쉽다, 너무 넓게 이익에 영향을 미칩니다.

해결책:

  1. EMA 매개 변수를 최적화
  2. MACD와 같은 다른 필터를 추가합니다.
  3. 스톱 손실을 동적으로 조정합니다.
  4. 스톱 로스 전략을 최적화

최적화 방향

최적화 할 수 있는 영역:

  1. 최적 기간을 찾기 위해 다른 EMA 조합을 테스트합니다.
  2. 다른 지표를 추가하고 다중 요소 모델을 구축합니다
  3. 시간 프레임 필터를 추가, 특정 기간 동안 신호만
  4. 스톱 로스 레벨을 조정하기 위해 변동성 지수를 포함합니다.
  5. 매개 변수를 동적으로 최적화하기 위해 기계 학습을 사용

요약

이것은 이중 EMA 크로스오버와 촛불 필터링을 ATR 기반의 동적 스톱 로스로 통합하는 간단하면서도 효과적인 내일 스칼핑 전략입니다. 매개 변수 및 다중 요인 조합의 추가 개선은 안정성과 수익성을 향상시킬 수 있습니다.


/*backtest
start: 2023-01-17 00:00:00
end: 2024-01-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("EMA Scalping Strategy", shorttitle="EMAScalp", overlay=true)

// Input parameters
ema9_length = input(9, title="9 EMA Length")
ema15_length = input(15, title="15 EMA Length")

// Calculate EMAs
ema9 = ta.ema(close, ema9_length)
ema15 = ta.ema(close, ema15_length)

// Plot EMAs on the chart
plot(ema9, color=color.blue, title="9 EMA")
plot(ema15, color=color.red, title="15 EMA")

// Identify Bullish and Bearish candles
bullish_candle = close > open
bearish_candle = close < open

// Bullish conditions for Buy Signal
buy_condition = ta.crossover(close, ema9) and ema15 < ema9 and bullish_candle

// Bearish conditions for Sell Signal
sell_condition = ta.crossunder(close, ema9) and ema15 > ema9 and bearish_candle

// Plot Buy and Sell signals
plotshape(series=buy_condition, title="Buy Signal", color=color.green, style=shape.triangleup, location=location.belowbar)
plotshape(series=sell_condition, title="Sell Signal", color=color.red, style=shape.triangledown, location=location.abovebar)

// Optional: Add stop-loss levels
atr_length = input(14, title="ATR Length for Stop Loss")
atr_multiplier = input(1.5, title="ATR Multiplier for Stop Loss")

atr_value = ta.atr(atr_length)
stop_loss_level = strategy.position_size > 0 ? close - atr_multiplier * atr_value : close + atr_multiplier * atr_value
plot(stop_loss_level, color=color.gray, title="Stop Loss Level", linewidth=2)

// Strategy rules
if (buy_condition)
    strategy.entry("Buy", strategy.long)
    strategy.exit("Exit Buy", from_entry="Buy", loss=stop_loss_level)

if (sell_condition)
    strategy.entry("Sell", strategy.short)
    strategy.exit("Exit Sell", from_entry="Sell", loss=stop_loss_level)


더 많은