¡Hola, traders! Hoy vamos a profundizar en un sistema de trading basado en el indicador iMACD específicamente diseñado para operar en el par EUR/USD en gráficos de 1 hora. Este sistema es muy útil para quienes buscan automatizar sus operaciones y aprovechar las señales de compra y venta que el MACD proporciona.
Autor de la idea: Gabriel, programador del código MQL5: barabashkakvn.
Condiciones para abrir una posición
A continuación, te muestro las condiciones para verificar las señales de apertura de posición, tanto para compras (BUY) como para ventas (SELL):
void OpenBuyOrSell()
{
double mac1,mac2,mac3,mac4,mac5,mac6,mac7,mac8;
mac1 = iMACDGet(MAIN_LINE,0);
mac2 = iMACDGet(MAIN_LINE,1);
mac3 = iMACDGet(MAIN_LINE,2);
mac4 = iMACDGet(MAIN_LINE,3);
mac5 = iMACDGet(SIGNAL_LINE,0);
mac6 = iMACDGet(SIGNAL_LINE,1);
mac7 = iMACDGet(SIGNAL_LINE,2);
mac8 = iMACDGet(SIGNAL_LINE,3);
//--- Verificando posibilidad de posición larga (BUY)
if(mac8>mac7 && mac7>mac6 && mac6<mac5 && mac4>mac3 && mac3<mac2 && mac2<mac1 && mac2<-0.00020 && mac4<0 && mac1>0.00020)
{
if(!RefreshRates())
return;
double volume=LotsOptimized();
if(volume==0)
return;
m_trade.Buy(volume,Symbol(),m_symbol.Bid(),0,0,"Sistema MACD");
return;
}
//--- Verificando posibilidad de posición corta (SELL)
if(mac8<mac7 && mac7<mac6 && mac6>mac5 && mac4<mac3 && mac3>mac2 && mac2>mac1 && mac2>0.00020 && mac4>0 && mac1<-0.00035)
{
if(!RefreshRates())
return;
double volume=LotsOptimized();
if(volume==0)
return;
m_trade.Sell(volume,Symbol(),m_symbol.Ask(),0,0,"Sistema MACD");
return;
}
}
{
double mac1,mac2,mac3,mac4,mac5,mac6,mac7,mac8;
mac1 = iMACDGet(MAIN_LINE,0);
mac2 = iMACDGet(MAIN_LINE,1);
mac3 = iMACDGet(MAIN_LINE,2);
mac4 = iMACDGet(MAIN_LINE,3);
mac5 = iMACDGet(SIGNAL_LINE,0);
mac6 = iMACDGet(SIGNAL_LINE,1);
mac7 = iMACDGet(SIGNAL_LINE,2);
mac8 = iMACDGet(SIGNAL_LINE,3);
//--- Verificando posibilidad de posición larga (BUY)
if(mac8>mac7 && mac7>mac6 && mac6<mac5 && mac4>mac3 && mac3<mac2 && mac2<mac1 && mac2<-0.00020 && mac4<0 && mac1>0.00020)
{
if(!RefreshRates())
return;
double volume=LotsOptimized();
if(volume==0)
return;
m_trade.Buy(volume,Symbol(),m_symbol.Bid(),0,0,"Sistema MACD");
return;
}
//--- Verificando posibilidad de posición corta (SELL)
if(mac8<mac7 && mac7<mac6 && mac6>mac5 && mac4<mac3 && mac3>mac2 && mac2>mac1 && mac2>0.00020 && mac4>0 && mac1<-0.00035)
{
if(!RefreshRates())
return;
double volume=LotsOptimized();
if(volume==0)
return;
m_trade.Sell(volume,Symbol(),m_symbol.Ask(),0,0,"Sistema MACD");
return;
}
}
Apertura de compra en el gráfico

¡Y eso es todo! Espero que esta guía sobre el sistema MACD para EURUSD te ayude a mejorar tus estrategias de trading. ¡Buena suerte en el mercado!
Comentarios 0