This strategy is a comprehensive trend-following system that combines multiple technical indicators and momentum analysis methods. The core of the strategy utilizes moving average crossovers, trend confirmation, and momentum indicators, combined with volatility control for risk management. The strategy shows good adaptability in markets with clear medium to long-term trends.
The strategy employs a multi-layered signal confirmation mechanism, including the following key elements:
The comprehensive trading conditions are: Long conditions: EMA9 crosses above EMA21, MACD line above signal line and positive, RSI between 40-70, price above EMA9 Short conditions: EMA9 crosses below EMA21, MACD line below signal line and negative, RSI between 30-60, price below EMA9
This strategy constructs a relatively complete trend-following trading system through the combination of multiple technical indicators. The core advantages lie in signal reliability and rational risk control, though it faces challenges with lag and parameter optimization. Through the proposed optimization directions, the strategy has potential for improved performance in live trading. It is recommended to conduct thorough historical data testing and adjust parameters according to specific market characteristics before implementation.
/*backtest start: 2019-12-23 08:00:00 end: 2024-11-27 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Estratégia Cripto - 1D", shorttitle="Estratégia Cripto", overlay=true) // Definição das Médias Móveis Exponenciais (EMA) ema9 = ta.ema(close, 9) ema21 = ta.ema(close, 21) // Definição do MACD [macdLine, signalLine, _] = ta.macd(close, 12, 26, 9) // Definição do RSI rsi = ta.rsi(close, 14) // Volume médio volMedio = ta.sma(volume, 14) // Definição das Bollinger Bands basis = ta.sma(close, 20) dev = ta.stdev(close, 20) upperBand = basis + 2 * dev lowerBand = basis - 2 * dev // Condições de Compra (Long) longCondition = (ema9 > ema21) and (macdLine > signalLine) and (macdLine > 0) and (volume > volMedio) and (rsi > 40 and rsi < 70) and (close > ema9) if (longCondition) strategy.entry("Compra", strategy.long) // Condições de Venda (Short) shortCondition = (ema9 < ema21) and (macdLine < signalLine) and (macdLine < 0) and (volume > volMedio) and (rsi < 60 and rsi > 30) and (close < ema9) if (shortCondition) strategy.entry("Venda", strategy.short) // Stop Loss e Take Profit strategy.exit("Take Profit/Stop Loss", from_entry="Compra", loss=200, profit=400) strategy.exit("Take Profit/Stop Loss", from_entry="Venda", loss=200, profit=400) // Plotagem das Médias Móveis e Bollinger Bands plot(ema9, color=color.green, title="EMA 9") plot(ema21, color=color.red, title="EMA 21") plot(upperBand, color=color.blue, title="Upper Band") plot(lowerBand, color=color.blue, title="Lower Band")