该策略是一个基于多重技术指标的趋势跟踪系统,结合了移动平均线(EMA)、动向指标(DMI)、去趋势价格震荡指标(DPO)、相对强弱指数(RSI)和平均真实波幅(ATR)等多个技术指标,通过多重信号确认来识别强劲趋势并进行交易。策略设计的核心思想是在确认趋势方向、动量和波动性等多个市场特征后才进行交易,以提高交易的成功率。
策略采用三重指数移动平均线(EMA)作为核心趋势判断系统,结合其他技术指标进行多重信号确认: 1. 快速EMA(10日)用于捕捉短期价格动量 2. 中期EMA(25日)作为中期趋势过滤器 3. 慢速EMA(50日)定义整体趋势方向 4. DMI(14日)用于确认趋势的方向强度 5. DPO用于确认价格偏离趋势的程度 6. RSI(14日)用于衡量动量和超买超卖状态 7. ATR(14日)用于设置止损和获利目标
交易信号触发条件: - 做多条件:快线上穿中线且均在慢线之上,ADX>25,RSI>50,DPO>0 - 做空条件:快线下穿中线且均在慢线之下,ADX>25,RSI<50,DPO<0
风险控制措施: - 使用ATR动态止损来适应市场波动 - 实施固定比例风险管理 - 多重指标交叉确认减少假信号
该策略通过多重技术指标的组合应用,构建了一个完整的趋势跟踪交易系统。策略的主要特点是信号确认严格、风险控制合理,适合在日线级别上跟踪中长期趋势。虽然存在一定的滞后性,但通过严格的风险控制和多重信号确认,策略整体表现稳健。建议在实盘应用时注意市场环境的选择,并根据具体品种特性进行参数优化。
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-15 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/
//@version=5
strategy("Daily Strategy with Triple EMA, DMI, DPO, RSI, and ATR", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Input parameters
fastEmaLength = input.int(10, title="Fast EMA Length")
mediumEmaLength = input.int(25, title="Medium EMA Length")
slowEmaLength = input.int(50, title="Slow EMA Length")
dmiLength = input.int(14, title="DMI Length")
adxSmoothing = input.int(14, title="ADX Smoothing")
dpoLength = input.int(14, title="DPO Length")
rsiLength = input.int(14, title="RSI Length")
atrLength = input.int(14, title="ATR Length")
riskPercentage = input.float(2.0, title="Risk Percentage", step=0.1)
atrMultiplier = input.float(1.5, title="ATR Multiplier for Stop Loss", step=0.1)
tpMultiplier = input.float(2.0, title="ATR Multiplier for Take Profit", step=0.1)
// Calculate EMAs
fastEma = ta.ema(close, fastEmaLength)
mediumEma = ta.ema(close, mediumEmaLength)
slowEma = ta.ema(close, slowEmaLength)
// Calculate other indicators
[adx, diPlus, diMinus] = ta.dmi(dmiLength, adxSmoothing)
dpo = close - ta.sma(close, dpoLength)
rsi = ta.rsi(close, rsiLength)
atr = ta.atr(atrLength)
// Trading logic
longCondition = ta.crossover(fastEma, mediumEma) and fastEma > slowEma and mediumEma > slowEma and adx > 25 and rsi > 50 and dpo > 0
shortCondition = ta.crossunder(fastEma, mediumEma) and fastEma < slowEma and mediumEma < slowEma and adx > 25 and rsi < 50 and dpo < 0
// Risk management
riskAmount = (strategy.equity * riskPercentage) / 100
stopLoss = atr * atrMultiplier
takeProfit = atr * tpMultiplier
// Entry and exit logic
if (longCondition)
strategy.entry("Buy", strategy.long)
strategy.exit("Exit Long", "Buy", stop=close - stopLoss, limit=close + takeProfit)
if (shortCondition)
strategy.entry("Sell", strategy.short)
strategy.exit("Exit Short", "Sell", stop=close + stopLoss, limit=close - takeProfit)
// Plot indicators
plot(fastEma, color=color.green, title="Fast EMA")
plot(mediumEma, color=color.orange, title="Medium EMA")
plot(slowEma, color=color.red, title="Slow EMA")
hline(25, "ADX Threshold", color=color.gray, linestyle=hline.style_dotted)