本策略是一个结合了多重技术指标的趋势跟踪交易系统。它融合了移动平均线(EMA)、波动率跟踪(ATR)、成交量趋势(PVT)和动量振荡器(Ninja)等多个维度的市场信号,通过信号协同来提高交易的准确性。策略采用了动态止损机制,在追踪趋势的同时对风险进行了严格控制。
策略的核心逻辑建立在四个主要支柱之上: 1. 使用200周期EMA作为主要趋势判断依据,将市场分为多头和空头两种状态 2. 基于ATR的Chandelier Exit系统,通过跟踪最高价和最低价并结合波动率来确定趋势的转折点 3. PVT指标通过将价格变化与成交量相结合,用于确认价格趋势的有效性 4. Ninja振荡器通过比较短期和中期均线来捕捉市场动量的变化
交易信号的产生需要满足以下条件: - 做多:价格站在200EMA之上,且Chandelier Exit出现买入信号,同时PVT或Ninja指标确认 - 做空:价格站在200EMA之下,且Chandelier Exit出现卖出信号,同时PVT或Ninja指标确认
该策略通过多指标协同和动态止损机制,构建了一个相对完整的交易系统。策略的核心优势在于其多维度的信号确认机制和严格的风险控制。虽然存在一定的滞后性和假信号风险,但通过持续优化和完善,该策略有望在不同市场环境下保持稳定的表现。建议交易者在实盘使用前,进行充分的回测和参数优化。
/*backtest
start: 2024-11-12 00:00:00
end: 2024-12-11 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Triple Indicator Strategy", shorttitle="TIS", overlay=true)
// --- Inputs ---
var string calcGroup = "Calculation Parameters"
atrLength = input.int(22, title="ATR Period", group=calcGroup)
atrMult = input.float(3.0, title="ATR Multiplier", step=0.1, group=calcGroup)
emaLength = input.int(200, title="EMA Length", group=calcGroup)
// --- ATR and EMA Calculations ---
atr = atrMult * ta.atr(atrLength)
ema200 = ta.ema(close, emaLength)
// --- Chandelier Exit Logic ---
longStop = ta.highest(high, atrLength) - atr
shortStop = ta.lowest(low, atrLength) + atr
var int dir = 1
dir := close > shortStop ? 1 : close < longStop ? -1 : dir
buySignal = dir == 1 and dir[1] == -1
sellSignal = dir == -1 and dir[1] == 1
// --- Price Volume Trend (PVT) ---
pvt = ta.cum((close - close[1]) / close[1] * volume)
pvtSignal = ta.ema(pvt, 21)
pvtBuy = ta.crossover(pvt, pvtSignal)
pvtSell = ta.crossunder(pvt, pvtSignal)
// --- Ninja Indicator ---
ninjaOsc = (ta.ema(close, 3) - ta.ema(close, 13)) / ta.ema(close, 13) * 100
ninjaSignal = ta.ema(ninjaOsc, 24)
ninjaBuy = ta.crossover(ninjaOsc, ninjaSignal)
ninjaSell = ta.crossunder(ninjaOsc, ninjaSignal)
// --- Strategy Conditions ---
longCondition = buySignal and close > ema200 and (pvtBuy or ninjaBuy)
shortCondition = sellSignal and close < ema200 and (pvtSell or ninjaSell)
if longCondition
strategy.entry("Buy", strategy.long)
strategy.exit("Exit Long", "Buy", stop=low - atr)
if shortCondition
strategy.entry("Sell", strategy.short)
strategy.exit("Exit Short", "Sell", stop=high + atr)
// --- Plotting ---
plot(ema200, title="EMA 200", color=color.blue, linewidth=2)
plotshape(buySignal, title="Chandelier Buy", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(sellSignal, title="Chandelier Sell", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
// --- Labels for Buy/Sell with price ---
if buySignal
label.new(bar_index, low, "Buy: " + str.tostring(close), color=color.green, style=label.style_label_up, yloc=yloc.belowbar, size=size.small)
if sellSignal
label.new(bar_index, high, "Sell: " + str.tostring(close), color=color.red, style=label.style_label_down, yloc=yloc.abovebar, size=size.small)
// --- Alerts ---
alertcondition(longCondition, title="Buy Alert", message="Buy Signal Triggered!")
alertcondition(shortCondition, title="Sell Alert", message="Sell Signal Triggered!")