这是一个基于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")