
This strategy is a comprehensive trend following trading system that combines multiple technical indicators to confirm market trends and trading signals. The strategy uses EMA crossover as the primary trend identification tool, while integrating RSI, ADX, and volume indicators to filter trading signals, along with dynamic stop-loss and take-profit levels for risk management. This multi-faceted analysis approach can effectively improve trading accuracy and profitability.
The core logic of the strategy is based on the following key elements: 1. Using 9-period and 21-period Exponential Moving Average (EMA) crossovers to determine trend direction 2. Using 14-period Relative Strength Index (RSI) to measure market momentum 3. Utilizing Average Directional Index (ADX) to confirm trend strength 4. Incorporating 20-period volume moving average to verify price movements 5. Employing a dynamic stop-loss (3%) and take-profit (5%) system based on entry price
Buy conditions require: EMA9 crosses above EMA21, RSI above 50, volume above average, ADX above 25 Sell conditions require any of: EMA9 crosses below EMA21, RSI below 50, volume below average (with ADX above 25)
This is a well-designed trend following strategy that uses multiple technical indicators to improve trading reliability. The strategy’s strengths lie in its comprehensive signal confirmation mechanism and risk management system, but attention must be paid to proper parameter optimization based on market conditions during practical application. Through the suggested optimization directions, both the strategy’s stability and profitability can be further enhanced.
/*backtest
start: 2025-01-10 00:00:00
end: 2025-02-09 00:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Estrategia Avançada - EMA, RSI, ADX e Volume", overlay=true)
// Parâmetros das EMAs
ema9 = ta.ema(close, 9)
ema21 = ta.ema(close, 21)
// RSI
rsi14 = ta.rsi(close, 14)
// Cálculo do ADX usando ta.dmi
[plusDI, minusDI, adx] = ta.dmi(14, 14)
// Volume com média
volume_ma = ta.sma(volume, 20)
// Critérios de Compra (Bullish)
buy_signal = ta.crossover(ema9, ema21) and rsi14 > 50 and volume > volume_ma and adx > 25
// Critérios de Venda (Bearish)
sell_signal = ta.crossunder(ema9, ema21) or rsi14 < 50 or volume < volume_ma and adx > 25
// Plotando indicadores no gráfico
plot(ema9, color=color.blue, linewidth=2, title="EMA 9")
plot(ema21, color=color.red, linewidth=2, title="EMA 21")
hline(50, "RSI 50", color=color.gray)
// Stop Loss e Take Profit dinâmicos
long_sl = strategy.position_avg_price * 0.97 // Stop Loss de 3%
long_tp = strategy.position_avg_price * 1.05 // Take Profit de 5%
short_sl = strategy.position_avg_price * 1.03 // Stop Loss de 3% para vendas
short_tp = strategy.position_avg_price * 0.95 // Take Profit de 5% para vendas
// Executando compra
if buy_signal
strategy.close("Venda") // Fecha posição de venda se existir
strategy.entry("Compra", strategy.long)
strategy.exit("TakeProfit", from_entry="Compra", limit=long_tp, stop=long_sl)
// Executando venda
if sell_signal
strategy.close("Compra") // Fecha posição de compra se existir
strategy.entry("Venda", strategy.short)
strategy.exit("TakeProfit", from_entry="Venda", limit=short_tp, stop=short_sl)
// Alertas configurados
alertcondition(buy_signal, title="Sinal de Compra", message="Hora de comprar!")
alertcondition(sell_signal, title="Sinal de Venda", message="Hora de vender!")