This strategy is a quantitative trading system based on multi-dimensional technical indicator analysis, integrating technical indicators such as Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), and Exponential Moving Average (EMA) to build a fully automated trading decision system. The strategy adopts a modular design, supports flexible configuration of trading parameters, and integrates dynamic take-profit, stop-loss, and trailing stop mechanisms to achieve stable returns under controlled risk.
The core logic is based on the synergistic analysis of three major technical indicators:
The strategy triggers trades when any indicator generates a signal, while integrating percentage-based stop-loss, fixed take-profit, and trailing stop mechanisms. When price reaches the preset profit target, trailing stop is automatically activated to protect accumulated profits from significant drawdowns.
The strategy constructs a systematic trading decision framework through multi-dimensional technical indicator analysis and achieves precise management of the entire trading process through comprehensive risk control mechanisms. While facing specific challenges in certain market environments, the strategy has the potential to maintain stable performance across different market cycles through continuous optimization and improvement. The modular design approach also provides a solid foundation for future functional expansion and optimization.
/*backtest start: 2024-11-21 00:00:00 end: 2024-11-28 00:00:00 period: 4h basePeriod: 4h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © rfssocal //@version=5 strategy("Quantico Bot MILLIONARIO", overlay=true) // Configuração inicial de parâmetros capital_inicial = input.float(100, "Capital Inicial ($)", minval=10) risco_por_trade = input.float(1, "Risco por Trade (%)", minval=0.1, maxval=100) take_profit_percent = input.float(2, "Take Profit (%)", minval=0.1) stop_loss_percent = input.float(1, "Stop Loss (%)", minval=0.1) trailing_stop_percent = input.float(5, "Trailing Stop Gatilho (%)", minval=0.1) // Configuração de indicadores usar_rsi = input.bool(true, "Usar RSI como Indicador") usar_macd = input.bool(true, "Usar MACD como Indicador") usar_ema = input.bool(true, "Usar EMA como Indicador") // Indicadores rsi_value = ta.rsi(close, 14) [macd_line, signal_line, _] = ta.macd(close, 12, 26, 9) ema_20 = ta.ema(close, 20) ema_50 = ta.ema(close, 50) // Condições de compra compra_rsi = usar_rsi and rsi_value < 30 compra_macd = usar_macd and macd_line > signal_line compra_ema = usar_ema and ema_20 > ema_50 compra = compra_rsi or compra_macd or compra_ema // Condições de venda venda_rsi = usar_rsi and rsi_value > 70 venda_macd = usar_macd and macd_line < signal_line venda_ema = usar_ema and ema_20 < ema_50 venda = venda_rsi or venda_macd or venda_ema // Calcular stop loss e take profit stop_loss_price = strategy.position_avg_price * (1 - stop_loss_percent / 100) take_profit_price = strategy.position_avg_price * (1 + take_profit_percent / 100) // Adiciona trailing stop automático if (strategy.position_size > 0 and close >= strategy.position_avg_price * (1 + trailing_stop_percent / 100)) strategy.exit("Trailing Stop", from_entry="Compra", stop=close * 0.99) // Executa as ordens automáticas if (compra) strategy.entry("Compra", strategy.long) if (venda) strategy.entry("Venda", strategy.short) // Variável para calcular o lucro total var float total_profit = 0.0 total_profit := strategy.netprofit // Exibição de dados no gráfico label.new(bar_index, na, "Take Profit: " + str.tostring(take_profit_price) + "\nStop Loss: " + str.tostring(stop_loss_price), style=label.style_label_down, color=color.green, textcolor=color.white) // Exibe o balanço label.new(bar_index, na, "Balanço Atual\nDiário: " + str.tostring(total_profit), style=label.style_label_down, color=color.blue, textcolor=color.white)