
この戦略は,トレンド追跡とリスク管理を組み合わせた総合的な取引システムである. 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))