Sunday 26 November 2017

Sistema Comercial Ergodic


SMI Ergodic Indicator El SMI Ergodic Indicator es el mismo que el True Strength Index (TSI) desarrollado por William Blau, excepto que el SMI incluye una línea de señal. El SMI utiliza medias móviles dobles de precio menos precio anterior en 2 marcos de tiempo. La línea de señal, que es una EMA del SMI, se traza para ayudar a activar las señales comerciales. También se proporcionan guías ajustables para afinar estas señales. El usuario puede cambiar la entrada (cerrar), el método (EMA), las longitudes de período y los valores guía. Esta definición del indicador 8217s se expresa además en el código condensado dado en el cálculo a continuación. Cómo utilizar el indicador SMI Ergodic Ajuste las guías superior e inferior para controlar la cantidad y la calidad de las señales comerciales. Además de las guías, si el SMI cruza la línea de señal se predice un cambio en la tendencia. Si el SMI está por encima de la guía superior y cruza por debajo de la línea de señal, se generará una señal de venta. Por el contrario, si el SMI está por debajo de la guía inferior y cruza por encima de la línea de señal, se dará una señal de compra. La línea 0 divide los toros (arriba) de los osos (abajo). Cómo acceder a MotiveWave Vaya al menú superior, elija Study gtOscillatorsgtSMI Ergodic Indicator o vaya al menú superior, elija Add Study. Empiece a escribir el nombre del estudio hasta que aparezca en la lista, haga clic en el nombre del estudio y haga clic en Aceptar. Aviso importante: La información proporcionada en esta página es estrictamente para propósitos informativos y no debe ser interpretada como consejo o solicitud para comprar o vender cualquier seguridad. Por favor vea nuestra Declaración de Riesgos y Rendimiento. // valor absoluto del valor absoluto // ma media móvil, índice actual del número de barra // MT másThan / / LT lessThanMetaTrader 5 - Sistemas de Trading William Blau39s Indicadores y Sistemas de Trading en MQL5. Parte 1: Indicadores El comercio técnico sólo puede explotarse si se dispone de buenas herramientas. Las herramientas de un buen comerciante son la experiencia, el juicio y una jerarquía matemática proporcionada por un buen programa informático comercial. William Blau Introducción La primera parte del artículo Indicadores y Sistemas de Comercio en MQL5 de William Blau. Parte 1: Indicadores es una descripción de indicadores y osciladores, descritos por William Blau en el libro Momentum, Direction y Divergence. Los indicadores y osciladores, descritos en este artículo, se presentan como códigos fuente en lenguaje MQL5 y se adjuntan en el archivo BlauIndicatorsMQL5en. zip. La idea clave del análisis por William Blau El análisis técnico de William Blau consta de cuatro fases: Usando los datos de las series de precios (q barras), el indicador se calcula y traza en el gráfico. El indicador no refleja la tendencia general del movimiento de precios y no permite determinar los puntos de reversión de la tendencia. El indicador se suaviza varias veces utilizando el método EMA: la primera vez (con el período r), la segunda (con el período s) y la tercera (con el período u) se representa un indicador suavizado. Un indicador suavizado con bastante precisión y reproduce las fluctuaciones de precios con un retraso mínimo. Permite determinar la tendencia del movimiento de precios y los puntos de inversión y elimina el ruido de los precios. El indicador suavizado se normaliza, se traza un indicador normalizado suavizado. La normalización permite que el valor indicador se interprete como los estados de sobrecompra o sobreventa del mercado. Un indicador suavizado normalizado es alisado una vez por el método EMA (período ul) se construye un oscilador - el histograma del indicador y la línea de señal, los niveles de sobrecompra y sobreventa del mercado se agregan. Oscilador nos permite distinguir los estados de sobrecompra / sobreventa del mercado, los puntos de reveral y el final de una tendencia. Indicadores El artículo describe los siguientes grupos de indicadores: Para cada grupo de indicadores se presentan los siguientes: Índice de indicadores suavizados Índice de indicadores normalizados suavizados El oscilador, basado en el índice del índice normalizado suavizado. Un análisis detallado del enfoque de William Blaus en el aspecto del análisis técnico del gráfico de precios. Una descripción detallada del algoritmo y código de cada indicador de los grupos de indicadores basados ​​en Momentum. Como método de suavizado, William Blau utiliza el Moving Average s (EMA) suavizado exponencialmente. El promedio móvil exponencial se calcula sumando al valor anterior de la media móvil, un cierto porcentaje del precio actual. Cuando se utiliza la EMA, los últimos precios tienen un peso mayor. La función del cálculo de EMA: EMA (k, n) - media móvil móvil suavizada exponencialmente del período n para el momento del período k precio (k) - el precio en el momento del período k. La descripción de los cuatro tipos de promedios móviles y los métodos de su uso en análisis técnico (véase también iMA) se pueden encontrar en la MetaTrader 5 Help (Analytics / Technical Indicators / Trend Indicators / Moving Average). La biblioteca de funciones La biblioteca de funciones para calcular las medias móviles se encuentra en MovingAverages. mqh. Estamos preocupados por el ExponentialMAOnBuffer (), que llena el buffer de matriz de salida con valores EMA del precio del array de entrada. Sin embargo, William Blau en su libro utiliza el período de suavización n 1 como el método de cálculo de la base de datos. Ausencia de suavizado. Por lo tanto, el código de la función ExponentialMAOnBuffer () ha sufrido unos pocos cambios: y obtenemos el ExponentialMAOnBufferWB (). El código de esta función se encuentra en el archivo WilliamBlau. mqh. El archivo WilliamBlau. mqh también tiene las siguientes funciones: La función PriceName () devuelve el tipo de precio como una cadena: La función CalculatePriceBuffer () calcula la matriz de precios de este tipo de precio: El tipo de precio aplicado y el período del gráfico de precios William Blau considera los precios de cierre del horario diario. Los indicadores, desarrollados en este artículo, le permiten elegir el tipo de precio (ver constantes de precios). El calendario del gráfico de precios depende del período de tiempo del indicador. 1. El Índice de Fuerza Verdadera Los indicadores considerados (ver anexo): BlauMtm. mq5 - Indicador de la tasa (período q Momentum suavizado q-período Momentum) BlauTSI. mq5 - Fuerzas verdaderas Índice (Periodo normalizado suavizado q Momentum) BlauErgodic. Mq5 - Oscilador Ergódico (basado en el Índice de Fuerza Verdadera). La descripción del indicador técnico incorporado Momentum. Y su uso está en análisis técnico se puede encontrar en la sección de ayuda de MetaTrader 5 Analytics / Technical Indicators / Oscillators / Momentum (ver también iMomentum). En contraste con el Momentum estándar (iMomentum) el Momentum de William Blau calcula el Momentum como el cambio de precio absoluto. Un ejemplo de la implementación MQL5 del Indicador de Fuerza Verdadera (TSI) de William Blau se presenta en el artículo MQL5: Create Your Own Indicator. 1.1.1. Análisis técnico utilizando el indicador Momentum El objeto del análisis técnico es el cuadro de precios del instrumento financiero. Cada elemento de la tabla es una barra de precios. La barra de precios tiene las siguientes características: tiempo de apertura. Precio de apertura. Precio máximo precio mínimo. precio de cierre. Volúmenes comerciales. y otra. La barra de precios se forma y refleja el comportamiento de los precios durante un período específico de tiempo discreto (gráfico de tiempo). La tarea del análisis técnico de la tabla de precios es determinar la tendencia actual del movimiento de precios, revelar los picos y fondos de precios y predecir la dirección del cambio de precio en el próximo período de tiempo. La complejidad de esto, es que el precio, mientras se mueve dentro de los límites de su tendencia básica, hace que las fluctuaciones multidireccionales creen un llamado ruido de precio. Lo que ha propuesto William Blau. La primera diferencia: el Momentum. William Blau calculó el Momentum como un relativo al cambio de precio cerrando para cada período de tiempo diurno y creó el indicador Momentum. Desde un punto de vista matemático, la función Momentum es la primera derivada del precio. Higo. 1.1. Indicador de Momentum (Momentum de Momento q) El Momentum muestra las fluctuaciones de precios de un día muestra la velocidad (magnitud) y la dirección de los cambios de precios durante este período, pero no refleja la tendencia general del movimiento de precios y no Determinar los puntos de inversión de tendencia. La segunda diferencia es el alisado. El promedio móvil del Momentum (la suma acumulada de las fluctuaciones diarias de los precios) reproduce casi exactamente tanto las variaciones principales como locales de los precios de la curva. Higo. 1.2 (a) en las subventanas I, II presentan el Momentum suavizado (promedios móviles con períodos 20 y 300, respectivamente). Cuanto más alto es el período de la media móvil, más exactamente el Momentum suavizado aproxima (reproduce) las fluctuaciones de la curva de precios. Desde el punto de vista matemático, la función de suavizar el Momentum es la función integral del momento, o la función restaurada del precio. Higo. 1.2 (a). Indicador de Momentum (suavizado q-period Momentum) Fig. 1.2 (b). Indicador de Momentum (suavizado q-period Momentum) En la Fig. 1.2 (a), en la ventana principal, se presentan los indicadores suavizados con EMA (con períodos de 5, 20, 100). Un ligero aumento en el período de la media móvil lleva a un retraso y el promedio móvil prácticamente se vuelve incapaz de reproducir las fluctuaciones de la curva de precios. La tercera diferencia es el resmoothing. El primer alisado de Momentum define la tendencia principal del movimiento de precios, así como los puntos de inversión, pero no elimina el ruido. Para eliminar el ruido de los precios es necesario un nuevo suavizado con un pequeño período de la media móvil. Higo. 1.2 (b), en la subventana I se presenta el indicador Momentum suavizado (promedio móvil con el período 20), las subventanas II y III presentan el Momentum doble y triple suavizado (períodos de media móvil de 5, 3). Un suavizado repetido elimina el ruido de precio, pero añade un ligero cambio de la curva (un retraso). La cuarta diferencia: la diferencia en una señal de cambio de tendencias. El alisado de Momentum con un pequeño período de promedio puede conducir a una divergencia del Momentum suavizado con la tendencia de la curva de precios. En la Fig. 1.2 (a), la discrepancia se observa en la subventana I, y en la Fig. 1.2 (b) - en las subventanas I, II, III (la dirección de los cambios de precio diverge de la dirección del cambio en el Momentum suavizado). Estas diferencias a menudo indican un cambio de tendencia. Desde el punto de vista matemático, la divergencia es una función del período de suavizado. La fiabilidad de la interpretación de estas diferencias como señal de las tendencias cambiantes puede mejorarse si consideramos la divergencia sólo para las áreas de sobrecompra o sobreventa (véase 1.2.1). 1.1.2. Definición del Momentum El Momentum es un cambio de precio relativo. El signo de la Momentum muestra la dirección del cambio de precio: un Momentum positivo - el precio aumentó durante el período, un negativo - el precio ha disminuido durante el período. La magnitud del Momentum - es la velocidad relativa del cambio de precio (primera derivada del precio). Higo. 1.3. Definición de la Momentum Fórmula del Momento: precio - precio cierre del período actual precio 1 - precio de cierre del período anterior. William Blau examina el impulso como la diferencia del precio de cierre del período actual y el precio de cierre del período anterior. William Blau, en su cálculo de un impulso de un solo período, utiliza los precios de dos períodos (el actual y el anterior). Introducimos en la fórmula para calcular el momento un indicador de período, q - es el número de períodos de tiempo involucrados en el cálculo (Por William Blau q 2). Fórmula del período q Momentum: q - número de barras, utilizado en el cálculo del momento precio-precio cierre del período actual precio q-1 - precio del cierre (q-1) períodos atrás. En la fórmula resultante, nuestro Momentum de dos períodos corresponde a un período relativo Momentum de William Blau. Fórmula de un período q suavizado Momentum: precio - precio de cierre - la base de precios de la tabla de precios q - número de barras, utilizado en el cálculo de Momentum mtm (precio, q) price-priceq-1 - EMA (mtm (precio, q), r) - la primera suavización - la EMA (r), aplicada a la EMA (s) Aplicada al resultado de la 1ª suavización EMA (EMA), u) - la tercera suavización - la EMA (u), aplicada al resultado de la segunda suavización. 1.1.3. Mtm (precio, q, r, s, u) - indicador de velocidad (impulso). Especificación Nombre del archivo. BlauMtm. mq5 El nombre. Momentum (Momentum de q-periodos suavizado q-moment Momentum) por William Blau. Parámetros de entrada: q - período para el cual se calcula el Momentum (por defecto q 2) r - periodo de la 1ª EMA, aplicado al Momentum (por defecto r 20) s - período de la 2ª EMA, aplicado al resultado de El primer suavizado (por defecto s 5) u - período de la 3ª EMA, aplicado al resultado de la segunda suavización (por defecto, u 3) AppliedPrice - tipo de precio (predeterminado AppliedPrice PRICECLOSE). Además: se muestra en una ventana separada los cambios de la representación gráfica del trazado - el color, grosor, estilo de línea (la pestaña Colores). Limitaciones: qgt0 rgt0, sgt0, ugt0. Si r, s u u son iguales a 1, no se utiliza el suavizado EMA. Por ejemplo, si se establece Mtm (precio, 2,20,5,1), obtenemos un momento de doble suavizado, pero si se establece Mtm (precio, 2,1,1,1), se obtiene un momento no amortiguado el Tamaño mínimo de la matriz de precios (q-1 rs u-3 1). 1.2. Índice de Fuerzas Verdaderas 1.2.1. Análisis técnico utilizando el Índice de Fuerza Verdadera Continúa. Vea el principio en la Sección 1.1.1. El quinto: normalización. Traer a través de la normalización de los valores del Momentum suavizado a una sola escala (mapeo al intervalo -1, 1), nos permite determinar los estados de sobrecompra o sobreventa del mercado. La multiplicación repetida de los valores del impulso suavizado normalizado un factor de 100 convierte las series numéricas en el rango porcentual (mapeo al intervalo -100, 100). Higo. 1.4. Momentum suavizado normalizado Una discrepancia como señal de tendencias cambiantes se puede considerar fiable si el impulso suavizado normalizado se encuentra en el estado de sobrecompra o sobreventa. 1.2.2. La definición del Índice de Fuerza Verdadera El Índice de Fuerza Verdadera (Índice de Fuerza Verdadera, TSI) - es un indicador del Momentum normalizado (Momentum normalizado del período q). Llevando los valores del Momentum suavizado a una sola escala (mapeo al intervalo -1, 1) se proporciona con la normalización de cada valor del Momentum suavizado (la suma acumulada de las fluctuaciones de precio del período q suavizado) por el valor de El Momentum suavizado, tomado en valor absoluto. La multiplicación por un coeficiente de 100 cambia el intervalo de la pantalla a -100, 100 (porcentaje). La normalización permite la interpretación del valor de la ETI como un nivel de mercado de sobrecompra (positivo) o de sobreventa (negativo). La fórmula del Índice de Fuerza Verdadera: precio - precio de cierre - la base de precios de la tabla de precios q - período de la Momentum mtm (price, q) precio-priceq-1 q momento momentum Mtm (price, q) El valor absoluto del período q Momentum Mtm (precio, q, r, s, u) - tres veces suavizado período q Momentum EMA (.r) - el primer suavizado - el EMA del período r, aplicado a: 1) Q-moment Momentum 2) valor absoluto del Momentum EMA (EMA (.r), s) - el segundo suavizado - el EMA (s), aplicado al resultado de la 1ª suavización EMA (EMA (. R), s), u) - la tercera suavización - EMA (u), aplicada al resultado de la segunda suavización. 1.2.3. TSI (precio, q, r, s, u) - el Índice de Fuerza Verdadera. Especificación Nombre del archivo. BlauTSI. mq5 El nombre. El Índice de Fuerza Verdadera (normalizado suavizado q-período relativo Momentum) por William Blau. Parámetros de entrada: q - período para el cual se calcula el momento (predeterminado q 2) r - período de la 1ª EMA, aplicado al Momentum (por defecto r 20) s - período de la 2ª EMA, aplicado al resultado de El primer suavizado (por defecto s 5) u - período de la 3ª EMA, aplicado al resultado de la segunda suavización (por defecto, u 3) AppliedPrice - tipo de precio (predeterminado AppliedPrice PRICECLOSE). Además: se muestra en una ventana separada cambiar el estilo de representación del gráfico - el color, el grosor, el estilo de línea (la pestaña Colores) (opcional) dos niveles (por defecto es -25 y 25) - añadir / quitar un cambio de nivel , La descripción de nivel, cambiar el estilo de representación de los niveles (la pestaña Niveles) cambia los límites inferior (por defecto -100) y superior (por defecto 100) de la escala de la ventana indicadora única (la pestaña Escala). Limitaciones: qgt0 rgt0, sgt0, ugt0. Si r, s, o u son iguales a 1, entonces en el período EMA correspondiente, el suavizado no se realizará el tamaño mínimo de la matriz de precios (q-1 r s u-3 1). 1.3. Oscilador ergódico 1.3.1. Análisis técnico utilizando el Oscilador Ergódico Continúa. Vea el principio en Secs. 1.1.1, 1.2.1. Sexto: las áreas de un mercado de sobrecompra y sobreventa. El intervalo de unidad -1, 1 o un intervalo de porcentaje -100.100, dentro del cual se producen cambios en los valores del momento de suavizado normalizado, le permite definir las áreas de sobrecompra o mercado de sobreventa. La clase de índices de análisis técnico, que caracterizan el estado de sobrecompra o mercado de sobreventa, se llama el oscilador. Para cada oscilador, se determinan los niveles, en la aproximación a la cual se reciben las señales de un mercado de sobrecompra o sobreventa. Los osciladores son ineficaces en los mercados de tendencias, ya que el mercado puede estar en condiciones de sobrecompra / sobreventa durante un período arbitrariamente largo. Séptimo: La Línea de Señal. Para obtener una señal sobre el final de una tendencia y una tendencia de inversión de un movimiento de precios, se utiliza una línea de señal. La señal de compra se recibe cuando la línea principal cruza la línea de señal desde abajo hacia arriba. La señal de venta se recibe cuando la línea principal cruza la línea de señal desde arriba hacia abajo. En el caso de que exista una línea principal - esto es un ergódico (verdadero índice de fuerza), entonces un re-suavizado de la ergódica forma una línea de señal. El procedimiento de re-suavizado es igual al último proceso de suavizado ergódico. Octavo: la tendencia del movimiento de precios. La tendencia del movimiento de precios es hacia arriba (tendencia al alza), cuando la línea principal (ergódica) pasa por encima de la línea de señal. La tendencia del movimiento de precios es hacia abajo (tendencia a la baja), cuando la línea principal (ergódica) pasa bajo la línea de señal. Higo. 1.5. Ergodic Oscillator 1.3.2. El SignalLine () - una línea de señal - el EMA (ul), aplicado a la ul ergódica - un período de la EMA De una línea de señal - de acuerdo con William Blau, el valor ul debe ser igual al período de la última significativa (gt1) de la EMA ergódica. Por ejemplo, si está usando un doble ergonómico Ergódico (precio, q, r, s, u) Ergódico (precio, 2,20,5,1), entonces por William Blau ul s 5. 1.3.3. Ergódico (precio, q, r, s, u, ul) - oscilador ergódico. Especificación Nombre del archivo. BlauErgodic. mq5 Nombre. Ergodic Oscillator (basado en un verdadero índice de fuerza) por William Blau. Parámetros de entrada: diagrama gráfico 0 - Ergódico (índice de fuerza real): q - período para el cual se calcula el momento (predeterminado q 2) r - período del 1-EMA, aplicado al Momentum (por defecto r 20) s - período de la segunda EMA, aplicado al resultado de la primera suavización (por defecto s 5) u - período de la 3ª EMA, aplicado al resultado de la segunda suavización (por defecto, u 3) gráfico gráfico 1 - la señal Línea: ul - línea de señal EMA período, se aplica a la ergódica (por defecto ul 3) AppliedPrice - tipo de precio (predeterminado AppliedPrice PRICECLOSE). Además: se muestra en una ventana separada cambiar el estilo de representación de cada gráfica - el color, grosor, estilo de línea (la pestaña Colores) dos niveles (por defecto -25 y 25) - añadir / quitar un nivel, cambiar el valor, el nivel Descripción, cambie el estilo de representación de los niveles (la pestaña Niveles) cambie los límites inferior (por defecto -100) y superior (por defecto 100) de la escala de la ventana indicadora única (la pestaña Escala). Limitaciones: qgt0 rgt0, sgt0, ugt0. Si r, s, o u son iguales a 1, el suavizado EMA no se utiliza ulgt0. Si ul 1, entonces la Línea de Señal y las líneas Ergódicas son iguales al tamaño mínimo de la matriz de precios (q-1 r s u ul-4 1). 1.4. El Código (descripción detallada) 1.4.1. El código del indicador Mtm (precio, q, r, s, u): Vamos a considerar el código en detalle. 1.4.1.1. Ajustes del indicador Mtm (precio, q, r, s, u) Literatura Qué leer acerca de los ajustes del indicador en el MQL5 Referencia: Copyright. Descripción del indicador Ajustes sólo a través de la directiva de preprocesador de propiedades. En la ventana Propiedades de la ventana de indicadores (la pestaña Propiedades, cuadro adicional) se muestran el opyright (parámetros copyright y enlace), la versión (la versión del parámetro) y una descripción del programa mql5 (descripción del parámetro). Incluir archivo Preprocesador reemplaza la línea Incluir ltWilliamBlau. mqhgt con el contenido del archivo WilliamBlau. mqh. Los corchetes angulares indican que el archivo WilliamBlau. mqh se tomará de la carpeta de datos del terminal. Para obtener más información, consulte Inclusión de archivos. Sobre el contenido del archivo WilliamBlau. mqh ver la introducción. Ajustes del indicador (en general) El indicador personalizado - hay pocas parcelas gráficas. El diagrama gráfico del indicador se puede visualizar en la ventana principal del gráfico de precios o en una ventana separada. Cada gráfica tiene un cierto método de dibujo, color, estilo y grosor. Los datos para la representación de la representación gráfica se toman de los búferes indicadores (cada gráfico gráfico corresponde de uno a cinco indicadores búfer). Utilizamos una matriz de indicadores como un búfer indicador. Para configurar el indicador, es necesario (ver Fig. 1.6): Especifique la ventana para visualizar los indicadores. Especifique el número de gráficas. Especifique el número de búferes de indicadores. Declaración de los conjuntos de indicadores. Configurar un enlace: matriz de indicadores - gt indicador de búfer - gt gráfica. Describir las propiedades de cada gráfica. Especifique la precisión de visualización de los valores del indicador. Especifique para cada construcción gráfica, el número de barras iniciales sin la representación gráfica. Establezca los niveles horizontales y describa las propiedades de cada nivel horizontal (no presente). Establezca las restricciones de escala para la ventana de indicador independiente (no presente). Especifique el nombre corto del indicador. Higo. 1.6. Indicador de Momentum Mtm (precio, q, r, s, u) Se realizan ajustes de indicadores: La diferencia en los métodos de configuración del indicador es que los ajustes a través de la directiva de propiedad están disponibles antes de que el indicador se adjunte a la tabla de precios. Los ajustes a través de funciones especiales están disponibles después de que el indicador se adjunta a la tabla de precios. La configuración de los ajustes se realiza desde la ventana Propiedades del indicador. La configuración: una ventana para mostrar el indicador (1) La configuración es obligatoria y sólo es posible a través de la directiva de preprocesador de propiedades. Existen dos opciones de visualización de indicadores: En la ventana principal del cuadro de precios - indicatorchartwindow En una ventana separada - indicatorseparatewindow. Ajustes: El número de búferes (3) y gráficas (2) La configuración es obligatoria y sólo es posible a través de la directiva de preprocesador de propiedad. El número de búferes indicadores (indicador de parámetro) y el número de gráficas gráficas (parámetro de parámetro) no están limitados. Ajustes: Arrays de indicadores (4) Los arrays de indicadores se declaran a nivel global como matrices dinámicas unidimensionales del tipo double. Ajustes: Configurar el enlace (5) entre las matrices de indicadores, memorias intermedias de indicadores y tramas gráficas. El código se escribe en la función OnInit () del controlador de eventos Init (). El enlace de la memoria intermedia de indicadores con la matriz unidimensional correspondiente se configura con la función SetIndexBuffer (): El búfer indicador es una matriz dinámica unidimensional de tipo doble, cuyo tamaño es controlado por el terminal cliente, de modo que Siempre correspondió al número de barras en las que se calcula el indicador. La indexación de los búferes de indicadores comienza desde 0. Un búfer indicador puede almacenar tres tipos de datos. INDICATORDATA. INDICATORCOLORINDEX. INDICATORCALCULATIONS. Cada trazado gráfico, dependiendo del método de su visualización, puede corresponder a uno a cinco búferes indicadores: de uno a cuatro valores de búfer indicadores (tipo de datos INDICATORDATA) y un búfer de color (tipo de datos INDICATORCOLORINDEX). Indicador buffers con INDICATORCALCULATIONS Los datos de tipo están diseñados para cálculos intermedios. Después de la encuadernación, la matriz de indicadores tendrá la indexación como en las matrices convencionales (véase más abajo en la Sección 1.4.1.2). Configuración: Propiedades de las gráficas (6) Para la configuración de cada conjunto de tramas gráficas, se especifican los siguientes elementos: Tipo de dibujo de etiqueta (ver todos los 18 tipos en la enumeración ENUMDRAWTYPE) Estilo de línea de color de línea (consulte los posibles estilos enumerados en ENUMLINESTYLE ) Ancho de línea. Hay dos formas posibles de configurar: 1) A través de la directiva de preprocesador de propiedad (implementada de esta manera): El código está escrito en la función OnInit () del controlador de eventos Init. Especificación de la función PlotIndexSet (): Para refinar la visualización del tipo de trazado gráfico seleccionado, usamos los ID de propiedad del gráfico, enumerados en la enumeración ENUMPLOTPROPERTY. La indexación de las gráficas comienza desde 0. En cuanto a la preferibilidad de configurar a través de una directiva de propiedad, vea la sección Preferencias de Indicadores. Algunas propiedades de gráficos gráficos (el color, el estilo, el ancho de línea) están disponibles para cambiar desde la ventana Propiedades (la pestaña Colores) del indicador. Ajustes: La precisión de la visualización de los valores del indicador (7) El código se escribe en la función OnInit () del controlador de eventos Init. La especificación de la función de configuración de los indicadores IndicatorSet (): Los identificadores de las propiedades de los indicadores se enumeran en la enumeración ENUMCUSTOMINDPROPERTY. La precisión de la visualización de los valores de indicador se da sólo por la función IndicatorSetInteger (), el ID de las propiedades indicadoras INDICATORDIGITS. ENUMCUSTOMINDPROPERTYINTEGER enumeración. En un ejemplo en el que los valores de los búferes de indicadores, que están destinados a representar, en pantalla: junto al nombre corto del indicador, en un mensaje emergente, cuando el puntero del ratón se coloca sobre la línea de indicador - se redondeará Hasta dígitos - número de dígitos después del punto decimal en el precio del instrumento, al que se adjunta el indicador. Ajustes: Número de barras iniciales sin representación (8) Los datos para representar el momento Momentum de William Blau se forman en cuatro pasos: Paso 1. Sobre la base de los datos de la matriz de precios de PriceBuffer, el Momentum (el período q ) es calculado. Los valores del Momentum del período q se colocan en la matriz MtmBuffer. Dado que la indexación de la matriz de precios comienza a partir de 0, los datos significativos en la matriz de precios también comienzan en el índice 0, entonces los datos significativos en la matriz MtmBuffer comienzan con el índice (q-1). Paso 2. Datos significativos en el array MtmBuffer se suavizan (periodo de suavización r). Los valores del Momentum de período q suavizado se colocan en la matriz EMAMtmBuffer. Dado que la indexación de la matriz MtmBuffer comienza desde 0, los datos significativos en la matriz MtmBuffer comienzan con el índice (q-1), entonces los datos significativos en la matriz EMAMtmBuffer comienzan con el índice (q-1) (r-1) . Los pasos 3 y 4. Se dan consideraciones similares para determinar a partir de qué barra comienza los datos significativos en la matriz DEMAMtmBuffer (periodo de suavizado s) y en la matriz MainBuffer (período de suavización u). Vea la Fig. 1.7. Higo. 1.7. Los datos significativos del indicador Mtm (precio, q, r, s, u) En un nivel global se declaran las variables: Los valores de las variables - es el índice de la barra, a partir de la cual comienzan los datos significativos, en el correspondiente A la matriz de indicadores variables. Los valores de las variables se calculan en la función OnInit () handler Init. Y se utilizará en la función OnCalculate () del controlador de eventos Calculate. El número de barras iniciales sin la representación gráfica se especifica mediante la función PlotIndexSetInteger (), el identificador de la propiedad indicadora PLOTDRAWBEGIN enumeraciones ENUMPLOTPROPERTYINTEGER. Configuración: El nombre abreviado del indicador (11) El código se escribe en la función OnInit () del controlador de eventos Init. El nombre corto del indicador sólo se especifica mediante la función IndicatorSetString (), identificador de las propiedades indicadoras INDICATORSHORTNAME (enumeración ENUMCUSTOMINDPROPERTYSTRING). La función PriceName () devuelve el nombre del tipo de precio. Dependiendo del valor del parámetro de entrada AppliedPrice. El código de la función PriceName () se encuentra en el archivo WilliamBlau. mqh (vea Introducción). Parámetros de entrada Para obtener más información, consulte las variables de entrada. Los parámetros de entrada están disponibles para el cambio desde la ventana Propiedades (la ficha Entradas) del indicador. 1.4.1.2. El cálculo del indicador Mtm (precio, q, r, s, u) Cálculo: El algoritmo El algoritmo para calcular el indicador Mtm (precio, q, r, s, u): Comprobar si hay suficientes datos para calcular el indicador . El cálculo de la matriz de precios de acuerdo con el tipo de precio especificado - la formación de la matriz PriceBuffer La determinación de la barra de índice, con el que comenzar / continuar el cálculo de la Momentum período q. El cálculo del momento q-momentum - el relleno de la matriz MtmBuffer. El primer suavizado por el método EMA (período r) - el relleno de la matriz EMAMtmBuffer. El segundo suavizado por el método EMA (período s) - el relleno de la matriz DEMAMtmBuffer. Cálculo: La función OnCalculate () El cálculo de los valores de los indicadores se realiza en el cálculo OnCalculate () Del controlador de eventos Calculate. Utilizamos la segunda forma de llamada de función OnCalculate (). El argumento de referencia es el número de barras del gráfico de precios, que se representan y están disponibles para el indicador para su procesamiento. El prevcalculated es el número de barras del gráfico de precios que han sido procesadas por el indicador en el momento del inicio de la llamada de función OnCalculate () actual. La función OnCalculate () devuelve el número de barras del gráfico de precios que han sido procesadas por el indicador en el momento del final de la llamada actual. Esta función devuelve el parámetro ratestotal y debe construirse de tal manera que, en la primera llamada, todas las barras no procesadas del gráfico de precios se procesen. Es decir, si en la primera llamada de la función OnCalculate (), el parámetro preválculated es igual a 0, entonces en la segunda llamada, el parámetro preválculated es igual a ratestotal o ratestotal 1. Ya partir de la segunda llamada, la función OnCalculate () controla (cuenta) sólo la última barra. Para más aclaraciones con un ejemplo, vea aquí. Indicator buffers and Time, Open, High, Low, Close, TickVolume, Volume, and Spread arrays have a default direction of indexing from left to right, from the beginning to the end of the array, from the oldest to the latest data. The index of the first element is equal to 0. The size of the indicator buffer is controlled by the client terminal, so that it always corresponded to the number of bars on which the indicator is calculated. Calculation: Check whether there is enough data to calculate the indicator (1) The global variable ratestotalmin is the minimum size of the input timeseries of the indicator, calculated in the OnInit() function of the Init event handler. Calculation: The prices arrays PriceBuffer (2) To fill the PriceBuffer prices array, the CalculatePriceBuffer() function is used. The code of the CalculatePriceBuffer() function is located in the file WilliamBlau. mqh (see introduction). Price type is specified in the input parameter AppliedPrice . Calculation: The definition of the bar index, from with which to begin/continue the calculation of the q-period Momentum (3) The pos local variable is the index of the bar, from which the indicator will be calculated on the current call of the OnCalculate() function. Lets combine the calculation of the pos variable with the stage of preparing the MtmBuffer array to the calculation (the stage of zeroing the insignificant elements of the MtmBuffer array). Calculation: q-period Momentum (4) The q-period Momentum is calculated as a difference between the current period PriceBufferi, and the price(q-1) of the previous periods PriceBufferi-(q-1). Calculation: smoothing by the EMA method (5-7) The ExponentialMAOnBuffer() function is decribed in the introduction. On the example of the calculation of the r-period moving 1st EMA: the ExponentialMAOnBuffer() function fills the EMAMtmBuffer output array with the values of EMA (r) of the MtmBuffer input array with insignificant data up to the index (begin1-1) inclusive, are filled with zero values. 1.4.2. BlauTSI. mq5 - indicator TSI(price, q,r, s,u) - the true strength index The code of the indicator TSI (price, q,r, s,u) (is built on the bases of changes and additions to the code BlauMtm. mq5): Let us consider in detail only the modifications and additions to the code BlauMtm. mq5. 1.4.2.1. The configurations of the indicator TSI (price, q,r s, u) (alterations and additions to the code BlauMtm. mq5) Indicator settings (in general) The configurations of the indicator TSI(price, q,r, s,u) differ from the configurations of the indicator Mtm(price, q,r, s,u) (see Fig. 1.8): Specify the window for displaying the indicators ( no chang e) Specify the number of graphical structures ( no change ) Specify the number of indicator buffers ( the number of buffers has increased .) Declaration of the indicator arrays ( added to the arrays .) Assign the arrays/buffer/plots: the indicator array - gt indicator buffer - gt graphic plot ( restructuring .) Describe the properties of each graphic plot ( label has been changed ) Specify the accuracy of the display of the indicator values ( changed accuracy ) Specify, for each graphic plot, the number of initial bars without showing on the graphic plot ( no change ) Set the horizontal levels and describe the properties of each horizontal level ( new ) Set limits for the scale of the separate indicator window ( new ) Specify the short indicator name ( name changed .) Fig. 1.8. True Strength Index TSI (price, q,r, s,u) indicator Configurations (changes) In the code BlauMtm. mq5, the following minor modifications are made. 1. The short description of the mql5-program is changed: 2. (in configuration 6) The number of graphic plots has not increased, the drawing method (DRAWLINE - line), the line color (Blue), the line style (STYLESOLID - solid line), and the line width (1) remained unchanged, but the label for the graphic plot 0 has changed: 3. (in configuration 7) The accuracy of the display of the indicator values is changed: 4. (in configuration 11) the short name of the indicator is changed: Configurations: horizontal levels (9) To configure the horizontal levels, the following must be specified for each level: The value on the vertical axis The description of the level (optional). Horizontal layers have a single style of rendering: Color for the display of the line Line style (see the possible styles enumerated in ENUMLINESTYLE ) The thickness of the line. There are two possible ways to configure: 1) Using the property preprocessor directive (Implemented this way). 2) Using the group of the IndicatorSet () functions: The code is written in the OnInit() function of the Init event handler. Indexation of the horizontal levels starts from 0. To refine the display of the horizontal level, the identifiers of the properties of the INDICATORLEVEL index are used, which are listed in the ENUMCUSTOMINDPROPERTY enumeration. The description of each level is set only using the IndicatorSetString() function, the identifier of the indicator property INDICATORLEVELTEXT (ENUMCUSTOMINDPROPERTYSTRING enumeration). The description of the level is placed directly above the level, on the left. You can add/remove horizontal levels, change the values, the description of each level, and the style of level rendering from the Properties window (the Levels tab) of the indicator. Configurations: Limits of the scale of the separate indicator window (10) There are two possible ways to configure: 1) Using the property preprocessor directive (Implemented this way). 2) Using the IndicatorSetDouble() function, the identifiers of the properties of the indicators INDICATORMINIMUM and INDICATORMAXIMUM (ENUMCUSTOMINDPROPERTYDOUBLE enumeration). The code is written in the OnInit() function of the Init event handler. The lower and upper bounds of the scale of a separate indicator window are available for change from the Properties window (the Scale tab) of the indicator. Configurations (changes): The indicator buffers (3-5) The changes in the configuration indicator array - gt indicator buffer - gt graphic plot: 1. (in configuration 3) The number of buffers increased: 2. (in configuration 4) Added indicator arrays that are needed to calculate the absolute value of the q-period Momentum: the purpose of the MainBuffer array is changed: 3. (in configuration 5) The connection of indicator array - gt indicator buffer - gt graphic plot is changed: 1.4.2.2. The calculation of the indicator TSI (price, q,r, s,u) (alterations and additions to the code BlauMtm. mq5) Calculation: The algorithm The algorithm for calculating the TSI (price, q,r, s,u) indicator: Check whether there is enough data to calculate the indicator. The calculation of the prices array according to the specified price type - formation of the PriceBuffer array. The determination of the index bar, from with which to begin/continue the calculation of the q-period Momentum. The calculation of the q-period Momentum, and its absolute value - the filling of MtmBuffer and AbsMtmBuffer arrays. The first smoothing by the EMA method (period r) - the filling of EMAMtmBuffer and EMAAbsMtmBuffer arrays. The second smoothing by the EMA method (period s) - the filling of DEMAMtmBuffer and DEMAAbsMtmBuffer arrays. The third method smoothing by the EMA method (period u) - the filling of TEMAMtmBuffer and TEMAAbsMtmBuffer arrays. The determination of the index bar, from with which to begin/continue the calculation of the true strength index. The calculation of the the true strength index - the filling of the MainBuffer array - the calculation of values for graphic plot 0. The essence of the changes in the algorithm (briefly): a) (see paragraph 4-7) parallel to the calculation of the q-period momentum (group of arrays MtmtBuffer) the calculation of the absolute value of the q-period Momentum (AbsMtmBuffer group of arrays) is performed b) (see Section 8-9) calculation of TSI is added. Calculation: the q-period Momentum its absolute value (3-7) Calculation: The True Strength Index (8-9) 1.4.3. BlauErgodic. mq5 - Ergodic(price, q,r, s,u, ul) - Ergodic Oscillator The code of the Ergodic (price, q,r, s,u, ul) indicator is based on changes of the code of BlauTSI. mq5: Let us consider in detail only the modifications and additions to the code BlauTSI. mq5. 1.4.3.1. Configurations of the indicator Ergodic (price, q,r, s,u, ul) (alterations and additions to the code BlauTSI. mq5) Indicator settings (in general) The configurations of the indicator Ergodic (price, q,r, s,u, ul) differ from the configurations of the indicator TSI (price, q,r, s,u) (See Fig. 1.9): Specify the window for displaying the indicators ( no change ) Specify the number of graphic plots ( a graphic plot is added ) Specify the number of indicator buffers ( the number of buffers has increased ) Declaration of the indicator arrays ( added to the array ) Set up a relation: the indicator array - gt indicator buffer - gt graphic plot ( restructuring .) Describe the properties of each graphic plot ( properties altered, a graphic plot is added .) Specify the display precision of the indicator values ( no change .) Specify for each graphical structure the number of initial bars without the showing at the graphic plot ( added a graphic plot .) Set the horizontal levels, and describe the properties of each horizontal level ( no change .) Set the limit of the separate scale of the indicator window ( no change .) Specify the short indicator name ( name changed .) Fig. 1.9. Ergodic (price, q,r, s,u, ul) indicator Configurations (changes) The code BlauTSI. mq5 has been changed in the following ways. 1. The short description of the mql5-program is changed: 2. An input parameter has been added: 3. (in configuration 11) change is made to the short name of the indicator: Configurations (changes): Graphic plots (2, 6) 1. (in configuration 2) Added one more graphic plot (Signal Line): 2. (in configuration 6) a) Changed the properties of the first graphic plot 0 Ergodic. Previously, as a way to display the line, we used the (identifier DRAWLINE ), now we use a histogram from the zero line ( DRAWHISTOGRAM of the ENUMDRAWTYPE enumeration) Changed the color for displaying the lines and the lines width: b) Added a graphic plot 1 Signal (Signal Line): Configurations (changes): The indicator buffers (3-5) The changes in the configuration indicator array - gt indicator buffer - gt graphical structure: 1. (in configuration 3) The number of buffers increased: 2. (in configuration 4) Added an indicator array, which is required to calculate and render the signal line values: 3. (in configuration 5) The relation indicator array - gt indicator buffer - gt graphical structure is changed: Settings: Number of initial bars without rendering (8) The number of initial bars without the rendering of the graphic plot 0 Ergodic has not changed. The method of calculation is set forth in Section 1.4.1.1. The methods of calculating the number of initial bars without the rendering of the graphic plot 1 Signal is the same. The SignalBuffer array is the result of the smoothing of the significant data of the array MainBuffer (the smoothing period ul). Since the indexation of the MainBuffer array starts from 0 and the significant data in the MainBuffer array start with the index (q-1)(r-1)(s-1)(u-1), the significant data in the SignalBuffer array start with the index (q-1)(r-1)(s-1)(u-1)(ul-1). The global variable begin5 is declared: Calculation (complete, additionally see section 1.4.1.1): 1.4.3.2. The calculation of the Ergodic (price, q,r, s,u, ul) indicator (alterations and additions to the code BlauTSI. mq5) Calculation: The algorithm The algorithm for calculating the indicator Ergodic (price, q,r, s,ul): Check whether there is enough data to calculate the indicator. The calculation of the prices array according to the specified price type - filling of the PriceBuffer array. The determination of the index bar, from with which to begin/continue the calculation of the q-period Momentum. The calculation of the q-period momentum, and its absolute value - the filling of MtmBuffer and AbsMtmBuffer arrays. The first smoothing by the EMA method (period r) - the filling of EMAMtmBuffer and EMAAbsMtmBuffer arrays. The second smoothing by the EMA method (period s) - the filling of DEMAMtmBuffer and DEMAAbsMtmBuffer arrays. The third method smoothing by the EMA method (period u) - the filling of TEMAMtmBuffer and TEMAAbsMtmBuffer arrays. The determination of the index bar, from with which to begin/continue the calculation of the True Strength Index. The calculation of the Ergodic (True Strength Index) - the filling of the MainBuffer array - the calculation of values for rendering the graphic plot 0. The calculation of the signal line - the smoothing of the Ergodic by the EMA method (period ul) - the filling of the SignalBuffer array - the calculation of values for the rendering of the graphic plot 1. The essence of the changes in the algorithm (briefly) a) (see Section 1) the requirement for the minimum size of the indicator input timeseries has changed b) (see paragraph 10) the calculation of the Signal Line has changed. Calculation (change): Check whether there is enough data to calculate the indicator (1) There are no changes In the algorithm: The values of the global variable ratestotalmin has cahnged (the minimum size of the input timeseries of the indicator calculated in the OnInit() function at the Initialization event): Calculation: signal line (10) 2. Stochastic Momentum The considered indicators (see the attachment) are divided into two groups. I. Indicators, based on the Stochastic: BlauTStoch. mq5 - Stochastic (q-period Stochastic smoothed q-period Stochastic) BlauTStochI. mq5 - Stochastic Index (normalized smoothed q-period Stochastic) BlauTSStochastic. mq5 - Stochastic TS-oscillator (based on the index of the Stochastic). II. Indicators, based on the Stochastic Momentum: BlauSM. mq5 - Stochastic Momentum (q-period Stochastic Momentum smoothed q-period Stochastic Momentum) BlauSMI. mq5 - Stochastic Momentum Index (normalized smoothed q-period Momentum) BlauSMStochastic. mq5 - Stochastic SM-Oscillator (based on the Stochastic Momentum Index). 2.1. Indicators based on the Stochastic The Users Guide to the MetaTrader client terminal, in the section Analysis/Technical Indicators/Oscillators/Stochastic Oscillator provides a description of the built-in client terminal MetaTrader 5 of the technical indicators of the Stochastic Oscillator and the ways of its use in technical analysis (see also iStochastic .) 2.1.1. George Lanes Stochastic Oscillator Stochastic . stochastic oscilliator (Stochastic, Stochastic Oscillator ) - is an indicator, which shows the price, in relation to the price fluctuation for the previous q periods. The author and popularizer of the indicator is George Lane. Fast Stochastic . sometimes called K Slow Stochastic (Signal Line), sometimes called D. The formula of Stochastic by George Lane : K - Fast Stochastic D - Slow Stochastic (Signal Line) price - price closing of the current period q - the number of time periods of the prices chart used in calculation of the Stochastic HH (q) - the maximum value for the previous q periods of the highest prices for the period q LL (q) - the minimum value for the previous q periods of the lowest price for the period q SMA ( K, ul) - the simple moving average of order ul, applied to the fast stochastic ( K). According to the interpretation of George Lane . the basic idea is that during the trend of a price increase (upward trend), the price tends to stop, close to the previous maximums. With the trend of price decrease (downward trend), the price tends to stop, close to the previous minimums. 2.1.2. William Blaus Stochastic Oscillator Fig. 2.1. William Blaus indicators, based on the Stochastic 2.1.2.1. Stochastic Stochastic - is the distance from the price closing of the current period to the lowest point of the range of price fluctuations, for the previous q periods. The value of the q-period stochastic shows by how much the price is shifted, relative to the lowest point of the q-period range of price fluctuations. The values of the q-period Stochastic are positive or equal to zero. Higo. 2.2. Definition of the Stochastic The formula of the q-period Stochastic : price - price closing of the current period q - the number of time periods of the prices graph, involved in the calculation of the stochastic LL (q) - the minimum value, for the previous q periods, of the lowest price for the period q. The formula of the smoothed q-period Stochastic : price - price of closing - the price base of the price chart q - the number bars, used in the calculation of the Stochastic stoch(price, q)price-LL(q) - q-period Stochastic EMA (stoch (price, q),r) - first smoothing - EMA of period r, applied to the q-period stochastic EMA (EMA(. r),s) - the second smoothing - EMA of period s, applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - EMA of period u, applied to the result of the 2nd smoothing. TStoch(price, q,r, s,u) - Stochastic. Specification File name . BlauTStoch. mq5 Name . Stochastic Indicator (q-period Stochastic smoothed q-period Stochastic), according to William Blau. Input parameters : q - period, for which the stochastic is calculated (by default q 5) r - period of the 1st EMA, applied to the Stochastic (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used the minimum size of the prices array (q-1 r s u-3 1). 2.1.2.2. The Stochastic Index The Stochastic Index indicator is the normalized smoothed q-period Stochastic. The values of the smoothed q-period Stochastic are mapped to a percentage format (the interval 0, 100). Each value of the smoothed q-period Stochastic is normalized by the value of the q-period price range. The normalization allows to interpret the value of the smoothed normalized q-period Stochastic as the degree of the overbought/oversold states of the market. The formula of the Stochastic Index : price - price of closing - the price base of the price chart q - the number bars, used in the calculation of the Stochastic LL (q) - the minimum value of the lowest price for the period q HH (q) - the maximum value of the highest price for the period q stoch(q)price-LL(q) - q-period Stochastic TStoch(price, q,r, s,u) - three times smoothed q-period Stochastic HH(q)-LL(q) - q-period Price Range EMA (. r) - the first smoothing - the EMA(r), applied to: to the q-period Stochastic to the q-period Price Range EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - EMA(u), applied to the result of the 2nd smoothing. TStochI(price, q,r, s,u) - Stochastic Index. Specification File name . BlauTStochI. mq5 Name . Stochastic Index (normalized smoothed q-period Stochastic), according to William Blau. Input parameters : q - period, for which the stochastic is calculated (by default q 5) r - period of the 1st EMA, applied to the Stochastic (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the rendering style of the graphic plot - the color, thickness, line style (the Colors tab) ( optional ) Two-levels (by default 40 and 60) - add/remove a level change the value and description of the level, change the style of the rendering of the levels (the Levels tab) change the lower (by default 0), and the upper (by default 100) limits of the scale of the separate indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed the minimum size of the prices array (q-1 r s u-3 1). 2.1.2.3. Stochastic Oscillator The definition of the Stochastic Oscillator: TSStochastic() - Fast Stochastic, k - Stochastic Index TStochI(price, q,r, s,u) SignalLine() - Slow Stochastic (Signal Line), d - EMA of period ul, applied to the Fast Stochastic ( k) ul - period EMA signal line - according to William Blau, the ul value must be equal to the period of the last significant (gt 1) EMA fast stochastic. TSStochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification File name . BlauTSStochastic. mq5 Name . Stochastic Oscillator (based on the Stochastic Index), according to William Blau. Input parameters : graphic plot 0 - Fast Stochastic (stochastic index), k: q - period, for which the Stochastic is calculated (by default q 5) r - period of the 1st EMA, applied to Stochastic (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) graphic plot 1 - Slow Stochastic (Signal Line), d: ul - period EMA Signal Line, applied to the Fast Stochastic (by default ul 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the rendering style of each graphical plotting - the color, thickness, line style (the Colors tab) two levels (by default 40 and 60) - add/remove a level change the value and description of the level change the style of the rendering of the levels (the Levels tab) change the lower (by default 0), and the upper (by default 100) limits of the scale of the separate indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used ulgt0. If ul 1, then the Slow Stochastic (Signal line) and the Fast Stochastic lines are the same the minimum size of the prices array (q-1 r s u ul-4 1). 2.1.2.4. Continuity William Blaus Stochastic Oscillator includes the Stochastic Oscillator by George Lane. In order for the TSStochastic (William Blau) to correspond to the standard Stochastic Oscillator (George Lane), implemented in MetaTrader 5, the following must be specified: Fig. 2.3. William Blau Stochastic Oscillator contains George Lanes Stochastic Oscillator 2.1.2.5. The code of the Stochastic Oscillator On the example of the indicator TSStochastic (price, q,r, s,u, ul): 1) The relation between the indicator arrays, indicator buffers, and graphic plots: 2) The calculation algorithm for the q-period Stochastic and the q-period Price Range: 2.2. Indicators, based on the Stochastic Momentum Fig. 2.4. William Blaus indicators, based on the Stochastic Momentum 2.2.1. Stochastic Momentum The Stochastic Momentum (Stochastic Momentum, SM) - is the distance from the price of the current period to the middle of the price range over the previous q periods. The value of the q-period Stochastic Momentum shows the position of price in the price range. The sign of the q-period stochastic momentum shows the price position, relative to the middle of the q-period price range: a positive Stochastic Momentum - the price is above the midpoint, a negative - the price is below the midpoint. Higo. 2.5. The definition of the Stochastic Momentum The formula of the q-period Stochastic Momentum : price - price closing of the current period q - the number of bars, used in calculation of the Stochastic Momentum LL (q) - the minimum value of the lowest price for the period q HH (q) - the maximum value of the highest prices for the period q 1/2 LL(q)HH (q) - the middle of the q-period price range. The formula of the smoothed q-period Stochastic Momentum : price - price of closing - the price base of the price chart q - the number of bars, used in the calculation of the Stochastic momentum sm(price, q)price-1/2LL(q)HH(q) - the q-period Stochastic Momentum EMA (sm(price, q),r) - the first smoothing - the EMA(r), applied to the q-period Stochastic Momentum EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA(EMA(EMA(sm(q),r),s),u) - the third smoothing - the EMA(u), applied to the result of the 2nd smoothing. 2.2.1.2. SM(price, q,r, s,u) - Stochastic Momentum. Specification File name . BlauSM. mq5 Name . Stochastic Momentum Indicator (q-period stochastic momentum, smoothed q-period stochastic momentum), according to William Blau. Input parameters : q - the period by which the stochastic momentum is calculated (by default q 5) r - period of the 1-st EMA, applied to the Stochastic Momentum (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used the minimum size of the prices array (q-1 r s u-3 1). 2.2.2. The Stochastic Momentum Index The Stochastic Momentum Index (SMI) - is an indicator of a normalized stochastic rate (normalized smoothed q-period stochastic momentum). The values of the q-period smoothed Stochastic Momentum is given in the percentage format (interval of display -100, 100). Each value of the smoothed q-period Stochastic Mmomentum is normalized by the value of half of the q-period range of price fluctuations. Normalization allows for the interpretation of the value of SMI as a degree of an overbought level (positive value) or oversold level (negative) of the market. The formula of the Stochastic Momentum Index : price - price of closing - the price base of the price chart LL (q) - the minimum value of the lowest price for the period q HH (q) - the maximum value of the highest prices for the period q sm(price, q)price-1/2LL(q)HH(q) - the q-period Stochastic Momentum SM(price, q,r, s,u) - three times smoothed q-period Stochastic Momentum HH(q)-LL(q) - q-period price range 1/2 LL (q)HH(q) - the middle of the q-period price range 1/2HH(q)-LL(q) - half of the q-period of the price range EMA (. r) - the first smoothing - EMA(r), applied to: 1) the q-period Stochastic Momentum 2) half of the q-period Price Range EMA (EMA(. r),s) - the second smoothing - EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - EMA(u), applied to the result of the 2nd smoothing. 2.2.2.2. SMI(price, q,r, s,u) - Stochastic Momentum Index. Specification File name . BlauSMI. mq5 Name . Stochastic Momentum Index (normalized smoothed q-period Stochastic Momentum) according to William Blau. Input parameters : q - the period by which the Stochastic Momentum is calculated (by default q 5) r - period of 1-st EMA, applied to Stochastic Momentum (by default r 20) s - period of the 2nd EMA, applied to the results of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the results of the 2nd smoothing (by default, u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the rendering style of the graphical plotting - the color, thickness, line style (the Colors tab) ( optional ) Two-levels (by default -40 and 40) - add/remove a level change the value and description of the level, change the style of the rendering of levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed the minimum size of the prices array (q-1 r s u-3 1). 2.2.3. The Stochastic Oscillator The definition of the Stochastic Oscillator: SMStochastic() - Stochastic Momentum Index SMI(price, q,r, s,u) SignalLine() - Signal Line - EMA of period, ul, applied to the Stochastic Momentum Index ul - period EMA signal line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) EMA index of the stochastic rate. 2.2.3.1. SMStochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification File name . BlauSMStochastic. mq5 The name . Stochastic Oscillator (based on the Stochastic Momentum), according to William Blau. Input parameters : graphic plot 0 - the Stochastic Momentum Index: q - the period by which the stochastic momentum is calculated (by default q 5) r - period of the 1st EMA, applied to the Stochastic Momentum (by default r 20) s - period of the 2nd EMA, applied to result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to result of the 2nd smoothing (by default, u 3) graphic plot 1 - the signal line: ul - period EMA signal line, with regards to the index of the stochastic rate (by default ul 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the rendering style of each graphical plotting - the color, thickness, line style (the Colors tab) two levels (by default -40 and 40) - add/remove a level change the value and description of the level, change the rendering style of levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed ulgt0. If ul 1, then the signal line coincides with the index of the stochastic rate the minimum size of the prices array (q-1 r s u ul-4 1). 2.2.4. The code of the Stochastic Oscillator The SMStochastic (price, q, r, s, u, ul): 1) The relation between the indicator arrays, indicator buffers, and graphic plots: 2) The algorithm of calculation of the q-period Stochastic Momentum and half of the q-period price range: 3. The indicator of deviation from the trend The considered indicators (see the attachment) are divided into two groups. I. Indicators, based on a deviation from the market trend. BlauMDI. mq5 - An indicator of an Average Deviation from the trend (mean deviation, moving average deviation) BlauErgodicMDI. mq5 - Ergodic MDI oscillator (based on the mean deviation). II. Indicators, based on the Moving Averages Convergence/Divergence. BlauMACD. mq5 - Moving Averages Convergence/Divergence (MACD smoothed MACD) BlauErgodicMACD. mq5 - Ergodic MACD-Oscillator (based on the MACD indicator). 3.1. Indicators, based on the deviation from the market trends Fig. 3.1. William Blaus indicators are based on a deviation from the market trends 3.1.1. The Mean Deviation Indicator The mean deviation from the trend is the distance between the price and the EMA (exponentially smoothed moving average) of period r, applied to the price. The trend of market development . the EMA(r), applied to the price is used to determine the upward trend (exponential increase), or downtrend (exponential decrease) of prices. The moving average smooths out the price curve, but a slight increase of the moving average period leads to a lag, which is clearly visible at the points of price reversal (see additionally 1.1.1, Fig. 1.2). The value of the average deviation from the trend shows the distance to the EMA(r), applied to the price. The sign of the average deviation from the trend shows the position of the price, relative to the EMA(r) applied to the price: a positive deviation from the trend - the price is higher than the exponent, negative - the price is lower than the exponent. The formula for the mean deviation from the trend : price - price of the current period EMA (price, r) - the market trend - EMA of the r period, applied to the price. See in the Users Guide to the client terminal MetaTrader, in the section Anatyics/Technical Indicators/Trend Indicators. A similar index is used by Alexander Elder in his Bears Power and Bulls Power indicators. See in the Users Guide to the MetaTrader client terminal in the section Analysis/Technical Indicators/Oscillators. The indicator of the mean deviation from the trend (Mean Deviation Index, MDI) - is a smoothed average deviation from the market trend. The formula of the indicator of the mean deviation from the trend : price - price of closing - the price base of the price chart EMA (price, r) - the market trend - the first smoothing of the EMA(r), applied to the price md (price, r) price-EMA (price, r) - the mean deviation from the trend - the deviation of the price from the EMA(r), applied to the price EMA (md (price, r), s) - the second smoothing - the EMA(s), applied to the mean deviation from the trend EMA (EMA (md(price, r),s),u) - the third smoothing - the EMA(u), applied to the result of the second smoothing. 3.1.1.3. MDI(price, r,s, u) - Mean Deviation Index. Specification File name . BlauMDI. mq5 Name . The indicator of the mean deviation from the market (mean deviation a smoothed mean deviation), according to William Blau. Input parameters : r - period of the 1st EMA, applied to the price (by default r20) s - period of the 2nd EMA, applied to mean deviation (by default, s 5) u - period of the 3rd EMA, applied to result of the 2nd smoothing (by default, u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : rgt1 sgt0, ugt0. If s or u are equal to 1, the EMA smoothing is not used the minimum size of the prices array (rsu-31). 3.1.2. Ergodic MDI-oscillator Definition of the Ergodic MDI-oscillator: ErgodicMDI() - Ergodic - Mean Deviation Index MDI(price, r,s, u) The SignalLine() - a Signal line - EMA of period ul, applied to the Ergodic ul - an EMA period of a Signal line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) of the EMA ergodic. 3.1.2.2. ErgodicMDI(price, r,s, u,ul) - Ergodic MDI-oscillator. Specification File name . BlauErgodicMDI. mq5 Name . The Ergodic MDI-oscillator (based on the Mean Deviation Index), according to William Blau. Input parameters : graphic plot 0 - Ergodic (the indicator of the mean deviation from the trend): r - period of the 1st EMA, applied to the price (by default r20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default, s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) graphic plot 1 - Signal Line: ul - period EMA signal line, applied to the Ergodic (by default ul 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the style of the rendering of each graphical structure - the color, width, line style (the Colors tab). Limitations : rgt1 sgt0, ugt0. If s or u are equal to 1, the EMA smoothing is not used ulgt0. If ul 1, then the Signal line and the Ergodic lines are the same the minimum size of the prices array (rsuul-41). 3.1.3. The code of the Ergodic oscillator As example, lets consider the ErgodicMDI (price, r,s, u,ul) indicator: 1) The relation between the indicator arrays, indicator buffers, and graphic plots: 2) The algorithm for calculating the mean deviation: 3.2. Indicators, based on the Moving Average Convergence/Divergence Fig. 3.2. Indicators by William Blau are based on the Moving Averages Convergence/Divergence 3.2.1. The indicator of Moving Averages Convergence/Divergence The Moving Average Convergence/Divergence (Moving Average Convergence/Divergence, MACD ) - is the difference between two exponentially smoothed moving averages: the fast EMA(s) the slow EMA(r), applied to the price. The sign MACD shows the position of the Fast EMA(s), relative to the slow EMA(r): a positive MACD - EMA(s) is above the EMA(r), a negative MACD - EMA(s) is below EMA(r). Change of the MACD by the absolute value . an increaseMACD indicates the discrepancy between the moving averages, a decreaseMACD indicates a convergence of the moving averages. The formula of the Moving Average Convergence/Divergence: price - price closing of the current period EMA(price, r) - Slow EMA(r), applied to the price EMA(price, s) - Fast EMA(s), applied to the price. The MACD indicator show the relationship between the fast and the slow exponential averages (smoothed convergence/divergence of the moving averages). The formula of the MACD indicator : price - price of closing - the price of the price chart EMA(price, r) - the first smoothing - the slow exponential of the EMA(r), applied to the price EMA(price, s) - the second smoothing - the fast EMA(s), s, applied to the price macd(r, s)EMA(price, s)-EMA (price, r) - the MACD EMA(macd (r, s),u) - the third smoothing - the EMA(u), applied to the MACD: a fast EMA (price, s) and a slow EMA (price, r). 3.2.1.1. MACD(price, r,s, u) - the Moving Average Convergence/Divergence indicator. Specification File name . BlauMACD. mq5 Name . The MACD indicator (MACDsmoothed MACD), according to William Blau. Input parameters : r - period of the 1st EMA (slow), applied to the price (by default r 20) s - period of the 2nd EMA (fast), applied to the price (by default s 5) u - period of the 3rd EMA, applied to the moving averages convergence/divergence (by default u 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : rgt1, sgt1 s ltr (limit by the requirements of the theory, is not checked on the program level) ugt0. If u 1, smoothing is not performed the minimum size of the prices array (max(r, s)u-21). 3.2.2. Ergodic MACD-oscillator The definition of the Ergodic MACD-oscillator: ErgodicMACD () - Ergodic - is an indicator of moving averages convergence/divergence MACD(price, r,s, u) The SignalLine() - a Signal Line - an EMA(ul), applied to the ergodic ul - an EMA period of a signal line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) of the EMA ergodic. The Users Guide to the MetaTrader client terminal, in the Analytics/Technical Indicators/Oscillators/MACD section, describes the technical indicator Convergence/Divergence of the moving averages (MACD). built-in in the MetaTrader 5 client terminal, and how to use it in technical analysis (see also iMACD .) In contrast to the standard MACD, William Blau uses the exponentially smoothed moving average (in the standard MACD the simple moving average is used). 3.2.2.1. ErgodicMACD(price, r,s, u,ul) - Ergodic MACD-oscillator. Specification File name . BlauErgodicMACD. mq5 Name . Ergodic MACD-oscillator (based on the moving averages convergence/divergence indicator), according to William Blau. Input parameters : graphic plot 0 - Ergodic (the moving averages convergence/divergence): r - period of the 1st EMA (slow), applied to the price (by default r 20) s - period of the 2nd EMA (fast) applied to the price (by default s 5) u - period of the 3rd EMA, applied to the moving averages convergence/divergence (by default u 3) graphic plot 1 - the Signal Line: ul - period EMA signal line, is applied to the ergodic (by default ul 3) AppliedPrice - price type (default AppliedPrice PRICECLOSE ). Additionally : displayed in a separate window change the style of the rendering of each graphical structure - the color, width, line style (the Colors tab). Limitations : rgt1, sgt1 s ltr (limit by the requirements of the theory, is not checked on the program level) ugt0. If u 1, smoothing is not performed ulgt0. If ul 1, then the signal line coincides with the ergodic the minimum size of the prices array (max(r, s)uul-31). 3.2.3. The code of the Ergodic MACD-Oscillator As example, lets consider the ErgodicMACD (price, r,s, u,ul) indicator: 1) The link between the indicator arrays, indicator buffers, and graphic plots: 2) The algorithm of moving averages convergence/divergence: In calculating the Ergodic MDI-oscillator and the MACD-Oscillator, according to William Blau, the normalization is not used (for reference see pp. 1.2.1, 1.3.1). Therefore, the Ergodic MDI-Oscillator and the MACD-Oscillator cannot be used to interpret the degree of the overbought or the oversold market . For example, the recommendations for using the MACD indicator signals from the Users Guide to the MetaTrader client terminal of the Analytics/Technical Indicators/Oscillators/MACD section: The MACD is also useful as an overbought/oversold indicator. Cuando el promedio móvil más corto se aleja dramáticamente del promedio móvil más largo (es decir, el MACD sube), es probable que el precio de la seguridad sea excesivo y pronto volverá a niveles más realistas. in this case, from the aspect of technical analysis. 4. Candlestick Momentum The considered indicators (see the attachment) are divided into two groups. BlauCMtm. mq5 - is the Candlestick Momentum indicator (momentum of the q-period candlestick smoothed q-period Candlestick Momentum) The Indexes (normalized smoothed q-period Candlestick Momentum): BlauCMI. mq5 - the Candlestick Momentum Index (normalization by the absolute value of the q-period Candlestick Momentum) BlauCSI. mq5 - the Candlestick Index (the normalized by the length q-period Candlestick) The ergodic oscillator of the candlestick BlauErgodicCMI. mq5 - the Ergodic CMI-Oscillator (based on the Candlestick Momentum Index) BlauErgodicCSI. mq5 - the Ergodic CSI-Oscillator (based on the Candlestick Index). Higo. 4.1. Indicators by William Blau, based on the Candlestick Momentum (normalized by the absolute value of the q-period Candlestick Momentum) Fig. 4.2. Indicators by William Blau, based on the Candlestick Momentum (normalized by the length of the q-period Candlestick) 4.1. The Candlestick Momentum 4.1.1. The definition of the Candlestick Momentum The Momentum (see p. 1.1) - is the difference between the current price (usually, todays closing price) and the previous price (usually yesterdays closing price). The momentum can reflect the price change at any time period of the price graph. The Candlestick Momentum (according to William Blau) - is the difference between the closing price and the opening price, within the same period (within one candlestick). The sign of the Candlestick Momentum shows the direction of the price change: a positive Candlestick Momentum - the price has increased over the period, a negative - the price has decreased over the period. The formula of the Candlestick Momentum : close - the closing price of the current period of the (candlestick) open - the opening price of the current period of the (candlestick). From the standpoint of universality, lets extend the definition of the candlestick momentum . The Candlestick Momentum can reflect the price change for any time period of the price chart The price base (the closing price, opening price) can be arbitrary. Higo. 4.3. The definition of the q-period Candlestick The formula of the q-period Candlestick Momentum : q - is the number of bars of the price chart, used in calculation of the Candlestick Momentum price1 - price closing at the end of period q price2q-1 - priceopening at the beginning of period q. The formula of the smoothed q-period Candlestick Momentum : q - the number of bars of the price chart, used in calculation the q-period of Candlestick Momentum price1 - price closing at the end of period q price2 - priceopening at the beginning of period q cmtm(price1,price2,q)price1-price2q-1 - q-period Candlestick Momentum EMA (cmtm (price1, price2, q), r) - the first smoothing - EMA(r), applied to the q-period Candlestick Momentum EMA (EMA(. r),s) - the second smoothing - EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - EMA(u), applied to the result of the 2nd smoothing. 4.1.2. CMtm(price1,price2,q, r,s, u) - Candlestick Momentum indicator. Specification File name . BlauCMtm. mq5 Name . The Candlestick Momentum indicator (smoothed q-period Candlestick Momentum), according to William Blau. Input parameters : q - the period of Candlestick Momentum (by default q 1) r - period of the 1st EMA, applied to the q-period Candlestick Momentum (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice1 - price type closing (by default AppliedPrice PRICECLOSE ) AppliedPrice2 - price type opening (by default AppliedPrice PRICEOPEN ). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used the minimum size of the prices array (q-1 r s u-3 1). 4.2. Normalized Candlestick Momentum 4.2.1. Candlestick Momentum Index The Candlestick Momentum Index (CMI) - is the normalized q-period Candlestick Momentum. The values of the smoothed momentum of the q-period Candlestick are given as a percentage (mapping interval -100, 100). Each value of the smoothed momentum of the q-period Candlestick is normalized by the value of the smoothed q-period Candlestick Momentum, taken in the absolute value. Normalization allows the CMI value to be interpreted as a degree of an overbought (positive value) or oversold (negative value) market level. The formula for the Candlestick Momentum Index : q - the number of time periods of the price graph, involved in calculating the momentum of the q-period of the candlestick price1 - price closing at the end of period q price2 - priceopening at the beginning of period q cmtm(price1,pric2,q)price1-pric2q-1, - q-period Candlestick Momentum cmtm(price1,pric2,q) - absolute value of the q-period Candlestick Momentum CMtm (price, q,r, s,u) - three times smoothed q-period Candlestick Momentum EMA (. r) - first smoothing - the EMA(r), applied to: 1) the q-period Candlestick Momentum 2) the absolute value of the q-period Candlestick Momentum EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - the EMA(u), applied to the result of the 2nds smoothing. 4.2.1.1. CMI(price1,price2,q, r,s, u) - Candlestick Momentum Index. Specification File name . BlauCMI. mq5 Name . q-period Candlestick Momentum Index (normalized smoothed q-period Candlestick Momentum normalization by the absolute value of the q-period Candlestick Momentum), according to William Blau. Input parameters : q - the period of the Candlestick Momentum (by default q 1) r - period of the 1st EMA, applied to q-period Candlestick Momentum (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice1 - price type closing (by default AppliedPrice PRICECLOSE ) AppliedPrice2 - price type opening (by default AppliedPrice PRICEOPEN ). Additionally : displayed in a separate window change the rendering style of the graphical plotting - the color, thickness, line style (the Colors tab) ( optional ) two-levels (default is -25 and 25) - add/remove a level change the value, the level description, change the rendering style of the levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed the minimum size of the prices array (q-1 r s u-3 1). 4.2.2. The Candlestick Index The Candlestick index (CSI) - is an indicator of the normalized q-period Candlestick Momentum (normalized smoothed q-period Candlestick Momentum). The values of the smoothed q-period Candlestick Momentum are given as a percentage of the scale (mapping interval -100, 100). Each value of the smoothed q-period Candlestick Momentum is normalized by the value of the q-period price range (or by the length of the q-period candlestick). Normalization allows to interpret the value of CSI as a degree of an overbought (positive value) or oversold (negative value) market level. The formula of the Candlestick Index : q - the number of bars of the price chart, used in calculation of the q-period Candlestick Momentum price1 - price closing at the end of period q price2 - priceopening at the beginning of period q cmtm(price1,pric2,q)price1-price2q-1 - q-period Candlestick Momentum LL (q) - the minimum value of the lowest price for the period q HH(q) - the maximum value of the highest price for period q HH(q)-LL(q) - q-period price range (the length of the q-period candlestick) CMtm(price1,pric2,q, r,s, u) - three times smoothed q-period Candlestick Momentum EMA (. r) - the first smoothing - the EMA(r), applied to: 1) the q-period Candlestick Momentum, 2) the q-period Price Range (or the length of the q - period candlestick) EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - the EMA(u), applied to the result of the 2nd smoothing. 4.2.2.1. CSI(price1,price2,q, r,s, u) - Candlestick Index. Specification File name . BlauCSI. mq5 Name . q-period Candlestick Index (normalized smoothed q-period Candlestick Momentum normalization by the length of the q-period candlestick), according to William Blau. Input parameters : q - the period for which the q-period Candlestick Momentum is calculated (by default q 1) r - period of the 1st EMA, applied to the q-period candlestick Momentum (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) AppliedPrice1 - price type closing (by default AppliedPrice PRICECLOSE ) AppliedPrice2 - price type opening (by default AppliedPrice PRICEOPEN ). Additionally : displayed in a separate window change the rendering style of the graphical plotting - the color, thickness, line style (the Colors tab) ( optional ) two-levels (default is -25 and 25) - add/remove a level change the value, the level description, change the rendering style of the levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used the minimum size of the prices array (q-1 r s u-3 1). 4.3. The Ergodic Oscillators of the candlestick 4.3.1. The Ergodic CMI-oscillator The definition of the Ergodic CMI-oscillator: ErgodicCMI() - Ergodic - Candlestick Momentum Index CMI(price1,price2,q, r,s, u) The SignalLine() - a Signal Line - EMA(ul), applied to the Ergodic ul - an EMA period of a signal line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) of the EMA ergodic. ErgodicCMI(price1,pric2,q, r,s, u,ul) - ergodic CMI-oscillator. Specification File name . BlauErgodicCMI. mq5 Name . Ergodic CMI-Oscillator (based on the Candlestick Momentum Index), according to William Blau. Input parameters : graphic plot 0 - Ergodic (Candlestick Momentum Index): q - the period of Candlestick Momentum (by default q 1) r - period of the 1st EMA, applied to q-period Candlestick Momentum (by default r 20) s - period of the 2nd EMA, applied to result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to result of the 2nd smoothing (by default, u 3) graphic plot 1 - the Signal Line: ul - period of Signal Line, applied to the Ergodic (by default ul 3) AppliedPrice1 - price type closing (by default AppliedPrice PRICECLOSE ) AppliedPrice2 - price type opening (by default AppliedPrice PRICEOPEN ). Additionally : displayed in a separate window change the rendering style of each graphical plotting - the color, thickness, line style (the Colors tab) two levels (by default -25 and 25) - add/remove a level, change the value, level description, change the rendering style of levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed ulgt0. If ul 1, then the signal line coincides with the ergodic the minimum size of the prices array (q-1 r s u ul-4 1). The code of the Ergodic CMI-oscillator As example, lets consider the ErgodicCMI (price1,price2,r, s,u, ul) indicator: 1) The relation between the indicator arrays, indicator buffers, and graphic plots: 2) Algorithm of calculating cmtm and cmtm: 4.3.2. The Ergodic CSI-oscillator The Ergodic CSI-oscillator is defined as follows: ErgodicCSI() - Ergodic - Candlestick index CSI(price1,price2,q, r,s, u) The SignalLine() - a Signal Line - the EMA(u)l, applied to the Ergodic ul - an EMA period of a Signal Line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) of the EMA ergodic. 4.3.2.1. ErgodicCSI(price1,pric2,q, r,s, u,ul) - ergodic CSI-oscillator. Specification File name . BlauErgodicCSI. mq5 Name . Ergodic CSI-Oscillator (based on the Candlestick Index), according to William Blau. Input parameters : graphic plot 0 - Ergodic (Candlestick Index): q - the period for which the q-period Candlestick Momentum is calculated (by default q 1) r - period of the 1st EMA, applied to the q-period Candlestick Momentum (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3) graphic plot 1 - the Signal Line: ul - period EMA signal line, is applied to the Ergodic (by default ul 3) AppliedPrice1 - price type closing (by default AppliedPrice PRICECLOSE ) AppliedPrice2 - price type opening (by default AppliedPrice PRICEOPEN ). Additionally : displayed in a separate window change the rendering style of each graphical plotting - the color, thickness, line style (the Colors tab) two levels (by default -25 and 25) - add/remove a level, change the value, level description, change the rendering style of levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) boundaries of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed ulgt0. If ul 1, then the signal line coincides with the ergodic the minimum size of the prices array (q-1 r s u ul-4 1). 4.3.2.2. The code of the Ergodic CSI-oscillator On the example of the indicator ErgodicCSI (price1, price2,r, s,u, ul): 1) The relation between the indicator arrays, indicator buffers, and graphic plots: 2) The algorithm of calculation for the cmtm and the q-period price range: 5. Directional Trend The considered indicators (see attachment): BlauHLM. mq5 - is an indicator of the Virtual Close (q-period Composite High-Low Momentum the smoothed q-period Composite High-Low Momentum) BlauDTI. mq5 - the Directional Trend Index (normalized smoothed q-period Composite High-Low Momentum) BlauErgodicDTI. mq5 - the Ergodic DTI-oscillator (based on the Directional Trend Index). Higo. 5.1. Directional Trend Index Indicators 5.1. The Composite High-Low Momentum 5.1.1. Defining the momentum of the up-trend and down-trend One of the definitions of the trend. If the values of the maximum prices increase, then there is an upward trend . If the values of the minimum prices are decreasing, then there is a downward trend . A group of Momentum indicators, discussed in Section 1, can be used tp calculate the momentum for the maximums of the prices: and for the minimum prices: The up-trend Momentum or the High Momentum Up (HMU) is the positive difference between the maximum price of the current period, and the maximum price at the beginning of the q-period price range. The value of the q-period Momentum of the up-trend shows a relative velocity of the growth of the maximum price for the current period, compared to the maximum price at the beginning of the q-period range of price fluctuations. The formula of the q-period momentum of the up-trend : q - is the number of time periods of the price graph, involved in the calculation of the up-trend momentum High - the maximum price for the current period Highq1 - maximum price (q-1) periods ago. The down-trend momentum or the Low Momentum Down (LMD) - this is a positive difference between the minimum price of the current period, and the lowest price for the beginning of the q-period range of price fluctuations. The value of the q-period momentum of the down-trend shows the relative velocity of the decrease of the minimum price of the current period, compared with the lowest price for the beginning of the q-period price range. The formula of the q-period down-trend Momentum : q - is the number of time periods of the price chart, used in the calculation of the down-trend momentum Low - the minimum price for the current period Lowq-1 - the minimum price (q-1) periods ago. A Composite High-Low Momentum (High-Low Momentum, HLM) - is the difference between the q-period Momentum of the up-trend and the q-period Momentum of the down-trend. The sign of the composite High-Low Momentum indicates the trend of price changes: a positive HLM - a trend of price increase (upward trend), and a negative - the trend of price decrease (downward trend). q - the number of time periods of the price graph, involved in the calculation of the momentums of the up-trend and down-trend HMU(q) - the momentum of the up-trend for the period q LMD(q) - the momentum of the down-trend for the period q. The formula of the smoothed q-period Composite High-Low Momentum (Virtual Close): q - the number of time periods of the price graph, involved in the calculation of the momentums of the up-trend and down-trend HMU(q) - the momentum of the up-trend for the period q LMD(q) - the momentum of the down-trend for the period q HLM(q) HMU(q)-LMD(q) - the q-period Composite High-Low Momentum EMA (HLM (q), r) - the first smoothing - the EMA(r), applied to the q-period Composite High-Low Momentum EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - the EMA(u), applied to the result of the 2ndsmoothing. The curve of the graph of the accumulated sum of complex momentums for the maximums and minimums is called a virtual close . 5.1.2. HLM(q, r,s, u) - Virtual Close Indicator. Specification File name . BlauHLM. mq5 Name . Indicator of the virtual Close (q-period Composite High-Low Momentum a smoothed q-period Composite High-Low Momentum), according to William Blau. Input parameters : q - the period for which the HLM (by default q 2) is calculated r - period of the 1st EMA, applied to the HLM (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3). Additionally : displayed in a separate window changes of the rendering of the graphical plotting - the color, thickness, line style (the Colors tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed the minimum size of the prices array (q-1 r s u-3 1). 5.2. Directional Trend Index 5.2.1. The definition of the Directional Trend Index The Directional Trend Index (Directional Trend Index, DTI) - is an indicator of a normalized q-period Composite High-Low Momentum (normalized smoothed HLM). The values of the smoothed HLM are given as a percentage of the scale (interval of display -100, 100). Each value of the smoothed HLM is normalized by the value of a smoothed HLM, taken as an absolute value. Normalization allows the DTI value to be interpreted as a degree of an overbought (positive value) or oversold (negative value) market level. The formula of the Directional Trend Index : q - the number of time periods of the price graph, involved in the calculation of the momentums of the up-trend and down-trend HLM(q) HMU(q)-LMD(q) - a complex q-period momentum for the maximums and minimums HLM(q) - absolute value HLM(q) HLM(q, r,s, u) - three times smoothed HLM(q) EMA(. r) - the first smoothing - the EMA(r), applied to: 1) to the HLM (q) 2) to the absolute value of the HLM (q) EMA (EMA(. r),s) - the second smoothing - the EMA(s), applied to the result of the 1st smoothing EMA (EMA (EMA (. r), s), u) - the third smoothing - the EMA(u), applied to the result of the 2nd smoothing. 5.2.2. DTI(q, r,s, u) - Directional Trend Index. Specification File name . BlauDTI. mq5 Name: Directional Trend Index (normalized smoothed q-period Composite High-Low Momentum), according to William Blau. Input parameters : q - the period for which the HLM (by default q 2) is calculated r - period of the 1st EMA, applied to the HLM (by default r 20) s - period of the 2nd EMA, applied to the result of the 1st smoothing (by default s 5) u - period of the 3rd EMA, applied to the result of the 2nd smoothing (by default, u 3). Additionally : displayed in a separate window change the rendering style of the graphical plotting - the color, thickness, line style (the Colors tab) ( optional ) two-levels (default is -25 and 25) - add/remove a level change the value, the level description, change the rendering style of the levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed the minimum size of the prices array (q-1 r s u-3 1). 5.3. The Ergodic DTI-oscillator 5.3.1. The definition of the Ergodic DTI-oscillator ErgodicDTI() - Ergodic - Directional Trend Index DTI(q, r,s, u) The SignalLine() - a Signal Line - an exponentially moving average of period ul, applied to the Ergodic ul - an EMA period of a Signal Line - according to William Blau, the ul value must be equal to the period of the last significant (gt1) of the EMA ergodic. 5.3.2. ErgodicDTI(q, r,s, u,ul) - Ergodic DTI-oscillator. Specification File name . BlauErgodicDTI. mq5 Name . Ergodic DTI-Oscillator (based on the Directional Trend Index) by William Blau. Input parameters : graphic plot 0 - ergodic (index of the directional trend): q - the period for which the HLM (by default q 2) is calculated r - period of the 1st EMA, with regards to the HLM (by default r 20) s - period of the 2nd EMA, with respect to the results of the first smoothing (by default s 5) u - period of the 3rd EMA, with respect to the result of the second smoothing (by default, u 3) graphical construction 1 - the signal line: ul - period EMA signal line, is applied to the ergodic (by default ul 3) Additionally : displayed in a separate window change the rendering style of each graphical plotting - the color, thickness, line style (the Colors tab) two levels (by default -25 and 25) - add/remove a level, change the value, level description, change the rendering style of levels (the Levels tab) change the lower (by default -100) and the upper (by default 100) limits of the scale of the single indicator window (the Scale tab). Limitations : qgt0 rgt0, sgt0, ugt0. If r, s, or u are equal to 1, the EMA smoothing is not used ulgt0. If ul 1, then the signal line coincides with the ergodic the minimum size of the prices array (q-1 r s u ul-4 1). 5.4. The code of the Ergodic DTI-oscillator The ErgodicDTI (q, r,s, u,ul) indicator: 1) The link between the indicator arrays, indicator buffers, and graphic plots: 2) Algorithm of calculation of HLM and HML: Conclusion The first part of the article William Blaus Indicators and Trading Systems on MQL5. Part 1: Indicators provides a description of the developed indicators and oscillators in MQL5, from the book Momentum, Direction, and Divergence by William Blau. The use of these indicators and oscillators when making trading decisions will be described in the second part of the article William Blaus Indicators and Trading Systems in MQL5. Part 2: Trading Systems . The contents of the attachment archive of this article (BlauIndicatorsMQL5en. zip):

No comments:

Post a Comment