
Esta estratégia é como ter um seguro triplo em sua negociação! Primeiro, use o EMA200 para determinar a direção da grande tendência, em seguida, use o volume de transação para confirmar a veracidade da ruptura e, finalmente, use o ATR para proteger os lucros.
Este não é o tipo de negociação mecânica, mas uma estratégia inteligente para “observar”. Quando o preço ultrapassa a EMA200, ele também verifica se o volume de transação é grande o suficiente (default é 1,5 vezes a média) para evitar falsas brechas.
A parte mais interessante é que a estratégia não tem como ponto de paragem o valor fixo da placa, mas sim a proteção dinâmica que vai “subir as escadas”.
É muito simples.:
Assim como você sobe uma escada, cada andar que você sobe leva o cordão de segurança para cima, e nunca para baixo! Isso protege os lucros e dá espaço suficiente para a tendência.
O maior problema de muitas estratégias de invasão é a falsa invasão, como na história de “O lobo chegou”.
O volume de transações deve ser superior a 1,5 vezes a média de 20 diasImaginem que uma notícia pode ser falsa se apenas algumas pessoas estiverem falando sobre ela; mas se toda a cidade estiver falando sobre ela, então vale a pena prestar atenção!
O projeto permite que você filtre as falsas descobertas de “falsa propaganda” e aproveite apenas as oportunidades de tendências realmente financiadas.
Adequado para o público:
Os principais problemas resolvidos:
Lembre-se, o maior valor desta estratégia não é enriquecê-lo de repente, mas sim ajudá-lo a lucrar em mercados em tendência, protegendo ao máximo o seu dinheiro. É como ter GPS + air bags + anti-colisão em suas transações!
/*backtest
start: 2024-08-26 00:00:00
end: 2025-08-24 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("EMA Break + Stop ATR", overlay = true)
// =============================================================================
// STRATEGY PARAMETERS
// =============================================================================
// User inputs for strategy customization
shortPeriod = input.int(20, title = "Stop Period", minval = 1, maxval = 100, tooltip = "Period for lowest low calculation")
atrPeriod = 1 // ATR period always set to 1
initialStopLoss = 0.0 // Initial stop loss always set to 0 (auto based on ATR)
// Confirmation indicator settings
useVolumeConfirmation = input.bool(true, title = "Use Volume Confirmation", tooltip = "Require volume above average for breakout confirmation")
volumeMultiplier = input.float(1.5, title = "Volume Multiplier", minval = 1.0, maxval = 5.0, step = 0.1, tooltip = "Volume must be this times above average")
// Strategy variables
var float STOP_LOSS = 0.0 // Dynamic stop loss value
var float TRAILING_STOP = na // Trailing stop based on lowest low
// =============================================================================
// TECHNICAL INDICATORS
// =============================================================================
// Calculate True Range and its Simple Moving Average
trueRange = ta.tr(true)
smaTrueRange = ta.sma(trueRange, atrPeriod)
// Calculate 200-period Exponential Moving Average
ema200 = ta.ema(close, 200)
// Calculate lowest low over the short period
lowestLow = ta.lowest(input(low), shortPeriod)
// Calculate potential stop loss level (always available)
potentialStopLoss = close - 2 * smaTrueRange
// Volume confirmation for breakout validation
volumeSMA = ta.sma(volume, 20) // 20-period average volume
isVolumeConfirmed = not useVolumeConfirmation or volume > volumeSMA * volumeMultiplier
// =============================================================================
// STOP LOSS MANAGEMENT
// =============================================================================
// Update trailing stop based on lowest low (always, not just when in position)
if na(TRAILING_STOP) or lowestLow > TRAILING_STOP
TRAILING_STOP := lowestLow
// Update stop loss if we have an open position and new lowest low is higher
if (strategy.position_size > 0) and (STOP_LOSS < lowestLow)
strategy.cancel("buy_stop")
STOP_LOSS := lowestLow
// Soft stop loss - exit only when close is below stop level
if (strategy.position_size > 0) and (close < STOP_LOSS)
strategy.close("buy", comment = "Soft Stop Loss")
alert("Position closed: Soft Stop Loss triggered at " + str.tostring(close), alert.freq_once_per_bar)
// =============================================================================
// ENTRY CONDITIONS
// =============================================================================
// Enhanced entry signal with volume confirmation to avoid false breakouts
isEntrySignal = ta.crossover(close, ema200) and (strategy.position_size == 0) and isVolumeConfirmed
if isEntrySignal
// Cancel any pending orders
strategy.cancel("buy")
strategy.cancel("sell")
// Enter long at market on crossover
strategy.entry("buy", strategy.long)
// Set initial stop loss (2 * ATR below close, or use custom value if specified)
if initialStopLoss > 0
STOP_LOSS := initialStopLoss
else
STOP_LOSS := close - 2 * smaTrueRange
// Alert for position opened
alert("Position opened: Long entry at " + str.tostring(close) + " with stop loss at " + str.tostring(STOP_LOSS), alert.freq_once_per_bar)
// =============================================================================
// PLOTTING
// =============================================================================
// Plot EMA 200
plot(ema200, color = color.blue, title = "EMA 200", linewidth = 2)
// Plot Stop Loss
plot(strategy.position_size > 0 ? STOP_LOSS : lowestLow, color = color.red, title = "Stop Loss", linewidth = 2)
// Plot confirmation signals
plotshape(isEntrySignal, title="Confirmed Breakout", location=location.belowbar,
color=color.green, style=shape.triangleup, size=size.normal)
// Plot volume confirmation (only if enabled)
bgcolor(useVolumeConfirmation and isVolumeConfirmed and ta.crossover(close, ema200) ? color.new(color.green, 90) : na, title="Volume Confirmed")