EMA 채널 및 MACD 기반의 단기 거래 전략

저자:차오장, 날짜: 2024-01-23 14:30:02
태그:

img

전반적인 설명

이 전략은 EMA 채널 및 MACD 기반 단기 거래 전략이라고 불립니다. 트렌드를 식별하고 거래 신호를 생성하기 위해 EMA 채널과 MACD 지표를 결합합니다.

원칙

이 전략은 EMA 채널을 형성하기 위해 5일 EMA와 21일 EMA를 사용합니다. 5일 EMA가 21일 EMA를 넘으면 상승 신호로 간주됩니다. 5일 EMA가 21일 EMA를 넘으면 하향 신호로 간주됩니다. MACD 히스토그램은 잘못된 신호를 필터링할 수 있습니다. MACD 히스토그램이 0보다 높을 때만 구매 신호가 생성됩니다. MACD 히스토그램이 0보다 낮을 때만 판매 신호가 생성됩니다. 신호가 활성화되면 고정 스톱 로스로 주문을하고 수익을 취합니다. 가격이 EMA 채널로 돌아온 경우 트렌드를 따르기 위해 신호가 다시 활성화됩니다.

이점 분석

이 전략은 트렌드 식별과 지표 필터링을 결합하여 단기 트렌드 방향을 효과적으로 식별 할 수 있습니다. 주요 트렌드 방향을 결정하고 잘못된 신호를 필터하기 위해 MACD 히스토그램을 EMA 채널을 사용하여 수익성을 크게 향상시킬 수 있습니다. 고정 스톱 손실 및 이익 취득 메커니즘은 또한 좋은 리스크 보상 비율을 보장합니다. 전반적으로이 전략은 단기 거래에 적합합니다. 특히 주식 및 강력한 추진력을 가진 외환에 적합합니다.

위험 분석

이 전략은 주로 단기 거래에 적합하며 장기 및 범위 시장에서 성능이 좋지 않습니다. 장기 측면 시장에서 EMA 채널 크로스오버가 자주 발생하지만 대부분은 잘못된 신호입니다. MACD 히스토그램이 필터링에 역할을 할 수 있지만 효과는 여전히 제한적입니다. 또한 고정 스톱 로스 및 영업이익은 장기 트렌드에서 증대 수익을 얻는 것을 어렵게 만듭니다. 따라서이 전략의 주요 위험입니다. 해결책은 시장 조건에 따라 매개 변수를 유연하게 조정하거나 현재 시장 조건에 더 적합한 다른 전략으로 전환하는 것입니다.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. EMA 매개 변수를 최적화하여 특정 거래 도구의 수익을 극대화하는 매개 변수 조합을 찾습니다.

  2. 필터링 효과를 높이기 위해 MACD 매개 변수를 최적화합니다.

  3. 시장 변동성이 증가할 때 스톱 로스 범위를 넓히기 위해 변동성 지표를 포함합니다.

  4. 후속 스톱 로스 메커니즘을 추가하여 스톱 로스를 가격에 더 가깝게 만들고 수익성을 보장하면서 불필요한 스톱 로스 트리거를 줄입니다.

결론

이 전략은 상대적으로 높은 수익성을 가지고 있으며 특히 단기 거래에 적합합니다. 높은 빈도 양적 거래 전략 중 좋은 선택입니다. 그러나 거래자는 거래 위험을 제어하면서 전략 수익을 극대화하기 위해 사용 할 때 시장 조건에 따라 합리적으로 매개 변수를 조정해야합니다.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © moondevonyt

//@version=5
strategy("Scalping with EMA channel and MACD", overlay=true)

// Exponential moving average inputs
ema21 = ta.ema(close, 21)
ema5 = ta.ema(close, 5)

// MACD inputs
fastLength = 18
slowLength = 34
signalSmoothing = 12

[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)
macdHistogram = macdLine - signalLine

// Buy and sell conditions
buyCondition = ta.crossover(ema5, ema21) and macdHistogram > 0
sellCondition = ta.crossunder(ema5, ema21) and macdHistogram < 0

// Re-entry conditions
reEntryBuyCondition = close > ema21
reEntrySellCondition = close < ema21

// Set stop loss and take profit
stopLoss = 8
takeProfit = 15

// Execute Strategy
if buyCondition
    strategy.entry("Buy", strategy.long)
    strategy.exit("Take Profit/Stop Loss", "Buy", stop=close - stopLoss, limit=close + takeProfit)
if reEntryBuyCondition
    strategy.entry("Re-Enter Buy", strategy.long)
    strategy.exit("Take Profit/Stop Loss", "Re-Enter Buy", stop=close - stopLoss, limit=close + takeProfit)

if sellCondition
    strategy.entry("Sell", strategy.short)
    strategy.exit("Take Profit/Stop Loss", "Sell", stop=close + stopLoss, limit=close - takeProfit)
if reEntrySellCondition
    strategy.entry("Re-Enter Sell", strategy.short)
    strategy.exit("Take Profit/Stop Loss", "Re-Enter Sell", stop=close + stopLoss, limit=close - takeProfit)

// Plotting EMAs and MACD
plot(ema21, color=color.blue, title="21 EMA")
plot(ema5, color=color.orange, title="5 EMA")
plot(macdHistogram, color=color.red, title="MACD Histogram")

// Plot buy and sell signals
plotshape(series=buyCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=sellCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")

더 많은