
이 전략은 종합적인 트렌드 추적 거래 시스템으로, 여러 기술적 지표가 결합되어 시장의 추세와 거래 시간을 결정한다. 전략의 핵심은 빠른 속도와 느린 간단한 이동 평균 (SMA) 의 교차 신호에 기반하며, 상대적으로 약한 지표 (RSI) 와 평균 트렌드 지수 (ADX) 를 통해 추세를 확인하며, 실제 파장을 활용하여 위험 관리를 한다. 전략은 재원 관리 원칙을 채택하여, 단일 거래의 위험을 계좌 자금의 2% 이상으로 제한한다.
전략 운영 메커니즘은 다음과 같은 몇 가지 핵심 요소로 구성됩니다.
이 전략은 여러 기술 지표의 조합 응용을 통해, 비교적 완전한 트렌드 추적 거래 시스템을 구축한다. 전략은 설계에 신호 신뢰성 및 위험 관리에 초점을 맞추고, 좋은 실용성을 가지고 있다. 최적화 권고의 실행을 통해, 전략은 성능을 더욱 향상시킬 것으로 보인다. 실제 적용 전에 충분한 피드백 검증을 수행하고, 특정 거래 품목 특성에 따라 파라미터를 최적화하는 것이 좋습니다.
/*backtest
start: 2025-02-16 17:00:00
end: 2025-02-20 00:00:00
period: 4m
basePeriod: 4m
exchanges: [{"eid":"Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("SMA + RSI + ADX + ATR Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=2)
// === Input Parameters ===
sma_fast_length = input(10, title="SMA Fast Period")
sma_slow_length = input(200, title="SMA Slow Period")
rsi_length = input(14, title="RSI Period")
adx_length = input(14, title="ADX Period")
adx_smoothing = input(14, title="ADX Smoothing Period") // <-- New parameter!
atr_length = input(14, title="ATR Period")
// === Filtering Levels for RSI and ADX ===
rsi_buy_level = input(50, title="RSI Buy Level")
rsi_sell_level = input(50, title="RSI Sell Level")
adx_min_trend = input(20, title="ADX Minimum Trend Strength")
// === Trailing Stop ===
use_trailing_stop = input(true, title="Enable Trailing Stop")
trailing_stop_pips = input(30, title="Trailing Stop (Pips)")
trailing_step_pips = input(5, title="Trailing Step (Pips)")
// === Indicators ===
sma_fast = ta.sma(close, sma_fast_length)
sma_slow = ta.sma(close, sma_slow_length)
rsi_value = ta.rsi(close, rsi_length)
[diPlus, diMinus, adx_value] = ta.dmi(adx_length, adx_smoothing) // <-- Corrected: added `adx_smoothing`
atr_value = ta.atr(atr_length)
// === Entry Logic ===
longCondition = ta.crossover(sma_fast, sma_slow) and rsi_value > rsi_buy_level and adx_value > adx_min_trend
shortCondition = ta.crossunder(sma_fast, sma_slow) and rsi_value < rsi_sell_level and adx_value > adx_min_trend
// === Open Positions ===
if longCondition
strategy.entry("BUY", strategy.long)
if shortCondition
strategy.entry("SELL", strategy.short)
// === Trailing Stop ===
if use_trailing_stop
strategy.exit("Exit Long", from_entry="BUY", trail_points=trailing_stop_pips, trail_offset=trailing_step_pips)
strategy.exit("Exit Short", from_entry="SELL", trail_points=trailing_stop_pips, trail_offset=trailing_step_pips)
// === Visualization ===
plot(sma_fast, color=color.blue, title="SMA 10")
plot(sma_slow, color=color.red, title="SMA 200")
hline(rsi_buy_level, title="RSI Buy Level", color=color.green)
hline(rsi_sell_level, title="RSI Sell Level", color=color.red)
hline(adx_min_trend, title="ADX Min Trend Level", color=color.orange)