
이 전략은 200주기 간단한 이동 평균 ((MA200) 을 기반으로 한 트렌드 추적 시스템으로, 상대적으로 강한 지표 ((RSI), 평균 트렌드 지표 ((ADX) 및 평균 실제 파도 ((ATR) 와 같은 기술 지표와 결합하여 완전한 거래 의사 결정 프레임 워크를 형성합니다. 전략은 동적으로 중지 손실과 수익 목표를 설정하여 위험을 효과적으로 제어합니다.
이 전략의 핵심 논리는 다음과 같은 몇 가지 핵심 사항에 기초하고 있습니다.
이 전략은 여러 기술 지표를 결합하여 견고한 트렌드 추적 시스템을 구축한다. 전략은 설계에서 위험 통제에 초점을 맞추고, 동적 중지 손실 및 신호 확인 메커니즘을 통해 거래의 신뢰성을 향상시킨다. 일부 최적화 공간이 있지만, 전체적으로 실용적인 가치가있는 거래 전략이다. 추후 변수를 최적화하고 보조 지표를 추가하여 전략의 성능을 더욱 향상시킬 수 있다.
/*backtest
start: 2024-02-21 00:00:00
end: 2025-02-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Binance","currency":"TRB_USDT"}]
*/
//@version=5
strategy("BTC/USD MA200 with RSI, ADX, ATR", overlay=true)
// Definition of the main moving average
ma_trend = ta.sma(close, 200) // Main trend filter
// Definition of RSI and ADX
rsi = ta.rsi(close, 14)
[diplus, diminus, adx] = ta.dmi(14, 14) // Correction for ADX
// Definition of ATR for Stop Loss and Take Profit
atr = ta.atr(14)
// Conditions for crossing of the MA200
crossover_condition = ta.crossover(close, ma_trend)
crossunder_condition = ta.crossunder(close, ma_trend)
// Trend confirmation after 2 bars
buy_confirmation = crossover_condition[2] and (rsi > 40) and (adx > 20) and close > ma_trend
sell_confirmation = crossunder_condition[2] and (rsi < 60) and (adx > 20) and close < ma_trend
// Definition of Stop Loss and Take Profit
take_profit = close * 1.02 // 2% profit
stop_loss = close - (1.5 * atr) // Dynamic stop based on ATR
// Execution of orders
if (buy_confirmation and strategy.opentrades == 0)
strategy.entry("Buy", strategy.long)
strategy.exit("Take Profit/Stop Loss", from_entry="Buy", limit=take_profit, stop=stop_loss)
label.new(bar_index, high, "BUY", style=label.style_label_down, color=color.green, textcolor=color.white, size=size.normal)
if (sell_confirmation)
if (strategy.opentrades > 0)
strategy.close("Buy")
label.new(bar_index, low, "SELL", style=label.style_label_up, color=color.red, textcolor=color.white, size=size.normal)
// Draw the main moving average
plot(ma_trend, color=color.purple, title="MA 200")