Información del mercado de divisas
//| MACD_ColorHist_Alert.mq4 |
//|¿Derechos de autor? 2006, Robert Hill |
//| |
// -
#propertycopyright"¿Derechos de autor? 2006, Robert Hill p>
/ / -Configuración del indicador
#Atributo indicador_ventana_separada
#Atributo indicador_buffer 4
#Atributo indicador_color1 verde claro
#Atributo indicador_color 2 rojo
#Atributo indicador_color 3 verde
#Atributo indicador_color 4 Rojo
// - parámetros del indicador
extern bool SoundON = true
extern bool EmailON = false
extern int FastEMA = 12 ;
extern int SlowEMA = 26
extern int señales ma = 9; p>
// - buffer de indicador
doble ind _ buffer 1[];
doble ind _ buffer 2[];
doble buffer de histograma arriba[];
búfer de histograma doble abajo[];
int flag val 1 = 0;
int flag val 2 = 0;
// - variable
// -
int flag val 2 = 0; p>
//|Función de inicialización de indicador personalizada|
// -
int init()
{
// - Configuración de dibujo
//indicador buffers(3);
indicador DÍGITOS(información de mercado(Símbolo(), MODO _ DÍGITOS) 1);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
SetIndexBuffer(0 , ind_buffer 1);
SetIndexDrawBegin(0, EMA lento);
SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
SetIndexBuffer(1, ind_buffer 2) ;
SetIndexDrawBegin(1, señales ma);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);
SetIndexBuffer(2,HistogramBufferUp);
SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);
SetIndexBuffer(3, HistogramBufferDown);
// SetIndexDrawBegin(2, señales EMA lentas ma);
// - Nombre de la ventana de datos y etiquetas de la subventana del indicador
p>nombre corto del indicador(" MACD
(" FastEMA ", " SlowEMA ", " señales ma ");
SetIndexLabel(0, "MACD");
SetIndexLabel(1, "señales"); >
SetIndexLabel(2, "Histograma");
// - inicialización completada
return(0);
}
// -
//|Media móvil de convergencia/divergencia|
// -
int start()
{
int limit;
Temperatura dual;
int contado _ barras = indicador contado();
// - comprobar Posibles errores
if(counted_bars lt; 0) devuelve (-1);
// - recalculará las últimas barras contadas
if(counted_bars gt;0) counted_bars-;
limit = Bars-counted_Bars;
// - macd cuenta el primer búfer
for(int I = 0; i lt limit; i)
ind_buffer1[i]=iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i)-iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, I); p>
// - Línea de señal contada en el segundo buffer
for(I = 0; i lt limit; i )
ind _ buffer 2[I]= iMAOnArray (ind _ buffer 1, Barras, SignalSMA, 0, MODE_SMA, I
//ind _ buffer 2[I] = alpha * ind _ buffer 1[I] alpha _ 1 * ind _ buffer); 2[I 1];
for(I = 0; i lt limit; i)
{
HistogramBufferUp[I]= 0; >
HistogramBufferDown[I]= 0;
temp = ind _ buffer 1[I]-ind _ buffer 2[ I];
if(temp gt; = 0 )
HistogramBufferUp[I]= temp;
Otro
HistogramBufferDown[I ]= temp;
if (i == 1 )
{
if(HistogramBufferUp[I] gt; búfer de anfistograma de 0 amperios abajo[I 1] lt; 0)
//if(HistogramBufferUp[ I] gt;HistogramBufferUp[i 1])
{
//Intersecarlos
if (flagval1==0)
{
valor de bandera 1 = 1;
valor de bandera 2 = 0;
si (Sonido) Ale
rt("Ascendente MACD"," \n Time= ", TimeToStr(CurTime(),TIME_DATE)," ", TimeHour(CurTime()), ":", TimeMinute(CurTime()), " \n Símbolo= " ,Symbol()," Period=",Period());
if (EmailON) SendMail("MACD cruzando hacia arriba", "MACD cruzando hacia arriba, Fecha=" TimeToStr(CurTime(),TIME _ Fecha) " " HORA hora(CurTime()) ":" HORA minuto(CurTime()) " Símbolo = " Símbolo() " Período = " Período());
}
}
else if(HistogramBufferDown[I] lt; 0 amp ampHistogramBufferUp[i 1]>0)
//else if(HistogramBufferUp[I] lt;HistogramBufferUp[ i 1])
{
//cruzar hacia abajo
if (flagval2==0)
{
flag val 2 = 1;
flag val 1 = 0;
if (SoundON) Alert("MACD cruza hacia abajo", \n Date= ", TimeToStr (CurTime( ),TIME_DATE), " ", TimeHour(CurTime()), ":", TimeMinute(CurTime()), " \n Símbolo= ", Símbolo(), " Period= ", Period()); >
if (EmailON) SendMail("MACD Cruzar hacia abajo", "MACD Cruzar hacia abajo", Fecha=" TimeToStr(CurTime(),TIME_Date) " " HORA hora(CurTime()) " : " HORA minuto(CurTime( )) " Símbolo = " Símbolo() " Periodo = " Periodo()
}
}
}
}
// -Complete
return(0);
}
Copiar el código anterior Ir al documento, por ejemplo, el nombre es macd2.mq4, el sufijo debe ser mq4, luego colóquelo en expertos \ indicadores en el directorio de instalación de mt4, vuelva a abrir mt4, puede ver macd2 en la personalización de indicadores técnicos. Fin