
É uma estratégia de seguimento de tendências bidirecionais baseada em SMMAs que utiliza preços e SMMAs para gerar sinais de hiperespaço e combina ATRs com paradas dinâmicas e objetivos de ganhos fixos para gerenciar riscos e ganhos. A estratégia é projetada de forma simples e eficiente para acompanhar tendências de negociação em diferentes períodos de tempo.
O núcleo da estratégia é capturar a mudança de tendência através do cruzamento de 17 ciclos de SMMA com o preço. Quando o preço atravessa o SMMA, abre uma posição a mais; Quando o preço atravessa o SMMA, abre uma posição a menos.
Trata-se de uma estratégia de seguimento de tendências razoavelmente concebida, que capta tendências através de SMMA, usa ATR para controle de risco e receita de gerenciamento de objetivos de lucro fixo. A lógica da estratégia é clara, a implementação é simples e possui boa operabilidade e escalabilidade. Embora o desempenho possa ser fraco em mercados turbulentos, a estabilidade e adaptabilidade da estratégia pode ser ainda melhorada com a orientação de otimização recomendada.
/*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")