
이 전략은 SMMA에 기반한 양방향 트렌드 추적 전략이다. 이 전략은 가격과 SMMA의 교차를 이용하여 다공간 신호를 생성하고, ATR의 동적 스톱로스 및 고정 수익 목표와 결합하여 위험과 수익을 관리한다. 전략은 간단하고 효과적이며, 다른 시간 주기에서의 트렌드 추적 거래에 적합하다.
전략의 핵심은 17주기 SMMA와 가격의 교차로 트렌드 변화를 포착하는 것입니다. 가격이 SMMA를 통과할 때 상위 포지션을 열고, 가격이 SMMA를 통과할 때 상위 포지션을 열습니다. 출구 관리는 세 가지 메커니즘을 사용합니다: 1) ATR 기반의 동적 상쇄 손실, SMMA 상하 0.75배 ATR로 설정; 2) 고정 수익 목표, 상위 1150점, 상위 1500점; 3) 반향 교차 신호 평점.
이것은 SMMA를 통해 트렌드를 포착하고, ATR을 사용하여 위험을 통제하고, 고정된 수익 목표를 통해 수익을 관리하는 합리적으로 설계된 트렌드 추적 전략이다. 전략 논리는 명확하고, 구현은 간단하며, 동작성과 확장성이 좋다.
/*backtest
start: 2024-02-20 00:00:00
end: 2025-02-17 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SMMA 17 Crossover Strategy (Long & Short, ATR SL & Fixed TP)", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)
// 🚀 SMMA Calculation
smmaLength = 17
smma = 0.0
smma := na(smma[1]) ? ta.sma(close, smmaLength) : (smma[1] * (smmaLength - 1) + close) / smmaLength
// 📈 ATR Calculation (For Dynamic Stop-Loss)
atrLength = 14
atr = ta.rma(ta.tr(true), atrLength)
// 🔥 Long Entry Condition
longCondition = ta.crossover(close, smma) // ✅ Price crosses above SMMA
// 🔄 Long Exit Condition
longExit = ta.crossunder(close, smma) // ✅ Price crosses below SMMA
// 📉 ATR-Based Stop-Loss (Dynamic) for Long
longStopLoss = smma - (atr * 0.75) // ✅ Stop Loss below SMMA
// 🏆 Fixed Take Profit for Long (1150 Points)
var float longEntryPrice = na
var float longTakeProfit = na
if longCondition
longEntryPrice := close
longTakeProfit := longEntryPrice + 1150 // ✅ TP 1150 points above entry
// 🔥 Short Entry Condition
shortCondition = ta.crossunder(close, smma) // ✅ Price crosses BELOW SMMA (Short trade)
// 🔄 Short Exit Condition
shortExit = ta.crossover(close, smma) // ✅ Price crosses ABOVE SMMA (Close Short trade)
// 📉 ATR-Based Stop-Loss (Dynamic) for Short
shortStopLoss = smma + (atr * 0.75) // ✅ Stop Loss above SMMA
// 🏆 Fixed Take Profit for Short (1500 Points) - Updated from 2000
var float shortEntryPrice = na
var float shortTakeProfit = na
if shortCondition
shortEntryPrice := close
shortTakeProfit := shortEntryPrice - 1500 // ✅ TP 1500 points below entry (Updated)
// 📊 Plot SMMA (For Visualization)
plot(smma, title="SMMA (17)", color=color.blue)
// 🚀 Long Entry (Allow Multiple)
if longCondition
strategy.entry("Long", strategy.long)
// 🛑 Long Exit Conditions (Whichever Comes First)
strategy.exit("Long TP/SL", from_entry="Long", stop=longStopLoss, limit=longTakeProfit)
if longExit
strategy.close("Long")
// 🚀 Short Entry (Allow Multiple)
if shortCondition
strategy.entry("Short", strategy.short)
// 🛑 Short Exit Conditions (Whichever Comes First)
strategy.exit("Short TP/SL", from_entry="Short", stop=shortStopLoss, limit=shortTakeProfit)
if shortExit
strategy.close("Short")