This strategy is a comprehensive trading system that combines trend following with risk control. It utilizes a 200-period Exponential Moving Average (EMA) as a trend filter, Relative Strength Index (RSI) as entry signals, while integrating stop-loss, take-profit, and maximum drawdown control mechanisms. The strategy’s main feature is maintaining trend following advantages while strictly controlling risk through dynamic drawdown tracking.
The core logic includes several key components:
This strategy builds a complete trading system by combining trend following with strict risk control. Its core advantages lie in the completeness of risk management and clarity of strategy logic. Through multi-level risk control mechanisms, the strategy can effectively control drawdown while pursuing returns. Although there are some inherent risks, the strategy still has significant room for improvement through the suggested optimization directions.
/*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))