
この戦略は,トレンドオフの価格振動指数 ((DPO) とインデックス移動平均 ((EMA) の交差に基づく定量取引戦略である.戦略の核心思想は,DPOと4周期EMAの関係を比較して市場傾向の変化を捉え,購入と売却のシグナルを生成することである.この戦略は,4時間以上の大規模な時間周期に特に適しており,平滑シフトグラフ ((Heikin Ashi) を使用するときにより効果的です.
戦略の中核となるロジックには、次の主要なステップが含まれます。
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")