
이 전략은 다중 이동 평균선 교차와 RSI 지표를 기반으로 하는 추세 추종 거래 시스템입니다. 이 전략은 EMA20, EMA50, SMA200의 3개 이동평균을 결합하고, 이동평균의 위치 관계에 따라 시장 추세를 판단하고, RSI 지표를 사용하여 거래 신호를 필터링하고, 가격이 이전 최고가를 돌파할 때 거래합니다. 이 전략은 고정된 이익 실현 및 손실 정지 조건을 설정하며 1시간 및 일간 수준에서 실행하는 데 적합합니다.
전략의 핵심 논리는 다음과 같은 핵심 조건에 기초합니다.
이 전략은 완전한 구조와 명확한 논리를 갖춘 추세 추적 시스템입니다. 여러 기술 지표를 조화롭게 활용함으로써 시장 동향을 효과적으로 파악하는 동시에 완벽한 위험 관리 메커니즘을 갖추는 것이 가능합니다. 전략 최적화를 위한 여지가 많으며, 지속적인 개선을 통해 전략의 안정성과 수익성을 더욱 높일 수 있습니다. 중장기 트레이더라면 시도해 볼 만한 전략 프레임워크입니다.
/*backtest
start: 2025-01-02 00:00:00
end: 2025-01-09 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA/SMA Strategy", overlay=false)
// Input parameters
ema20Length = input(20, title="20 EMA Length")
ema50Length = input(50, title="50 EMA Length")
sma200Length = input(200, title="200 SMA Length")
rsiLength = input(14, title="RSI Length")
rsiThreshold = input(40, title="RSI Threshold")
// Calculate indicators
ema20 = ta.ema(close, ema20Length)
ema50 = ta.ema(close, ema50Length)
sma200 = ta.sma(close, sma200Length)
rsiValue = ta.rsi(close, rsiLength)
// Conditions
emaCondition = ema20 > ema50 and sma200 < ema20 and sma200 < ema50
priceNearEMA = (close <= ema20 * 1.01 and close >= ema20 * 0.99) or (close <= ema50 * 1.01 and close >= ema50 * 0.99)
rsiCondition = rsiValue > rsiThreshold
// Entry condition: Price crosses previous candle high
entryCondition = priceNearEMA and rsiCondition and emaCondition and (close > high[1])
// Strategy entry
if entryCondition
strategy.entry("Long", strategy.long)
// Take profit and stop loss settings
takeProfitLevel = strategy.position_avg_price * 1.25 // Take profit at +25%
stopLossLevel = strategy.position_avg_price * 0.90 // Stop loss at -10%
// Exit conditions
if strategy.position_size > 0
strategy.exit("Take Profit", from_entry="Long", limit=takeProfitLevel)
strategy.exit("Stop Loss", from_entry="Long", stop=stopLossLevel)
// Plotting indicators for visualization
plot(ema20, color=color.blue, title="20 EMA")
plot(ema50, color=color.red, title="50 EMA")
plot(sma200, color=color.green, title="200 SMA")
hline(rsiThreshold, "RSI Threshold", color=color.orange)