该策略是一个结合了趋势跟踪和风险控制的综合交易系统。它使用200周期指数移动平均线(EMA)作为趋势过滤器,相对强弱指标(RSI)作为入场信号,同时集成了止损、止盈以及最大回撤控制机制。策略的主要特点是在保持趋势跟踪优势的同时,通过动态回撤跟踪来严格控制风险。
策略的核心逻辑包含以下几个关键组件: 1. 趋势识别:使用200周期EMA作为主要趋势判断指标,只有价格在EMA之上才考虑做多。 2. 动量确认:使用RSI指标作为动量确认工具,当RSI值超过设定阈值(默认50)时才允许入场。 3. 风险管理: - 设置百分比止损(默认20%)和止盈(默认40%) - 动态回撤跟踪系统,当策略总体回撤超过设定限制(默认30%)时自动平仓所有持仓 4. 仓位管理:采用账户权益百分比(默认10%)进行仓位控制
该策略通过结合趋势跟踪和严格的风险控制,构建了一个完整的交易系统。其核心优势在于风险管理的完备性和策略逻辑的清晰性。通过多层次的风险控制机制,策略能够在追求收益的同时有效控制回撤。虽然存在一些固有的风险,但通过建议的优化方向,策略仍有较大的提升空间。
/*backtest
start: 2024-11-19 00:00:00
end: 2024-12-19 00:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="Disruptor Trend-Following (Drawdown < 30%)", shorttitle="DisruptorStrategyDD", overlay=true)
//-----------------------------------------------------
// User Inputs
//-----------------------------------------------------
emaLen = input.int(200, "Long EMA Length", minval=1)
rsiLen = input.int(14, "RSI Length", minval=1)
rsiThreshold = input.float(50, "RSI Buy Threshold", minval=1, maxval=100)
stopLossPerc = input.float(20, "Stop-Loss %", minval=0.1, step=0.1)
takeProfitPerc = input.float(40, "Take-Profit %", minval=0.1, step=0.1)
ddLimit = input.float(30, "Max Drawdown %", minval=0.1, step=0.1)
//-----------------------------------------------------
// Indicators
//-----------------------------------------------------
emaValue = ta.ema(close, emaLen)
rsiValue = ta.rsi(close, rsiLen)
//-----------------------------------------------------
// Conditions
//-----------------------------------------------------
longCondition = close > emaValue and rsiValue > rsiThreshold
exitCondition = close < emaValue or rsiValue < rsiThreshold
//-----------------------------------------------------
// Position Tracking
//-----------------------------------------------------
var bool inTrade = false
if longCondition and not inTrade
strategy.entry("Long", strategy.long)
if inTrade and exitCondition
strategy.close("Long")
inTrade := strategy.position_size > 0
//-----------------------------------------------------
// Stop-Loss & Take-Profit
//-----------------------------------------------------
if inTrade
stopPrice = strategy.position_avg_price * (1 - stopLossPerc / 100)
takeProfitPrice = strategy.position_avg_price * (1 + takeProfitPerc / 100)
strategy.exit("Exit", from_entry="Long", stop=stopPrice, limit=takeProfitPrice)
//-----------------------------------------------------
// Dynamic Drawdown Handling
//-----------------------------------------------------
var float peakEquity = strategy.equity
peakEquity := math.max(peakEquity, strategy.equity)
currentDrawdownPerc = (peakEquity - strategy.equity) / peakEquity * 100
if currentDrawdownPerc > ddLimit
strategy.close_all("Max Drawdown Exceeded")
//-----------------------------------------------------
// Plotting
//-----------------------------------------------------
plot(emaValue, title="EMA 200", color=color.yellow, linewidth=2)
plotchar(rsiValue, title="RSI", char='•', location=location.bottom, color=color.new(color.teal, 60))