Mira cómo descargar robots gratis
¡Búscanos en Telegram!
Pon "Me gusta" y sigue las noticias
¿Es interesante este script?
Deje un enlace a él, ¡qué los demás también lo valoren!
¿Le ha gustado el script?
Evalúe su trabajo en el terminal MetaTrader 5
Indicadores

CCI Color Levels - indicador para MetaTrader 5

Visualizaciones:
1326
Ranking:
(23)
Publicado:
2018.03.06 11:15
\MQL5\Experts\ \MQL5\Indicators\
¿Necesita un robot o indicador basado en este código? Solicítelo en la bolsa freelance Pasar a la bolsa

El indicador tiene el siguiente aspecto:

CCI Color Levels

Para alcanzar esta representación visual, han sido usados tres tipos de construcciones:

CCI Color Levels Draw


Parámetros de entrada del indicador

  • Averaging period - período de promediación del indicador;
  • Level UP - valor del nivel UP;
  • Level DOWN - valor del nivel DOWN.

Los niveles "UP" y "DOWN" van a visualizarse en la subventana del indicador:

CCI Color Levels Inputs


Cómo obtener los datos del indicador en el Asesor Experto

Puesto que el estilo de construcción DRAW_HISTOGRAM2 se construye a base de dos búferes de indicador, en la ventana "Data Window" veremos dos valores "Level UP" y dos valores "Level DOWN":

Test CCI Color Levels.png

Estos valores corresponden a los búferes de indicador de "0" a "4", inclusive.

En el EA, creamos el manejador (handle) del indicador usando iCustom:

//--- input parameters
input int      Inp_CCI_ma_period = 14;    // Averaging period 
input double   Inp_CCI_LevelUP   = 90;    // Level UP
input double   Inp_CCI_LevelDOWN =-90;    // Level DOWN
//---
int            handle_iCustom;            // variable for storing the handle of the iCustom indicator 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create handle of the indicator iCCI
   handle_iCustom=iCustom(Symbol(),Period(),"CCI Color Levels",Inp_CCI_ma_period,Inp_CCI_LevelUP,Inp_CCI_LevelDOWN);
//--- if the handle is not created 
   if(handle_iCustom==INVALID_HANDLE)
     {
      //--- tell about the failure and output the error code 
      PrintFormat("Failed to create handle of the iCCI indicator for the symbol %s/%s, error code %d",
                  Symbol(),
                  EnumToString(Period()),
                  GetLastError());
      //--- the indicator is stopped early 
      return(INIT_FAILED);
     }
//---
   return(INIT_SUCCEEDED);
  }

Aquí, se supone que el indicador CCI Color Levels se ubica en la carpeta [data folder]\MQL5\Indicators\.

Es la obtención de los valores del indicador (los búferes que nos vales son № 0, 2 y 4):

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   double level_up   = iCustomGet(handle_iCustom,0,0);   // buffer #0 -> BufferUpHigh
   double cci        = iCustomGet(handle_iCustom,2,0);   // buffer #2 -> BufferCCI
   double level_down = iCustomGet(handle_iCustom,4,0);   // buffer #4 -> BufferDownLow
   string text="Lelev UP #0: "+DoubleToString(level_up,2)+"\n"+
               "CCI #0: "+DoubleToString(cci,2)+"\n"+
               "Lelev DOWN #0: "+DoubleToString(level_down,2);
   Comment(text);
  }

En la captura de pantalla de arriba vemos que el ratón está situado en la barra con el índice "0", además se muestra la ventana "Data Windows" con los datos del indicador, y en el gráfico se muestra la información del EA para los búferes de indicador № 0, 2 y 4.

Traducción del ruso realizada por MetaQuotes Ltd
Artículo original: https://www.mql5.com/ru/code/19704

EasyAndFastGUI - librería para crear interfaces gráficas EasyAndFastGUI - librería para crear interfaces gráficas

La librería EasyAndFastGUI le permite crear las interfaces gráficas para sus programas MQL.

VR Orders History MT5 Lite VR Orders History MT5 Lite

VR Orders History MT5 Lite es el script para descargar el historial comercial en formato CSV.

ZigZagEvgeTrofi ver. 1 ZigZagEvgeTrofi ver. 1

El sistema comercial a base del indicador ZigZag.

SAR index based on MA SAR index based on MA

El indicador SAR se calcula a base de los valores del indicador iMA (Moving Average, MA).