ProfiGorex
- Asesores Expertos
- Andrey Kozak
- Versión: 3.0
- Actualizado: 29 junio 2024
- Activaciones: 20
Información General
- Nombre del archivo: ProfiGorex.mql4
- Versión: 1.00
- Descripción: Un robot de trading que utiliza el indicador MACD para el análisis del mercado y el trading automatizado en la plataforma MetaTrader 4. El robot incluye funcionalidad de gestión de riesgos y trailing stop.
Parámetros de Entrada
- LotSize: Tamaño del lote para abrir posiciones (por defecto es 0.01).
- MaxDrawdownPercent: Máximo drawdown permitido en porcentaje (por defecto es 20.0%).
- TrailingStopPips: Número de pips para el trailing stop (por defecto es 10 pips).
- DistancePips: Distancia mínima en pips entre órdenes (por defecto es 20 pips).
- FastEMAPeriod: Periodo de EMA rápida para el MACD (por defecto es 12).
- SlowEMAPeriod: Periodo de EMA lenta para el MACD (por defecto es 26).
- SignalPeriod: Periodo de la línea de señal para el MACD (por defecto es 9).
- Max_spread: Spread máximo permitido para abrir una orden (por defecto es 10 pips).
- Magic: Número mágico para la identificación de órdenes (por defecto es 777).
Funciones Principales
- OnTick: Función principal que se ejecuta en cada tick. Analiza el estado del mercado, gestiona las órdenes y el trailing stop.
- OpenOrder: Abre una nueva orden según el estado actual del mercado y los parámetros del robot.
- ManageTrailingStop: Gestiona el trailing stop para las órdenes abiertas.
- CloseAllOrders: Cierra todas las órdenes abiertas si se alcanza el drawdown máximo permitido.
- CheckDistanceToOrders: Verifica la distancia mínima a las órdenes existentes antes de abrir una nueva.
- GetLastOrderType: Determina el tipo de la última orden abierta.
- ErrorDescription: Describe los errores que ocurren durante el trading.
- CheckVolumeValue: Verifica la corrección del valor del volumen del lote.
- IsNewOrderAllowed: Verifica si se permite abrir una nueva orden.
- CheckStopLoss_Takeprofit: Verifica la corrección de los valores de stop loss y take profit.
Lógica de Operación
- Verificación del Estado de la Cuenta: En cada tick se verifica si hay fondos suficientes para abrir nuevas órdenes.
- Análisis de MACD y EMA: Se analiza el estado actual de los indicadores MACD y EMA para tomar decisiones de compra o venta.
- Gestión de Riesgos: Se verifica el drawdown actual y se cierran todas las órdenes si se excede el nivel permitido.
- Apertura de Órdenes: Se abren órdenes cuando se cumplen las condiciones de MACD y EMA, además de verificar la distancia mínima a otras órdenes y el spread permitido.
- Trailing Stop: Gestiona el trailing stop para minimizar pérdidas y proteger ganancias.
Configuración de la Estrategia
- Marco de Tiempo: M5 (gráfico de 5 minutos)
- Instrumento de Trading: GBPUSD
- Indicadores:
- MACD:
- EMA Rápida: 12
- EMA Lenta: 26
- Línea de Señal: 9
- EMA:
- EMA Rápida: 12
- EMA Lenta: 26
- MACD:
Concepto Básico
El robot ProfiGorex utiliza los indicadores MACD (Convergencia/Divergencia de Medias Móviles) y EMA (Media Móvil Exponencial) para el análisis del mercado y la determinación de puntos de entrada y salida. El objetivo principal de la estrategia es capturar movimientos de tendencia en el par GBPUSD en el marco de tiempo M5, minimizando riesgos mediante la gestión de drawdown y el uso de trailing stop.
Condiciones para Abrir Operaciones
-
Apertura de Orden de Compra (BUY):
- La línea principal del MACD cruza la línea de señal desde abajo.
- La EMA rápida está por encima de la EMA lenta en el marco de tiempo M1.
- El spread actual es menor o igual al valor de Max_spread.
- Verificación de la distancia mínima desde el precio actual hasta las órdenes abiertas: si no hay órdenes BUY dentro del radio de DistancePips, se abre una orden BUY.
-
Apertura de Orden de Venta (SELL):
- La línea principal del MACD cruza la línea de señal desde arriba.
- La EMA rápida está por debajo de la EMA lenta en el marco de tiempo M1.
- El spread actual es menor o igual al valor de Max_spread.
- Verificación de la distancia mínima desde el precio actual hasta las órdenes abiertas: si no hay órdenes SELL dentro del radio de DistancePips, se abre una orden SELL.
Gestión de Riesgos
-
Drawdown Máximo:
- El robot monitorea continuamente el drawdown actual de la cuenta. Si el drawdown excede el valor de MaxDrawdownPercent, se cierran todas las órdenes abiertas para prevenir más pérdidas.
-
Trailing Stop:
- Después de abrir una orden, el robot gestiona el trailing stop. Si el precio se mueve favorablemente, el stop loss se mueve a una distancia especificada (TrailingStopPips) desde el precio actual para proteger las ganancias.
Cierre de Órdenes
- Una orden se cierra cuando se alcanza el nivel de trailing stop.
- Una orden también puede cerrarse manualmente si el drawdown de la cuenta excede el valor especificado de MaxDrawdownPercent.
Verificaciones Adicionales
- Verificación de Volumen: El robot verifica que el tamaño del lote cumpla con los valores mínimos y máximos permitidos para el instrumento actual.
- Verificación de Permiso para Nuevas Órdenes: Antes de abrir una nueva orden, el robot verifica que el número total de órdenes en la cuenta no exceda el límite permitido.
Ventajas de la Estrategia
- Automatización: Proceso de trading completamente automatizado que no requiere intervención del trader.
- Gestión de Riesgos: Mecanismos de gestión de riesgos incorporados, como el drawdown máximo y el trailing stop.
- Adaptabilidad: Posibilidad de ajustar los parámetros de la estrategia según las condiciones del mercado y las preferencias del trader.
Recomendaciones
- Pruebas: Se recomienda probar el robot en una cuenta demo o en un tester de estrategias antes de operarlo en una cuenta real para verificar la efectividad y corrección de la estrategia.
- Monitoreo: A pesar de la automatización, el monitoreo periódico del desempeño del robot ayudará a realizar ajustes oportunos y evitar situaciones imprevistas.
Esta estrategia de trading está diseñada para ser utilizada en el par GBPUSD en el marco de tiempo M5, pero puede adaptarse a otros pares de divisas y marcos de tiempo con los ajustes de parámetros apropiados.