该策略是一个基于技术分析的趋势跟踪系统,结合了均线系统、RSI动量指标和ATR波动率指标,通过多重信号验证来确认交易机会。策略使用多周期均线交叉判断市场趋势,同时结合RSI动量确认价格强度,最后利用ATR动态设置止损和获利点位,形成了一个完整的交易系统。
策略的核心逻辑包含三个关键部分: 1. 趋势判断:使用100周期与200周期的指数移动平均线(EMA)交叉来确认市场趋势方向。当短期EMA位于长期EMA之上时,表明市场处于上升趋势。 2. 入场信号:在趋势确认的基础上,策略寻找看涨吞没形态作为具体入场点,并使用RSI指标进行信号过滤。当RSI数值大于50时,表明市场具有足够的上升动能。 3. 仓位管理:使用14周期ATR来度量市场波动性,并据此动态设置止损和获利水平。止损设置为1.1倍ATR,获利目标为2.0倍ATR,这种设置保证了盈亏比大于1。
该策略通过整合多个技术指标,构建了一个逻辑完整的趋势跟踪系统。策略的优势在于多重信号验证和动态风险管理,但同时也需要注意处理趋势延迟和假突破等风险。通过添加成交量确认、优化参数设置等方式,策略仍有较大的改进空间。整体而言,该策略适合在明显趋势市场中运行,对于追踪中长期趋势具有良好的应用价值。
/*backtest
start: 2024-11-12 00:00:00
end: 2024-12-11 08:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bullish Engulfing with EMA Crossover and ATR-Based SL/TP with RSI Filter", overlay=true)
// Inputs for moving averages
short_ema_length = input.int(100, title="Short EMA Length")
long_ema_length = input.int(200, title="Long EMA Length")
// RSI Input
rsi_length = input.int(14, title="RSI Length")
rsi_threshold = input.float(50, title="RSI Threshold")
// Calculate the Exponential Moving Averages (EMAs)
short_ema = ta.ema(close, short_ema_length)
long_ema = ta.ema(close, long_ema_length)
// Plot EMAs on the chart
plot(short_ema, color=color.blue, title="100 EMA")
plot(long_ema, color=color.red, title="200 EMA")
// Calculate RSI
rsi_value = ta.rsi(close, rsi_length)
// Plot RSI on a separate panel
hline(rsi_threshold, "RSI Threshold", color=color.gray)
plot(rsi_value, color=color.purple, title="RSI")
// Bullish Engulfing Pattern
bullish_engulfing = close > open[1] and open < close[1] and close > open
// Define strategy entry condition with RSI filter
long_condition = bullish_engulfing and short_ema > long_ema and rsi_value > rsi_threshold
// Plot a buy signal when conditions are met
plotshape(long_condition, style=shape.labelup, location=location.belowbar, color=color.green, title="Buy Signal", text="BUY")
// ATR Calculation
atr_length = input.int(14, title="ATR Length")
atr_value = ta.atr(atr_length)
// Define Stop Loss and Take Profit as levels
stop_loss_level = 1.1 * atr_value
take_profit_level = 2.0 * atr_value
// Execute Strategy Entry
if (long_condition)
strategy.entry("Buy", strategy.long)
// Adjust SL and TP levels using the entry price
if (strategy.position_size > 0)
// Calculate SL and TP relative to the entry price
stop_price = strategy.position_avg_price - stop_loss_level
limit_price = strategy.position_avg_price + take_profit_level
// Exit strategy with SL and TP
strategy.exit("Exit", from_entry="Buy", stop=stop_price, limit=limit_price)