
이 전략은 다주기 분석에 기반한 트렌드 추적 거래 시스템으로, 지수 이동 평균 ((EMA) 와 무작위 지표 ((Stochastic) 를 결합하여 거래 방향과 진입 시기를 결정한다. 이 전략은 15분 주기로 트렌드 방향을 확인하고 1-5분 주기로 특정 진입 기회를 찾고, 엄격한 위험 관리와 분기 수익을 통해 거래 성능을 최적화한다.
이 전략은 다단계 거래 조건 검증 메커니즘을 사용합니다.
이 전략은 다주기 분석과 여러 기술 지표의 조합을 통해, 비교적 완벽한 트렌드 추적 거래 시스템을 구축한다. 전략의 핵심 장점은 엄격한 위험 관리와 유연한 수익 창출 계획에 있다. 그러나 실제 적용에서는 여전히 시장 환경과 자금 규모에 따라 적절한 매개 변수를 최적화해야 한다. 제안된 최적화 방향을 통해, 전략은 다양한 시장 환경에서 더 안정적인 성능을 얻을 수 있다.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-16 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("15-Min Trend Strategy", overlay=true, default_qty_type=strategy.fixed, default_qty_value=1)
// Define EMA for trend confirmation
ema50 = ta.ema(close, 50)
trendLong = close > ema50
trendShort = close < ema50
// Stochastic settings
length = 14
smoothK = 3
smoothD = 3
stochK = ta.sma(ta.stoch(close, high, low, length), smoothK)
stochD = ta.sma(stochK, smoothD)
// Entry conditions
longCondition = stochK < 30 and trendLong
shortCondition = stochK > 70 and trendShort
// ATR-based stop-loss calculation
atrValue = ta.atr(14)
stopLossLong = close - (1.5 * atrValue)
stopLossShort = close + (1.5 * atrValue)
takeProfitLong = close + (2 * atrValue)
takeProfitShort = close - (2 * atrValue)
// Execute trades
if longCondition
strategy.entry("Long", strategy.long, qty=2)
strategy.exit("TP Long 1", from_entry="Long", qty=1, stop=stopLossLong, limit=takeProfitLong)
strategy.exit("TP Long 2", from_entry="Long", qty=1, stop=stopLossLong, limit=takeProfitLong * 1.5)
if shortCondition
strategy.entry("Short", strategy.short, qty=2)
strategy.exit("TP Short 1", from_entry="Short", qty=1, stop=stopLossShort, limit=takeProfitShort)
strategy.exit("TP Short 2", from_entry="Short", qty=1, stop=stopLossShort, limit=takeProfitShort * 1.5)
// Move SL to breakeven after 50% move to target
if strategy.position_size > 0
if strategy.position_avg_price != 0
moveToBELong = close >= (strategy.position_avg_price + (takeProfitLong - strategy.position_avg_price) * 0.5)
if moveToBELong
strategy.exit("BE Long", from_entry="Long", qty=1, stop=strategy.position_avg_price)
moveToBEShort = close <= (strategy.position_avg_price - (strategy.position_avg_price - takeProfitShort) * 0.5)
if moveToBEShort
strategy.exit("BE Short", from_entry="Short", qty=1, stop=strategy.position_avg_price)