98 lines
8.1 KiB
MQL5
98 lines
8.1 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| WinFutHorariosBrasil.mqh |
|
|
//| Copyright 2025, MetaQuotes Ltd. |
|
|
//| https://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2025, MetaQuotes Ltd."
|
|
#property link "https://www.mql5.com"
|
|
//+------------------------------------------------------------------+
|
|
//| defines |
|
|
//+------------------------------------------------------------------+
|
|
// #define MacrosHello "Hello, world!"
|
|
// #define MacrosYear 2010
|
|
//+------------------------------------------------------------------+
|
|
//| DLL imports |
|
|
//+------------------------------------------------------------------+
|
|
// #import "user32.dll"
|
|
// int SendMessageA(int hWnd,int Msg,int wParam,int lParam);
|
|
// #import "my_expert.dll"
|
|
// int ExpertRecalculate(int wParam,int lParam);
|
|
// #import
|
|
//+------------------------------------------------------------------+
|
|
//| EX5 imports |
|
|
//+------------------------------------------------------------------+
|
|
// #import "stdlib.ex5"
|
|
// string ErrorDescription(int error_code);
|
|
// #import
|
|
//+------------------------------------------------------------------+
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| 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;
|
|
}
|
|
};
|