
이 전략은 다차원 기술 지표 분석을 기반으로 한 정량 거래 시스템으로, 상대적으로 약한 지표 ((RSI), 이동 평균 동향 분산 지표 ((MACD) 및 지수 이동 평균 ((EMA) 와 같은 기술 지표를 통합하여 완전히 자동화된 거래 의사 결정 시스템을 구축합니다. 전략은 모듈화 된 디자인을 채택하고, 유연한 거래 구성 파라미터를 지원하며, 동적 스톱 손실 메커니즘과 손실을 추적하는 스톱 손실 기능을 통합하여 위험 통제 하에서 안정적이고 건강한 수익을 달성합니다.
전략의 핵심 논리는 3개의 주요 기술 지표에 대한 연동된 분석에 기초하고 있습니다.
전략은 어떤 지표가 신호를 생성할 때 트레이드를 촉발할 수 있으며, 백분율 중지, 고정 중지 및 추적 중지 트리플 리스크 제어를 통합한다. 가격이 기본 수익 목표에 도달하면 자동으로 손실 추적 기능을 활성화하여 얻은 수익이 크게 철회되지 않도록 한다.
이 전략은 다차원 기술 지표의 협동 분석을 통해 체계화된 거래 의사 결정 프레임 워크를 구축하고, 완벽한 위험 제어 메커니즘을 통해 거래 전체 과정에 대한 정밀한 관리를 구현한다. 특정 시장 환경에서 특정 과제를 직면 할 수 있지만, 지속적인 최적화 및 개선으로 전략은 다양한 시장 주기에서 안정적인 성능을 유지할 것으로 예상된다. 전략의 모듈화 설계 사고 방식은 후속 기능 확장 및 최적화에 좋은 토대를 제공합니다.
/*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)