214 lines
No EOL
8.2 KiB
MQL5
214 lines
No EOL
8.2 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| WinQ25_Config.mqh |
|
|
//| Copyright 2024, Scalper Trading Bot |
|
|
//| https://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2024, Scalper Trading Bot"
|
|
#property link "https://www.mql5.com"
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Configurações predefinidas para diferentes perfis de risco |
|
|
//+------------------------------------------------------------------+
|
|
|
|
//--- Perfil CONSERVADOR
|
|
class ConfigConservador
|
|
{
|
|
public:
|
|
static double LotePadrao() { return 1.0; }
|
|
static double LoteAltaVolatilidade() { return 2.0; }
|
|
static int TakeProfitPadrao() { return 30; }
|
|
static int TakeProfitAltaVol() { return 80; }
|
|
static double RiscoMaximoDiario() { return 1.0; }
|
|
static int MaxOperacoesPerdedoras() { return 2; }
|
|
static int MaxTradesPorDia() { return 10; }
|
|
static double StopLossPercentual() { return 50.0; }
|
|
};
|
|
|
|
//--- Perfil MODERADO
|
|
class ConfigModerado
|
|
{
|
|
public:
|
|
static double LotePadrao() { return 1.0; }
|
|
static double LoteAltaVolatilidade() { return 3.0; }
|
|
static int TakeProfitPadrao() { return 50; }
|
|
static int TakeProfitAltaVol() { return 150; }
|
|
static double RiscoMaximoDiario() { return 2.0; }
|
|
static int MaxOperacoesPerdedoras() { return 3; }
|
|
static int MaxTradesPorDia() { return 15; }
|
|
static double StopLossPercentual() { return 50.0; }
|
|
};
|
|
|
|
//--- Perfil AGRESSIVO
|
|
class ConfigAgressivo
|
|
{
|
|
public:
|
|
static double LotePadrao() { return 2.0; }
|
|
static double LoteAltaVolatilidade() { return 5.0; }
|
|
static int TakeProfitPadrao() { return 80; }
|
|
static int TakeProfitAltaVol() { return 200; }
|
|
static double RiscoMaximoDiario() { return 3.0; }
|
|
static int MaxOperacoesPerdedoras() { return 4; }
|
|
static int MaxTradesPorDia() { return 25; }
|
|
static double StopLossPercentual() { return 50.0; }
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Configurações de horários específicos do mercado brasileiro |
|
|
//+------------------------------------------------------------------+
|
|
class HorariosBrasil
|
|
{
|
|
public:
|
|
//--- Horários em formato HHMM
|
|
static int InicioLeilaoAberturaBMF() { return 900; }
|
|
static int FimLeilaoAberturaBMF() { return 915; }
|
|
static int InicioTradingBMF() { return 915; }
|
|
|
|
static int InicioLeilaoAberturaBovespa() { return 1000; }
|
|
static int FimLeilaoAberturaBovespa() { return 1015; }
|
|
|
|
static int AberturaEUA() { return 1030; }
|
|
static int InicioAlmoco() { return 1200; }
|
|
static int FimAlmoco() { return 1400; }
|
|
|
|
static int InicioLeilaoFechamentoBovespa() { return 1645; }
|
|
static int FechamentoBovespa() { return 1700; }
|
|
static int FechamentoBMF() { return 1800; }
|
|
|
|
//--- Verificar se é horário de alta volatilidade
|
|
static bool IsAltaVolatilidade(int horaMinuto)
|
|
{
|
|
// 09:15-10:00: Após leilão BMF
|
|
if(horaMinuto >= 915 && horaMinuto < 1000) return true;
|
|
|
|
// 10:00-11:00: Abertura Bovespa + preparação EUA
|
|
if(horaMinuto >= 1000 && horaMinuto < 1100) return true;
|
|
|
|
// 17:00-18:00: Fechamento
|
|
if(horaMinuto >= 1700 && horaMinuto < 1800) return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
//--- Verificar se é horário de trading permitido
|
|
static bool IsTradingPermitido(int horaMinuto)
|
|
{
|
|
// 09:15-10:00: Após leilão abertura BMF
|
|
if(horaMinuto >= 915 && horaMinuto < 1000) return true;
|
|
|
|
// 10:15-12:00: Bovespa + preparação EUA
|
|
if(horaMinuto >= 1015 && horaMinuto < 1200) return true;
|
|
|
|
// 14:00-16:45: Período da tarde
|
|
if(horaMinuto >= 1400 && horaMinuto < 1645) return true;
|
|
|
|
// 17:00-18:00: Após fechamento Bovespa
|
|
if(horaMinuto >= 1700 && horaMinuto < 1800) return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
//--- Verificar se deve evitar trading (horários de leilão)
|
|
static bool IsHorarioEvitar(int horaMinuto)
|
|
{
|
|
// Leilão abertura BMF
|
|
if(horaMinuto >= 900 && horaMinuto < 915) return true;
|
|
|
|
// Leilão abertura Bovespa
|
|
if(horaMinuto >= 1000 && horaMinuto < 1015) return true;
|
|
|
|
// Horário de almoço
|
|
if(horaMinuto >= 1200 && horaMinuto < 1400) return true;
|
|
|
|
// Leilão fechamento Bovespa
|
|
if(horaMinuto >= 1645 && horaMinuto < 1700) return true;
|
|
|
|
return false;
|
|
}
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Configurações específicas do símbolo WinQ25 |
|
|
//+------------------------------------------------------------------+
|
|
class ConfigWinQ25
|
|
{
|
|
public:
|
|
static string Simbolo() { return "WINQ25"; }
|
|
static double PontoMinimo() { return 5.0; } // Tick mínimo do WinQ25
|
|
static double ValorPonto() { return 0.2; } // Valor de cada ponto em R$
|
|
static double MargemRequerida() { return 4000.0; } // Margem aproximada em R$
|
|
|
|
//--- Calcular valor monetário de pontos
|
|
static double PontosParaReais(int pontos)
|
|
{
|
|
return pontos * ValorPonto();
|
|
}
|
|
|
|
//--- Calcular quantos lotes são seguros baseado no saldo
|
|
static double CalcularLoteSeguro(double saldo, double riscoPorcentual)
|
|
{
|
|
double riscoReais = saldo * (riscoPorcentual / 100.0);
|
|
double loteMaximo = MathFloor(saldo / MargemRequerida());
|
|
|
|
// Não usar mais que 50% da margem disponível
|
|
return MathMin(loteMaximo * 0.5, 5.0);
|
|
}
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Configurações de indicadores técnicos |
|
|
//+------------------------------------------------------------------+
|
|
class ConfigIndicadores
|
|
{
|
|
public:
|
|
static int PeriodoMediaRapida() { return 9; }
|
|
static int PeriodoMediaLenta() { return 21; }
|
|
static int PeriodoRSI() { return 14; }
|
|
static int RSISobrecomprado() { return 70; }
|
|
static int RSISobrevendido() { return 30; }
|
|
|
|
static int PeriodoBollingerBands() { return 20; }
|
|
static double DesviosBollinger() { return 2.0; }
|
|
|
|
static int PeriodoADX() { return 14; }
|
|
static double ADXTendenciaForte() { return 25.0; }
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Mensagens padrão do sistema |
|
|
//+------------------------------------------------------------------+
|
|
class Mensagens
|
|
{
|
|
public:
|
|
static string InicioOperacao() { return "=== NOVA OPERAÇÃO WINQ25 ==="; }
|
|
static string OperacaoVencedora() { return "=== TRADE VENCEDOR - WINQ25 ==="; }
|
|
static string OperacaoPerdedora() { return "=== TRADE PERDEDOR - WINQ25 ==="; }
|
|
static string LimiteRiscoAtingido() { return "ATENÇÃO: Limite de risco diário atingido!"; }
|
|
static string MaximoTradesAtingido() { return "Máximo de trades por dia atingido"; }
|
|
static string HorarioNaoPermitido() { return "Operação fora do horário permitido"; }
|
|
static string NovoDialogTrading() { return "=== NOVO DIA DE TRADING WINQ25 ==="; }
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Configurações de notificação |
|
|
//+------------------------------------------------------------------+
|
|
class ConfigNotificacao
|
|
{
|
|
public:
|
|
static bool EnviarAlertaEntrada() { return true; }
|
|
static bool EnviarAlertaSaida() { return true; }
|
|
static bool EnviarAlertaRisco() { return true; }
|
|
static bool EnviarEmail() { return false; }
|
|
static bool EnviarPush() { return true; }
|
|
|
|
static string FormatarMensagemEntrada(string tipo, double lote, double preco, int tp, int sl)
|
|
{
|
|
return StringFormat("WinQ25: %s | Lote: %.1f | Preço: %.0f | TP: %d pts | SL: %d pts",
|
|
tipo, lote, preco, tp, sl);
|
|
}
|
|
|
|
static string FormatarMensagemSaida(double resultado, int totalTrades, double winRate)
|
|
{
|
|
return StringFormat("WinQ25: Resultado: R$ %.2f | Trades: %d | Win Rate: %.1f%%",
|
|
resultado, totalTrades, winRate);
|
|
}
|
|
}; |