
Chiến lược này là một hệ thống giao dịch định lượng dựa trên phân tích các chỉ số kỹ thuật đa chiều, xây dựng một hệ thống quyết định giao dịch hoàn toàn tự động bằng cách tích hợp các chỉ số kỹ thuật như chỉ số tương đối yếu ((RSI), chỉ số phân tán tương đồng trung bình di chuyển ((MACD) và chỉ số di chuyển trung bình ((EMA)). Chiến lược sử dụng thiết kế mô-đun, hỗ trợ các tham số giao dịch được cấu hình linh hoạt và tích hợp cơ chế dừng lỗ động và tính năng theo dõi dừng lỗ nhằm đạt được lợi nhuận ổn định và lành mạnh dưới sự kiểm soát rủi ro.
Lập luận cốt lõi của chiến lược dựa trên phân tích phối hợp của ba chỉ số kỹ thuật:
Chiến lược này có thể kích hoạt giao dịch khi bất kỳ chỉ số nào tạo ra tín hiệu, đồng thời tích hợp các cơ chế kiểm soát rủi ro ba phần trăm dừng, dừng cố định và theo dõi dừng lỗ. Khi giá đạt mục tiêu lợi nhuận được đặt trước, tính năng theo dõi dừng lỗ sẽ được kích hoạt tự động, đảm bảo lợi nhuận đã đạt được sẽ không bị rút lại.
Chiến lược này xây dựng một khung quyết định giao dịch có hệ thống thông qua phân tích phối hợp các chỉ số kỹ thuật đa chiều và quản lý chính xác toàn bộ quá trình giao dịch thông qua cơ chế kiểm soát rủi ro tốt. Mặc dù có thể gặp thách thức cụ thể trong một số môi trường thị trường, chiến lược có thể duy trì hiệu suất ổn định trong các chu kỳ thị trường khác nhau thông qua việc tối ưu hóa và cải tiến liên tục.
/*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)