
이 전략은 비 트렌드 가격 변동 지표 ((DPO) 와 지수 이동 평균 ((EMA) 의 교차를 기반으로 한 양적 거래 전략이다. 전략의 핵심 아이디어는 DPO와 4 주기 EMA의 관계를 비교하여 시장 추세의 변화를 포착하여 구매 및 판매 신호를 생성하는 것이다. 이 전략은 특히 4 시간 이상의 큰 시간 주기에는 적합하며, 평평한 슬라이드 도표를 사용하면 더 효과적이다.
전략의 핵심 논리에는 다음과 같은 주요 단계가 포함됩니다.
DPO-EMA 트렌드 크로스 전략은 구조가 단순하지만 효과는 뚜렷한 양적 거래 전략이다. 탈 트렌드 흔들림 지표와 이동 평균을 결합하여 이 전략은 시장 추세 변화를 효과적으로 포착할 수 있다. 일부 고유한 위험이 존재하지만, 합리적인 최적화 및 위험 관리 조치를 통해 이 전략은 여전히 실전 적용 가치가 있다. 중장기 거래자에게는 고려할 가치가 있는 전략 선택이다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("DPO 4,24 Strategy", shorttitle="DPO Strategy", overlay=true)
// Define a fixed lookback period and EMA length
length = 24
ema_length = 4
// Calculate the Simple Moving Average (SMA) of the closing prices
sma = ta.sma(close, length)
// Calculate the shifted SMA value
shifted_sma = sma[length / 2 + 1]
// Calculate the Detrended Price Oscillator (DPO)
dpo = close - shifted_sma
// Calculate the 4-period Exponential Moving Average (EMA) of the DPO
dpo_ema = ta.ema(dpo, ema_length)
// Generate buy and sell signals based on crossovers
buy_signal = ta.crossover(dpo, dpo_ema)
sell_signal = ta.crossunder(dpo, dpo_ema)
// Overlay buy and sell signals on the candlestick chart
plotshape(series=buy_signal, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Strategy entry and exit conditions
if (buy_signal)
strategy.entry("Buy", strategy.long)
if (sell_signal)
strategy.close("Buy")