
이 전략은 기술 분석에 기반한 동적 트렌드 추적 시스템으로, 시장 트렌드를 식별하기 위해 주로 쌍평균선을 사용한다. 전략은 상대적으로 약한 지표 (RSI) 와 평균 트렌드 지표 (ADX) 를 동적 필터로 통합하고 실제 파도 (ATR) 와 결합하여 동적 위험 관리를 수행하여 상승 추세를 정확하게 포착하고 위험을 효과적으로 제어한다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이것은 합리적이고 논리적으로 명확하게 설계된 트렌드 추적 전략이며, 여러 가지 기술 지표를 조합하여 수익과 위험을 더 잘 균형 잡는다. 전략은 사용자 정의가 강하며, 다양한 시장 환경에서 매개 변수를 최적화하여 유효성을 유지하는 데 적합하다. 약간의 후기 위험이 있지만, 개선된 위험 제어 장치로 전략 전체는 더 나은 안정성과 신뢰성을 보여준다.
/*backtest
start: 2022-02-09 00:00:00
end: 2025-02-06 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("BTCUSDT Daily - Enhanced Bitcoin Bull Market Support [CYRANO]", shorttitle="BTCUSDT Daily BULL MARKET", overlay=true, commission_type=strategy.commission.percent, commission_value=0.1, slippage=3)
// Inputs
smaLength = input.int(200, title="SMA Length (Bull Market)")
emaLength = input.int(147, title="EMA Length (21-Week Approximation)")
atrLength = input.int(14, title="ATR Length")
riskATR = input.float(2.0, title="ATR Multiplier for Stop Loss", step=0.1)
takeProfitPercent = input.float(10.0, title="Take Profit (%)", step=0.1)
rsiFilter = input.bool(true, title="Enable RSI Filter")
rsiLength = input.int(14, title="RSI Length")
adxFilter = input.bool(true, title="Enable ADX Filter")
adxThreshold = input.float(25, title="ADX Threshold")
// Date Range Filter
startDate = input(timestamp("2018-01-01 00:00 +0000"), title="Start Date")
endDate = input(timestamp("2069-12-31 00:00 +0000"), title="End Date")
inDateRange = true
// Moving Averages
sma200 = ta.sma(close, smaLength)
ema21w = ta.ema(close, emaLength)
// ATR Calculation
atr = ta.atr(atrLength)
stopLoss = close - (riskATR * atr)
takeProfit = close * (1 + takeProfitPercent / 100)
// RSI Filter
rsi = ta.rsi(close, rsiLength)
rsiCondition = rsiFilter ? rsi > 50 : true
// ADX Filter
[diplus, diminus, adx] = ta.dmi(14, 14)
adxCondition = adxFilter ? adx > adxThreshold : true
// Entry and Exit Conditions
buyCondition = inDateRange and close > sma200 and close > ema21w and rsiCondition and adxCondition
exitCondition = inDateRange and (close < sma200 or close < ema21w)
// Strategy Execution
if buyCondition
strategy.entry("BUY", strategy.long, stop=stopLoss, limit=takeProfit)
if exitCondition
strategy.close("BUY")
// Plot MAs
plot(sma200, title="200-Day SMA", color=color.blue, linewidth=2)
plot(ema21w, title="21-Week EMA", color=color.purple, linewidth=2)
// Background Highlight
bullColor = color.new(color.green, 80)
bearColor = color.new(color.red, 80)
bgcolor(close > sma200 and close > ema21w ? bullColor : bearColor, title="Bull Market Background")