
이 전략은 트렌드 추적과 위험 통제를 결합한 통합 거래 시스템이다. 그것은 200 주기 지수 이동 평균을 ((EMA) 트렌드 필터로, 상대적으로 강한 지수를 ((RSI) 입시 신호로 사용하며, 중지, 중지 및 최대 회수 제어 장치를 통합한다. 전략의 주요 특징은 트렌드 추적 우위를 유지하면서 동적 회수 추적을 통해 위험을 엄격히 제어하는 것이다.
전략의 핵심 논리는 다음과 같은 몇 가지 핵심 구성 요소를 포함합니다.
이 전략은 트렌드 추적과 엄격한 위험 통제를 결합하여 완전한 거래 시스템을 구축한다. 그것의 핵심 장점은 위험 관리의 완전성과 전략 논리의 명확성에 있다. 다층적 위험 제어 장치로 인해, 전략은 수익을 추구하면서 효과적으로 회수 제어 할 수 있다.
/*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))