mt5-forex-xau-scalper-m1/HFT_Scalper_Profiles.mqh
2025-08-13 06:28:41 -03:00

230 lines
No EOL
9.6 KiB
MQL5

//+------------------------------------------------------------------+
//| HFT_Scalper_Profiles.mqh |
//| Copyright 2024, Scalper HFT Systems Ltd. |
//| https://www.mql5.com/pt/users |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, Scalper HFT Systems Ltd."
#property link "https://www.mql5.com/pt/users"
//+------------------------------------------------------------------+
//| Perfis de Configuração para HFT Scalper |
//+------------------------------------------------------------------+
//--- Perfil CONSERVADOR
struct ConservativeProfile {
static double LotSize() { return 0.01; }
static int StopLoss() { return 8; }
static int TakeProfit() { return 12; }
static int MaxOrders() { return 2; }
static int MinBarsAfterTrade() { return 5; }
static double MaxSpread() { return 3.0; }
static int RSI_Overbought() { return 70; }
static int RSI_Oversold() { return 30; }
static double MinPriceSpeed() { return 0.0002; }
static bool UseTrailingStop() { return true; }
static int TrailingStop() { return 4; }
static string Description() { return "Perfil Conservador - Menor risco, trades mais seletivos"; }
};
//--- Perfil MODERADO (Padrão)
struct ModerateProfile {
static double LotSize() { return 0.01; }
static int StopLoss() { return 10; }
static int TakeProfit() { return 15; }
static int MaxOrders() { return 3; }
static int MinBarsAfterTrade() { return 3; }
static double MaxSpread() { return 5.0; }
static int RSI_Overbought() { return 75; }
static int RSI_Oversold() { return 25; }
static double MinPriceSpeed() { return 0.0003; }
static bool UseTrailingStop() { return true; }
static int TrailingStop() { return 5; }
static string Description() { return "Perfil Moderado - Balanceado entre risco e oportunidade"; }
};
//--- Perfil AGRESSIVO
struct AggressiveProfile {
static double LotSize() { return 0.02; }
static int StopLoss() { return 12; }
static int TakeProfit() { return 18; }
static int MaxOrders() { return 5; }
static int MinBarsAfterTrade() { return 2; }
static double MaxSpread() { return 7.0; }
static int RSI_Overbought() { return 80; }
static int RSI_Oversold() { return 20; }
static double MinPriceSpeed() { return 0.0004; }
static bool UseTrailingStop() { return true; }
static int TrailingStop() { return 6; }
static string Description() { return "Perfil Agressivo - Maior risco, mais trades"; }
};
//--- Perfil ULTRA-HFT (Máxima Frequência)
struct UltraHFTProfile {
static double LotSize() { return 0.01; }
static int StopLoss() { return 6; }
static int TakeProfit() { return 9; }
static int MaxOrders() { return 8; }
static int MinBarsAfterTrade() { return 1; }
static double MaxSpread() { return 2.0; }
static int RSI_Overbought() { return 85; }
static int RSI_Oversold() { return 15; }
static double MinPriceSpeed() { return 0.0001; }
static bool UseTrailingStop() { return true; }
static int TrailingStop() { return 3; }
static string Description() { return "Perfil Ultra-HFT - Máxima frequência, apenas para contas ECN premium"; }
};
//--- Perfil SCALPING NOTURNO
struct NightScalpingProfile {
static double LotSize() { return 0.005; }
static int StopLoss() { return 15; }
static int TakeProfit() { return 20; }
static int MaxOrders() { return 2; }
static int MinBarsAfterTrade() { return 8; }
static double MaxSpread() { return 4.0; }
static int RSI_Overbought() { return 65; }
static int RSI_Oversold() { return 35; }
static double MinPriceSpeed() { return 0.0001; }
static bool UseTrailingStop() { return true; }
static int TrailingStop() { return 8; }
static string Description() { return "Perfil Noturno - Adaptado para baixa volatilidade"; }
};
//+------------------------------------------------------------------+
//| Configurações por Sessão de Mercado |
//+------------------------------------------------------------------+
//--- Sessão ASIÁTICA (Baixa Volatilidade)
struct AsianSessionConfig {
static double LotSizeMultiplier() { return 0.5; }
static int StopLossMultiplier() { return 150; } // 150% do normal
static int TakeProfitMultiplier() { return 120; } // 120% do normal
static double MaxSpread() { return 3.0; }
static int MinBarsAfterTrade() { return 5; }
static string TimeRange() { return "00:00-08:00 GMT"; }
};
//--- Sessão EUROPEIA (Alta Volatilidade)
struct EuropeanSessionConfig {
static double LotSizeMultiplier() { return 1.0; }
static int StopLossMultiplier() { return 100; } // Normal
static int TakeProfitMultiplier() { return 100; } // Normal
static double MaxSpread() { return 5.0; }
static int MinBarsAfterTrade() { return 3; }
static string TimeRange() { return "08:00-17:00 GMT"; }
};
//--- Sessão AMERICANA (Máxima Volatilidade)
struct AmericanSessionConfig {
static double LotSizeMultiplier() { return 1.2; }
static int StopLossMultiplier() { return 80; } // 80% do normal (mais apertado)
static int TakeProfitMultiplier() { return 120; } // 120% do normal
static double MaxSpread() { return 6.0; }
static int MinBarsAfterTrade() { return 2; }
static string TimeRange() { return "13:00-22:00 GMT"; }
};
//+------------------------------------------------------------------+
//| Configurações para diferentes tipos de mercado |
//+------------------------------------------------------------------+
//--- Mercado TRENDING (Tendência)
struct TrendingMarketConfig {
static int MA_Fast() { return 3; } // EMA mais rápida para capturar tendências
static int MA_Slow() { return 8; }
static int RSI_Period() { return 5; }
static double MinPriceSpeed() { return 0.0005; } // Velocidade maior
static int TakeProfitMultiplier() { return 150; } // TP maior em trends
static string Description() { return "Config para mercados em tendência forte"; }
};
//--- Mercado RANGING (Lateral)
struct RangingMarketConfig {
static int MA_Fast() { return 8; } // EMAs mais lentas para filtrar ruído
static int MA_Slow() { return 15; }
static int RSI_Period() { return 10; }
static double MinPriceSpeed() { return 0.0002; } // Velocidade menor
static int StopLossMultiplier() { return 80; } // SL menor em range
static string Description() { return "Config para mercados laterais"; }
};
//--- Mercado HIGH VOLATILITY (Alta Volatilidade)
struct HighVolatilityConfig {
static double LotSizeMultiplier() { return 0.7; } // Lote menor
static int StopLossMultiplier() { return 150; } // SL maior
static int TakeProfitMultiplier() { return 200; } // TP muito maior
static double MaxSpread() { return 8.0; }
static int MinBarsAfterTrade() { return 5; }
static string Description() { return "Config para alta volatilidade (news, eventos)"; }
};
//+------------------------------------------------------------------+
//| Configurações de Horários de Trading |
//+------------------------------------------------------------------+
struct TradingHours {
// Horários ideais para HFT (GMT)
static bool IsGoodTime(int hour) {
// Sessão Europeia: 8-12h (abertura)
if(hour >= 8 && hour < 12) return true;
// Sobreposição EU/US: 13-17h (máxima liquidez)
if(hour >= 13 && hour < 17) return true;
// Sessão Americana ativa: 20-22h
if(hour >= 20 && hour < 22) return true;
return false;
}
static bool IsBadTime(int hour) {
// Rollover e baixa liquidez: 21-23h
if(hour >= 21 && hour < 23) return true;
// Madrugada: 23-1h
if(hour >= 23 || hour < 1) return true;
return false;
}
static string GetSessionName(int hour) {
if(hour >= 0 && hour < 8) return "Asiática";
if(hour >= 8 && hour < 17) return "Europeia";
if(hour >= 17 && hour < 24) return "Americana";
return "Desconhecida";
}
};
//+------------------------------------------------------------------+
//| Configurações de Money Management |
//+------------------------------------------------------------------+
struct MoneyManagement {
// Calcular lote baseado no saldo
static double CalculateLotSize(double balance, double risk_percent = 2.0) {
double min_lot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
double max_lot = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
double lot_step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
double risk_amount = balance * risk_percent / 100.0;
double pip_value = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE);
double calculated_lot = risk_amount / (10 * pip_value); // 10 pips de risco
// Normalizar lote
calculated_lot = MathFloor(calculated_lot / lot_step) * lot_step;
calculated_lot = MathMax(calculated_lot, min_lot);
calculated_lot = MathMin(calculated_lot, max_lot);
return calculated_lot;
}
// Ajustar lote baseado no drawdown
static double AdjustLotForDrawdown(double base_lot, double current_dd, double max_dd = 10.0) {
if(current_dd >= max_dd * 0.8) // 80% do DD máximo
return base_lot * 0.5;
else if(current_dd >= max_dd * 0.5) // 50% do DD máximo
return base_lot * 0.7;
else
return base_lot;
}
};