Problema con el indicador MACD

Comparte y analiza indicadores para la plataforma creada por MetaQuotes.

Problema con el indicador MACD

Notapor Miguelsnts » 11 Ene 2015, 19:00

El indicador MACD se supone que consta de un histograma, una línea principal y una línea de señal, sin embargo, cuando yo abro dicho indicador, sólo me aparece el histograma y la línea de señar tal y como podeis ver en la imagen que adjunto, ¿a qué se debe? ¿qué debo hacer para que me aparezca también la línea principal?

Muchas gracias, un saludo!
Adjuntos
Captura.JPG
Miguelsnts
 
Mensajes: 40
Registrado: 03 Nov 2012, 09:36
Karma: 0

Re: Problema con el indicador MACD

Notapor MF1Forex » 11 Ene 2015, 20:26

Entra en el indicador y dale a "Restablecer", asi pondrá los colores básicos para que lo puedas ver bien.
Saludos.
Avatar de Usuario
MF1Forex
 
Mensajes: 1078
Registrado: 02 Dic 2013, 10:54
Ubicación: Cyberdyne Systems
Karma: 13

Re: Problema con el indicador MACD

Notapor Miguelsnts » 11 Ene 2015, 20:35

Acabo de pulsar en "Restablecer", pero sigue todo igual. No me aparece la línea principal.

El código de mi MACD según me venía en mi plataforma mt4 es el siguiente, por si sirve de algo:

Código: Seleccionar todo
//+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "http://www.mql4.com"
#property description "Moving Averages Convergence/Divergence"
#property strict

#include <MovingAverages.mqh>

//--- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  Red
#property  indicator_width1  2
//--- indicator parameters
input int InpFastEMA=12;   // Fast EMA Period
input int InpSlowEMA=26;   // Slow EMA Period
input int InpSignalSMA=9;  // Signal SMA Period
//--- indicator buffers
double    ExtMacdBuffer[];
double    ExtSignalBuffer[];
//--- right input parameters flag
bool      ExtParameters=false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   IndicatorDigits(Digits+1);
//--- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,InpSignalSMA);
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtMacdBuffer);
   SetIndexBuffer(1,ExtSignalBuffer);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
//--- check for input parameters
   if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,
                 const int prev_calculated,
                 const datetime& time[],
                 const double& open[],
                 const double& high[],
                 const double& low[],
                 const double& close[],
                 const long& tick_volume[],
                 const long& volume[],
                 const int& spread[])
  {
   int i,limit;
//---
   if(rates_total<=InpSignalSMA || !ExtParameters)
      return(0);
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;
//--- macd counted in the 1-st buffer
   for(i=0; i<limit; i++)
      ExtMacdBuffer[i]=iMA(NULL,0,InpFastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
                    iMA(NULL,0,InpSlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//--- signal line counted in the 2-nd buffer
   SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+
Adjuntos
Captura1.JPG
Miguelsnts
 
Mensajes: 40
Registrado: 03 Nov 2012, 09:36
Karma: 0

Re: Problema con el indicador MACD

Notapor MF1Forex » 11 Ene 2015, 20:46

El indicador parace estar bien, pero algo hay en los colores que no.
La imagen que has puesto si que marca la línea MACD SMA, pero muy oscura.
Ya verás, pon el fondo de la plantilla en color Blanco y verás como si te sale. Puede que sea algo de la la plantilla que tiene los colores customizados, insertalo en una plantilla nueva con Esquema de Color en: Green on Black, a ver si se arregla.
Avatar de Usuario
MF1Forex
 
Mensajes: 1078
Registrado: 02 Dic 2013, 10:54
Ubicación: Cyberdyne Systems
Karma: 13

Re: Problema con el indicador MACD

Notapor Miguelsnts » 11 Ene 2015, 21:04

He hecho lo que has dicho y sigue igual... de todos modos me resulta raro que en el código solo haya 2 buffers en vez de 3. Se supone que el número de buffers define la cantidad máxima de líneas de un indicador, aparte que solo están declarados dos variables como arrays.

Yo creo que este indicador es así...

¿Puedes pasarme tu MACD.mq4? Probablemente el código de tu indicador sea diferente
Adjuntos
Captura.JPG
Miguelsnts
 
Mensajes: 40
Registrado: 03 Nov 2012, 09:36
Karma: 0

Re: Problema con el indicador MACD

Notapor MF1Forex » 11 Ene 2015, 21:17

No se tu, pero yo ene esa foto que has puesto veo la línea roja MACD SMA.
Mi MACD tambien tiene 2 buffers, ahí te lo dejo.
Adjuntos
MACD.mq4
(3.42 KiB) 464 veces
Avatar de Usuario
MF1Forex
 
Mensajes: 1078
Registrado: 02 Dic 2013, 10:54
Ubicación: Cyberdyne Systems
Karma: 13

Re: Problema con el indicador MACD

Notapor Miguelsnts » 11 Ene 2015, 21:32

Tu indicador es igual que el mio, efectivamente.

Es que todos los videos que he visto hasta ahora en youtube, tienen un MACD con 3 variables: un histograma, una linea principal y una linea de señal.

Mira por ejemplo este video: https://www.youtube.com/watch?v=0Bx9HiR9JJc
En el minuto 1:37 puede verse un histograma de color azul oscuro, y dos lineas: una azul clarito y otra roja. Ese es el MACD que busco. No tiene pinta de ser personalizado, de todos modos buscaré a ver si encuentro alguno que tenga esa especificación.
Miguelsnts
 
Mensajes: 40
Registrado: 03 Nov 2012, 09:36
Karma: 0

Re: Problema con el indicador MACD

Notapor MF1Forex » 12 Ene 2015, 01:55

Tu no hablas del MACD normal de Metatrader, el que buscas es un MACD especial como este:
http://www.onlinetradingconcepts.com/Te ... MACD2.html

Imagen

Tienes que buscarlo para MT4... aqui lo puedes bajar, pero piden email:
http://www.aboutcurrency.com/forexdownl ... ator.shtml

De todas maneras no indica nada nuevo, repite lo que ya hace el MACD normal, nada que no puedas hacer en la gráfica con 2 líneas moviles ya que al fin y al cabo no es nada mas que eso.
Avatar de Usuario
MF1Forex
 
Mensajes: 1078
Registrado: 02 Dic 2013, 10:54
Ubicación: Cyberdyne Systems
Karma: 13

Siguiente

Volver a Indicadores

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados

cron