Borda de opções binárias.
PSX Trading System.
Como este, ao contrário de David 09 de junho de 2018.
Plataforma de Gráfico Usada: Freestockcharts.
SMI Ergodic Indicator (5-20) (Exp MA 5) SAR parabólica (0,02 - 0,20)
Aguarde um cruzamento das duas linhas no indicador SMI Ergodic (RED deve estar acima de AZUL). Uma vez que a bolha parabólica SAR flip para o fundo, INICIAMENTE entra no comércio.
Coloque oportunidade - Aguarde por um cruzamento das duas linhas no indicador SMI Ergodic (o AZUL deve estar acima do VERMELHO). Uma vez que a bolha parabólica SAR flip até o topo, entrar IMEDIATAMENTE no comércio.
Arquivos anexados.
setup. png 216.9KB 236 downloads.
Like This Ao contrário do raydioturner 09 de junho de 2018.
O SMI Ergodoic é outro overbought / vendido indiy? Em caso afirmativo existem níveis que indicam a área de sobrecompra / venda?
Como este, ao contrário de David 09 de junho de 2018.
De acordo com o FSC - "O SMI Ergodic é calculado o mesmo que o Índice True Strength. Ele também inclui uma linha de sinal (em cyan abaixo) que é uma média móvel exponencial da trama Ergodic SMI (em vermelho abaixo).
SMI Ergodic Oscillator traça a diferença entre o SMI Erdogic e a linha de sinal ".
No entanto, eu não estava usando níveis específicos, eu só estava usando os cruzamentos.
Like This Ao contrário de kat1911 25 Jul 2018.
Eu realmente gosto desse sistema com o qual foi divertido brincar.
Like This Ao contrário de kat1911 26 Jul 2018.
Foi a demonstração de tudo morining e amá-lo.
USD / CAD 8:46 ITM 9: 00EXPIRY.
EUR / USD 9:02 ITM 9: 30EXPIRY.
Perdeu estes também, mas eles também eram ITM.
GBP / USD 9:00 ITM 9: 30EXPIRY.
AUD / USD 9:05 ITM 9: 30EXPIRY.
JPY / USD 9:15 ITM 10: 00EXPIRY.
Obrigado por compartilhar este David, isso realmente foi consistente até agora.
Like This Ao contrário dos trains40 27 de julho de 2018.
Onde posso obter o indicador smi para metatrader?
Como isso, ao contrário de Holyfire 27 de julho de 2018.
Você pode baixá-lo aqui:
Like This Ao contrário dos trains40 27 de julho de 2018.
Você sabe como configurar as entradas?
Like This Ao contrário de patriazil 08 de agosto de 2018.
Eu baixei o indicador do link acima (não estava em MT4). No entanto, as configurações de entrada são Period_Q = 2, Period_R = 8, Period_S = 5, Sinal = 5 (mostrando no gráfico como SMI (2,8,5,5). Essas configurações são corretas?
Like This Ao contrário de Aaron565 09 de agosto de 2018.
Vou testar isso em breve. Minha primeira impressão é que ele funciona melhor em um mercado volátil. Além disso, se fosse usado para forex regular, então você iria sair do comércio quando o SMI cruzou novamente.
Like This Ao contrário de portergw 10 de agosto de 2018.
Oi, esse sistema só funciona no gráfico de 15 minutos?
Like This Ao contrário de Aaron565 10 de agosto de 2018.
Ao usar isso no MT4, mude os parâmetros do intervalo min / max para Min: -55 Max: 55. Isso o torna tão claro quanto possível. Também precisamos encontrar os parâmetros Q, R, S, de sinal certos, como disse Patbrazil.
Como este, ao contrário do earldennison 15 de agosto de 2018.
Dê-nos mais exemplos de entradas nesta estratégia.
desde já, obrigado.
Como este, ao contrário de Alison Campion 28 de agosto de 2018.
Oi - Eu descobri que esse indicador não parece se mover em tempo real - isso é correto? Alguém mais teve o mesmo problema?
Like This Ao contrário do mattbal 22 de outubro de 2018.
Estabelecemos essa estratégia há alguns dias. Funciona bastante bem, você tem que levar algumas coisas em consideração, embora o que eu gostaria de saber de antemão. A bolha não será necessariamente virada no início de uma nova vela, pode virar no meio de uma abertura, então tenha o seu comércio pronto. Outra coisa é que o sucesso desta estratégia pode ser afetado por segundos, literalmente. Você realmente precisa ser rápido, pois eu perdi negócios por apenas 5 segundos (claro que nos gráficos essas previsões comerciais teriam mostrado como correto ...)
Like This Ao contrário de marijan993 23 de outubro de 2018.
A paciência é uma virtude que eu estou aprendendo da maneira mais difícil.
Todos nós fizemos o caminho mais difícil.
Como este, ao contrário de rejeitado 08 de novembro de 2018.
Você pode baixá-lo aqui:
O arquivo não está mais disponível no compartilhamento. Eu consegui baixar a fonte de outro lugar (Ergodic, sem SMI), mas o indicador não parece estar visível no meu gráfico. Você poderia me dar uma mão nisso?
Arquivos anexados.
ergodic. PNG 41.6KB 24 downloads.
Like This Ao contrário do mustek 30 de novembro de 2018.
Apenas um comentário em geral. É muito fácil voltar na história para determinar quando colocar um comércio. No entanto, quando se trata de tempo real, ainda acho difícil quando colocar um comércio. Suponho que uma coisa a lembrar é que, com todos os indicadores, há um atraso. o que me confunde a merda.
Like This Ao contrário de danielelsmers 09 fev 2018.
olhe nas configurações de propriedades dos indicadores. você pode ter que mudar as cores. Eu tive o mesmo problema.
Curta-se a isso, à diferença de 09 de abril de 2018.
Oi tudo, eu também estou descobrindo que esse indicador parece estar atrasado na ação do preço, às vezes por até 10 bares / velas, ao executá-lo no MT4.
sistema de comércio ergódico
O Indicador Ergodic SMI é o mesmo que o True Strength Index (TSI) desenvolvido por William Blau, exceto que o SMI inclui uma linha de sinal. O SMI usa médias móveis duplas do preço menos o preço anterior em 2 prazos. A linha de sinal, que é um EMA do SMI, é plotada para ajudar a disparar sinais comerciais. Também são fornecidos guias ajustáveis para ajustar esses sinais. O usuário pode alterar a entrada (fechar), o método (EMA), os comprimentos de período e os valores de guia. A definição deste indicador é ainda mais expressa no código condensado dado no cálculo abaixo.
Como comerciar com o indicador S80 Ergodic.
Ajuste os guias superior e inferior para controlar a quantidade e a qualidade dos sinais comerciais. Além dos guias, se o SMI cruza a linha de sinal, uma mudança de tendência é prevista. Se o SMI estiver acima do guia superior e cruza abaixo da linha de sinal, um sinal de venda será gerado. Por outro lado, se o SMI estiver abaixo do guia inferior e cruza acima da linha de sinal, será dado um sinal de compra. A linha 0 divide os touros (acima) dos ursos (abaixo).
Como acessar no MotiveWave.
Vá para o menu superior, escolha Study & gt; Osciladores & gt; SMI Ergodic Indicator.
ou vá para o menu superior, escolha Adicionar Estudo, comece a digitar o nome deste estudo até que apareça na lista, clique no nome do estudo, clique em OK.
Disclaimer importante: as informações fornecidas nesta página são estritamente para fins informativos e não devem ser interpretadas como conselhos ou solicitações para comprar ou vender qualquer garantia. Consulte a Divulgação de Riscos e a Declaração de Descargo de Desempenho.
Cálculo.
// preço (definido pelo usuário, o valor padrão é o preço de fechamento)
// método = média móvel (definida pelo usuário, o padrão é EMA)
// abs = valor absoluto.
// ma = média móvel, índice = número da barra atual.
sistema de comércio ergódico
Puxe pedidos 0.
Participe do GitHub hoje.
O GitHub é o lar de mais de 20 milhões de desenvolvedores que trabalham juntos para hospedar e rever o código, gerenciar projetos e criar software juntos.
Clone com HTTPS.
Use o Git ou o check-out com o SVN usando o URL da web.
A Ergodicity é uma plataforma de negociação automatizada baseada em atores de código aberto, fornecendo ferramentas para negociação orientada para a estratégia com o uso de dados de mercado de Nível 1 e Nível 2. A Ergodicity suporta a conectividade direta de dados de mercado com a Bolsa de Valores do "Russian Trading System" usando seu protocolo proprietário Plaza2 para execução em tempo real de baixa latência. Além disso, fornece mecanismo tick-by-tick backtest para executar as mesmas estratégias em dados históricos armazenados no MarketDb para análise de desempenho e otimização.
A Platfrom usa Scala como idioma primário e depende da arquitetura baseada em eventos usando Akka Actors para concorrência e escalabilidade.
O projeto MarketDb também é parte da plataforma de Ergodicity e usado para captura e captura de dados de mercado.
backtest - estratégias de captura de quadros de backtesting - captura de dados de mercado usando conectividade de mercado direto com RTS CGate API cgate - abstração baseada em ator em CGate núcleo - componentes principais da plataforma: pedido, OrderBook, Trade, Session etc. engine - esquema de mecanismo de execução de estratégia - projeto compartilhado para backtest e `capture 'com esquema de banco de dados.
A ergodicidade é construída usando a arquitetura conduzida por eventos. Todos os dados de mercado recebidos da Bolsa de Valores (comércio, adicionar ordem, cancelar pedido, atualizações de sessão, etc.) considerados como um evento. Componentes principais de uma plataforma apresentada como Atores: sessão de negociação, cada ação atribuída para sessão, cada ordem, etc. A Akka como espinha dorsal para a plataforma permite aproveitar esta abordagem e construir plataforma com tolerância a falhas e alta escalabilidade em sua natureza .
Para compilar projetos de Ergodicity, é necessário instalar a biblioteca CGate. Windows e Linux estão disponíveis no servidor RTS. Após a instalação, você deve adicionar o diretório $ CGATE_HOME / p2bin na variável $ Path para fornecer acesso à ferramenta de geração de código.
Consulte o projeto / SchemeTools. scala para obter detalhes.
&cópia de; 2018 GitHub, Inc. Termos Privacidade Segurança Status Ajuda.
Você não pode executar essa ação neste momento.
Você fez login com outra guia ou janela. Recarregue para atualizar sua sessão. Você se separou em outra guia ou janela. Recarregue para atualizar sua sessão.
Indicador ERGODIC NinjaTrader.
Experimente este indicador ERGODIC NinjaTrader na sua plataforma NT. Isso também pode ser conhecido como indicador ERGODIC. Olhe para o nosso artigo do tutorial sobre a instalação de indicadores NinjaTrader se você não tiver certeza de como adicionar este ERGODIC em sua plataforma NT.
Procure mais indicadores Forex NinjaTrader por nome.
Apenas baixado por outro visitante: indicador MACD BB LINES.
Alguns outros indicadores populares do Metatrader para instalar.
Aqui estão alguns dos indicadores NinjaTrader mais utilizados que caracterizamos em nosso site. Você encontrará várias versões modificadas destes no índice principal de download A a Z acima.
Ou volte ao nosso índice principal para ver todos os nossos indicadores NinjaTrader gratuitos.
Indicadores e sistemas de negociação de William Blau no MQL5. Parte 1: Indicadores.
O comércio técnico só pode ser explorado se houver boas ferramentas disponíveis.
As ferramentas de um bom comerciante são experiência, julgamento e uma hierarquia matemática fornecida pelo bom programa de computador de negociação.
Introdução.
A primeira parte do artigo "Indicadores e Sistemas Comerciais no MQL5 de William Blau. Parte 1: Indicadores" é uma descrição de indicadores e osciladores, descrito por William Blau no livro "Momentum, Direction e Divergence".
Os indicadores e osciladores, descritos neste artigo, são apresentados como códigos fonte em linguagem MQL5 e anexados no arquivo "Blau_Indicators_MQL5_en. zip".
A idéia-chave da análise de William Blau.
A análise técnica de William Blau consiste em quatro fases:
Usando os dados da série de preços (q barras), o indicador é calculado e plotado no gráfico. O indicador não reflete a tendência geral do movimento dos preços, e não permite determinar os pontos de reversão da tendência. O indicador é suavizado várias vezes usando o método EMA: a primeira vez (com o período r), a segunda vez (com o período s) e a terceira vez (com o período u); um indicador suavizado é plotado. Um indicador suavizado com bastante precisão e reproduz as flutuações de preços com um atraso mínimo. Ele permite determinar a tendência do movimento do preço e os pontos de reversão e elimina o ruído do preço. O indicador suavizado é normalizado, um indicador suavizado normalizado é plotado. A normalização permite que o valor do indicador seja interpretado como os estados de sobrecompra ou sobrevenda do mercado. Um indicador suavizado normalizado é alisado uma vez pelo método EMA (período ul); um oscilador é construído - o histograma do indicador e a linha de sinal, os níveis de sobrecompra e sobrevenda do mercado são adicionados. O Oscilador nos permite distinguir os estados de sobrecompra / sobrevenda do mercado, os pontos revertais e o fim de uma tendência.
Indicadores.
O artigo descreve os seguintes grupos de indicadores:
Indicadores, com base no Momentum:
Para cada grupo de indicadores, são apresentados os seguintes:
Índice de indicadores suavizados; O índice do indicador suavizado normalizado; O oscilador, com base no índice do índice de alisamento normalizado.
Uma análise detalhada da abordagem de William Blau no aspecto da análise técnica da tabela de preços; Uma descrição detalhada do algoritmo e código de cada indicador dos grupos de indicadores baseados em Momentum.
Como um método de suavização, William Blau usa as médias móveis suavizadas exponencialmente (EMA). A Média Móvel Exponencial é calculada adicionando ao valor anterior da Média Móvel, uma certa porcentagem do preço atual.
Ao usar o EMA, os últimos preços têm um peso maior.
A função de cálculo da EMA:
EMA (k, n) - média móvel suavizada exponencialmente do período n para o momento do período k; preço (k) - o preço no momento do período k.
A descrição dos quatro tipos de médias móveis e os métodos de seu uso na análise técnica (veja também iMA) podem ser encontradas na "MetaTrader 5 Help" ("Analytics / Indicadores Técnicos / Indicadores de Tendências / Média Mover").
A Biblioteca de Funções.
A biblioteca de funções para calcular as médias móveis está localizada nas "Moedas em Movimento. mqh". Estamos preocupados com o ExponentialMAOnBuffer (), que preenche o buffer de matriz de saída [] com valores EMA do preço da matriz de entrada []. No entanto, a implementação do ExponentialMAOnBuffer () apresentado no "MovingAmedes. mqh" tem a desvantagem de que não funciona com o período n = 1.
Veja no código-fonte:
No entanto, William Blau em seu livro usa o período de suavização n = 1 como a ausência de suavização.
Portanto, o código da função ExponentialMAOnBuffer () sofreu algumas alterações:
e obtemos o ExponentialMAOnBufferWB (). O código desta função está localizado no arquivo "WilliamBlau. mqh".
O arquivo "WilliamBlau. mqh" também possui as seguintes funções:
A função PriceName () retorna o tipo de preço como uma seqüência de caracteres: a função CalculatePriceBuffer () calcula a matriz de preços desse tipo de preço:
O tipo de preço aplicado eo prazo do gráfico de preços.
William Blau considera os preços de fechamento do prazo diário. Os indicadores, desenvolvidos neste artigo, permitem que você escolha o tipo de preço (veja as constantes de preços), o cronograma do gráfico de preços depende do prazo do indicador (veja os prazos do gráfico).
1. The True Strength Index.
Os indicadores considerados (ver anexo):
Blau_Mtm. mq5 - Indicador da taxa (Momentum do período de q, Momento do período q suavizado); Blau_TSI. mq5 - Índice de pontos fortes verdadeiros (Momentum do período q suavizado normalizado); Blau_Ergodic. mq5 - Oscilador Ergódico (baseado no índice True Strength).
A descrição do indicador técnico incorporado Momentum e seu uso está em análise técnica podem ser encontradas na seção "Ajuda do MetaTrader 5", "Analítica / Indicadores Técnicos / Osciladores / Momento" (veja também iMomentum). Em contraste com o Momentum padrão (iMomentum), o Momentum de William Blau calcula o Momentum como a mudança de preço absoluto.
Um exemplo do MQL5-implementação do True Strength Indicator (ETI) por William Blau é apresentado no artigo "MQL5: Criar seu próprio indicador".
1.1.1. Análise técnica usando o indicador Momentum.
O objetivo da análise técnica é o gráfico de preços do instrumento financeiro. Cada elemento do gráfico é uma barra de preços. A barra de preços tem as seguintes características: horário de abertura, preço de abertura, preço máximo, preço mínimo, preço de fechamento, volumes de negociação e outros. A barra de preços é formada e reflete o comportamento dos preços durante um período de tempo discreto específico (cronograma do gráfico).
A tarefa da análise técnica do gráfico de preços é determinar a tendência atual do movimento de preços, revelar os picos de preços e os fundos e prever a direção da mudança de preço no próximo período de tempo. A complexidade disso é que o preço, ao se mover dentro dos limites de sua tendência básica, faz flutuações multidirecionais criando um chamado ruído de preço.
O que William Blau propôs. A primeira diferença: o Momentum. William Blau calculou o Momentum como um parente da mudança de preço [fechando] por cada período de [dia]; e criou o indicador Momentum. Do ponto de vista matemático, a função Momentum é a primeira derivada do preço.
Fig. 1.1. Indicador Momentum (Momentum do período de q)
O Momentum exibe flutuações de um período do período de preços, que mostra a velocidade (magnitude) e a direção das mudanças de preços ao longo desse período, mas não reflete a tendência geral do movimento dos preços e não determina os pontos de reversão da tendência.
A segunda diferença é o alisamento. A média móvel do Momentum (a soma acumulada das flutuações diárias dos preços) reproduz quase exatamente ambas as variações principais e locais dos preços das curvas. A Fig. 1.2 (a) nas sub-janelas I, II apresentam o Momento de suavização (médias móveis com períodos 20 e 300, respectivamente).
Quanto maior for o período da Média Móvel, mais precisamente, o Momento estimulado aproxima (reproduz) as flutuações da curva de preços. Do ponto de vista matemático, a função de alisar o Momentum é a função integral do impulso ou a função restaurada do preço.
Fig. 1.2 (a). Indicador de Momento (Momento de Momento Liso)
Fig. 1.2 (b). Indicador de Momento (Momento de Momento Liso)
Na Fig. 1.2 (a), na janela principal, são apresentados os indicadores EMA-suavizados (com períodos de 5, 20, 100). Um ligeiro aumento no período da média móvel leva a um atraso e a média móvel praticamente se torna incapaz de reproduzir as flutuações da curva de preços.
A terceira diferença é a reabilitação. O primeiro alisamento do Momentum define a principal tendência do movimento do preço, bem como os pontos de reversão, mas não elimina o ruído. Para eliminar o ruído de preço é necessário um re-alisamento com um pequeno período da média móvel.
Fig. 1.2 (b), na sub-janela, eu apresento o indicador de Momento suavizado (média móvel com o período 20), as subventas II e III apresentam o Momentum duplo e triplo-suavizado (períodos de média móvel de 5, 3) . Um alisamento repetido elimina o ruído do preço, mas adiciona uma ligeira mudança da curva (um atraso).
A quarta diferença: a diferença em um sinal de mudanças nas tendências. O alisamento de Momentum com um pequeno período de média pode levar a uma divergência do Momentum suavizado com a tendência da curva de preços.
Na Fig. 1.2 (a), a discrepância é observada na sub-janela I e na Fig. 1.2 (b) - nas sub-janelas I, II, III (a direção das mudanças de preços diverge da direção da mudança na Momento de suavização). Tais diferenças geralmente indicam uma mudança de tendência. Do ponto de vista matemático, a divergência é uma função do período de suavização.
A confiabilidade da interpretação dessas diferenças como um sinal de evolução das tendências pode ser melhorada se considerarmos a divergência somente para as áreas de sobrecompra ou sobrevenda (ver п. 1.2.1).
1.1.2. Definição do Momentum.
O Momentum é uma mudança de preço relativa.
O sinal do Momentum mostra a direção da mudança de preço: um Momento positivo - o preço aumentou ao longo do período, um negativo - o preço diminuiu ao longo do período. A magnitude do Momentum - é a velocidade relativa da mudança de preço (primeira derivada do preço).
Fig. 1.3. Definição do Momentum.
Fórmula do Momentum:
preço - preço [encerramento] do período atual; preço [1] - preço de [fechamento] do período anterior.
William Blau examina o impulso como a diferença do preço de [fechamento] do período atual e do preço de [fechamento] do período anterior. William Blau, no cálculo de um momento único, usa os preços de dois períodos (os períodos atual e anterior).
Introduzimos na fórmula para calcular o momento um indicador de período, q - é o número de períodos de tempo envolvidos no cálculo (Por William Blau q = 2).
Fórmula de Momento de Momento Q:
q - número de barras, usado no cálculo do momentum; preço - preço [encerramento] do período atual; preço [q-1] - preço de [encerramento] (q-1) há períodos.
Na fórmula resultante, nosso Momentum de dois períodos corresponde a um Momento de um período relativo de William Blau.
Fórmula de um período suavizado de q Momentum:
preço - preço de [fechamento] - a base de preços do gráfico de preços; q - número de barras, usado no cálculo do Momentum; mtm (preço, q) = preço-preço [q-1] - Momento de período de q; EMA (mtm (preço, q), r) - o primeiro alisamento - o EMA (r), aplicado ao Momentum do período Q; EMA (EMA (.r), s) - o segundo alisamento - o EMA (s), aplicado ao resultado do 1º alisamento; EMA (EMA (EMA (.r), s), u) - o terceiro suavização - o EMA (u), aplicado ao resultado do segundo alisamento.
1.1.3. Mtm (preço, q, r, s, u) - indicador de taxa (momentum). Especificação Nome do arquivo: Blau_Mtm. mq5 O nome: Momentum (Momentum do período de q, Momento de um período de liso) de William Blau. Parâmetros de entrada: q - o período para o qual o Momentum é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; mudanças na renderização do gráfico gráfico - a cor, a espessura, o estilo da linha (a guia "Cores"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s ou u for igual a 1, o alisamento EMA não é usado. Por exemplo, se você definir o Mtm (preço, 2,20,5,1), obtemos um impulso de alívio duplo, mas se você definir o Mtm (preço, 2,1,1,1), obtemos um impulso não duradouro; o tamanho mínimo da tabela de preços = (q-1 + r + s + u-3 +1).
1.2. O índice True Strengths.
1.2.1. Análise técnica usando o índice True Strength.
Continuação: veja o início na Seção 1.1.1.
O quinto: a normalização. Trazendo a normalização dos valores do Momentum suavizado para uma única escala (mapeamento para o intervalo [-1, +1]), nos permite determinar os estados de sobrecompra ou sobrevenda do mercado. A multiplicação repetida dos valores do momento estimulado normalizado é um fator de 100 que converte a série numérica na faixa de porcentagem (mapeamento para o intervalo [-100, 100]).
Fig. 1.4. Momento de suavização normalizado.
Uma discrepância como sinal de mudança de tendências pode ser considerada confiável se o impulso alisado normalizado estiver no estado de um sobrecompra ou sobrevenda.
1.2.2. A definição do índice True Strength.
O Índice de Força Verdadeira (Índice de Força Verdadeira, TSI) - é um indicador do Momentum normalizado (Momentum do período q normalizado). Trazendo os valores do Momentum suavizado para uma única escala (mapeamento para o intervalo [-1, +1]) é fornecido com a normalização de cada valor do Momentum suavizado (a soma cumulativa das flutuações de preços suavizadas do período q ) pelo valor do Momentum suavizado, obtido em valor absoluto.
A multiplicação por um coeficiente de 100 altera o intervalo da exibição para [-100, +100] (porcentagem). A normalização permite a interpretação do valor da ETI como um nível de mercado de sobrecompra (positivo) ou sobrevendido (negativo).
A fórmula do índice True Strength:
preço - preço de [fechamento] - a base de preços do gráfico de preços; q - período do Momentum; mtm (preço, q) = preço-preço [q-1] - período de q-período; | Mtm (preço, q) | - o valor absoluto do Momento de Momento Q; Mtm (preço, q, r, s, u) - Momento de três vezes suavizado; EMA (.r) - o primeiro suavização - o EMA do período r, aplicado a:
1) Momento de período de q;
2) valor absoluto do Momentum do período Q; EMA (EMA (.r), s) - o segundo alisamento - o EMA (s), aplicado ao resultado do 1º alisamento; EMA (EMA (EMA (.r), s), u) - o terceiro suavização - EMA (u), aplicado ao resultado do segundo alisamento.
1.2.3. TSI (preço, q, r, s, u) - Índice True Strength. Especificação Nome do arquivo: Blau_TSI. mq5 O nome: The True Strength Index (Momentum relativo do período Q liso normalizado) de William Blau. Parâmetros de entrada: q - o período para o qual o momento é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; alterar o estilo de renderização do gráfico - a cor, a espessura, o estilo da linha (a aba "Cores"); (opcional) dois níveis (o padrão é -25 e +25) - adicionar / remover um nível; alterar o valor, a descrição do nível, alterar o estilo de renderização dos níveis (a guia "Níveis"); altere os limites inferior (por padrão -100) e superior (por padrão, 100) da escala da janela do indicador único (a guia "Escala"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s ou u for igual a 1, então no período EMA correspondente, o alisamento não será executado; o tamanho mínimo da tabela de preços = (q-1 + r + s + u-3 +1).
1.3. Oscilador ergódico.
1.3.1. Análise técnica usando o Oscilador Ergódico.
Continuação: veja o início nas Seções. 1.1.1, 1.2.1.
Sexto: as áreas de um mercado de sobrecompra e sobrevenda. O intervalo da unidade [-1, +1] ou um intervalo de porcentagem [-100.100], dentro do qual as mudanças ocorrem nos valores do impulso alisado normalizado, permite que você defina o mercado de sobrecompração ou sobreposição das áreas.
A classe de índices de análise técnica, que caracteriza o estado do mercado de sobrecompra ou sobrevenda, é chamado de oscilador. Para cada oscilador, os níveis são determinados, na abordagem a que, os sinais de um mercado de sobrecompra ou sobrevenda são recebidos. Osciladores são ineficazes nos mercados de tendências, já que o mercado pode estar em condições de sobrecompra / sobrevenda por um período arbitrariamente longo.
Sétimo: a linha de sinal. Para obter um sinal sobre o final de uma tendência e uma tendência de reversão de um movimento de preço, uma linha de sinal é usada. O sinal de compra é recebido quando a linha principal cruza a linha de sinal de baixo para cima. O sinal de venda é recebido quando a linha principal cruza a linha de sinal de cima para baixo. No caso de uma linha principal - isto é um ergódico (índice de força verdadeira), então um re-alisamento do ergódico forma uma linha de sinal. O procedimento de re-suavização é igual ao último processo de suavização ergódica.
Oitava: a tendência do movimento dos preços. A tendência do movimento do preço é ascendente (tendência ascendente), quando a linha principal (ergódica) passa acima da linha de sinal. A tendência do movimento do preço é descendente (tendência descendente), quando a linha principal (ergódica) passa sob a linha de sinal.
Fig. 1.5. Oscilador Ergódico.
1.3.2. Definição do Oscilador Ergódico.
Ergodic () - ergodic - TSI do Índice de Força Verdadeira (price, q, r, s, u); O SignalLine () - uma linha de sinal - o EMA (ul), aplicado ao ergódico; ul - um período EMA de uma linha de sinal - de acordo com William Blau, o valor ul deve ser igual ao período da última significativa (& gt; 1) do EMA ergódico. Por exemplo, se você estiver usando um Ergodic de suavização dupla (preço, q, r, s, u) = Ergódico (preço, 2,20,5,1), então por William Blau ul = s = 5.
1.3.3. Ergódico (preço, q, r, s, u, ul) - oscilador ergódico. Especificação Nome do arquivo: Blau_Ergodic. mq5 Nome: Ergodic Oscillator (baseado em um índice de força verdadeira) de William Blau. Parâmetros de entrada: gráfico gráfico # 0 - Ergódico (um índice de força verdadeira): q - o período para o qual o momento é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); gráfico gráfico # 1 - a linha de sinal: linha de sinal EMA de ul-período, é aplicada ao ergódico (por padrão ul = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; alterar o estilo de renderização de cada gráfico - a cor, a espessura, o estilo da linha (a guia "Cores"); dois níveis (por padrão, -25 e +25) - adicionar / remover um nível, alterar o valor, a descrição do nível, alterar o estilo de renderização dos níveis (a guia "Níveis"); altere os limites inferior (por padrão -100) e superior (por padrão, 100) da escala da janela de indicador único (a guia "Escala"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s, ou você é igual a 1, o alisamento EMA não é usado; ul & gt; 0. Se ul = 1, a linha de sinal e as linhas de Ergódico são as mesmas; o tamanho mínimo da tabela de preços = (q-1 + r + s + u + ul-4 +1).
1.4. O Código (descrição detalhada)
1.4.1. "Blau_Mtm. mq5" - indicador Mtm (preço, q, r, s, u) - momentum.
O código do indicador Mtm (preço, q, r, s, u):
Vamos considerar o código em detalhes.
1.4.1.1. Configurações do indicador Mtm (preço, q, r, s, u)
Literatura.
O que ler sobre as configurações do indicador na Referência MQL5:
Direito autoral. Descrição do indicador.
Configurações somente através da diretiva #property preprocessor. O сopyright (parâmetros de direitos autorais e link), a versão (a versão do parâmetro) e uma descrição do mql5-program (descrição do parâmetro) são exibidos nas "Propriedades" da janela do indicador (a guia "Propriedades", caixa "Adicional") .
Incluir arquivo.
O préprocessador substitui o #Include & lt; WilliamBlau. mqh & gt; linha com os conteúdos do arquivo "WilliamBlau. mqh". Os suportes angulares indicam que o arquivo "WilliamBlau. mqh" será retirado da pasta de dados do terminal. Para mais informações, consulte Incluindo arquivos.
Sobre o conteúdo do arquivo "WilliamBlau. mqh", veja a introdução.
Configurações do indicador (em geral)
O indicador personalizado - são poucas parcelas gráficas. O gráfico gráfico do indicador pode ser exibido na janela principal do gráfico de preços ou em uma janela separada. Cada gráfico tem um determinado método de desenho, cor, estilo e espessura.
Os dados para a renderização do gráfico são tirados dos buffers de indicadores (cada gráfico corresponde a um ou cinco buffers de indicadores). Usamos uma matriz de indicadores como um buffer de indicadores.
Para configurar o indicador, é necessário (veja a Fig. 1.6):
Especifique a janela para exibir os indicadores. Especifique o número de gráficos gráficos. Especifique o número de buffers de indicadores. Declaração dos arrays dos indicadores. Configure um link: matriz de indicadores - & gt; buffer indicador - & gt; gráfico gráfico. Descreva as propriedades de cada gráfico gráfico. Especifique a precisão da exibição dos valores dos indicadores. Especifique para cada construção gráfica, o número de barras iniciais sem a renderização do gráfico. Configure os níveis horizontais e descreva as propriedades de cada nível horizontal (não presente.) Defina as restrições da escala para a janela do indicador separado (não está presente). Especifique o nome curto do indicador.
Fig. 1.6. Indicador Momentum Mtm (preço, q, r, s, u)
As configurações do indicador são realizadas:
a) quer através da diretiva de préprocessador #property,
A diferença nos métodos de configuração do indicador é que as configurações através da diretiva #property estão disponíveis antes que o indicador seja anexado ao gráfico de preços, enquanto as configurações através de funções especiais estão disponíveis depois que o indicador é anexado ao gráfico de preços. A configuração das configurações é realizada a partir da janela "Propriedades" do indicador.
As configurações: uma janela para exibir o indicador (1)
A configuração é obrigatória e só é possível através da diretiva de préprocessador #property. Existem duas opções de exibição de indicadores:
Na janela principal do gráfico de preços - indicator_chart_window; Em uma janela separada - indicator_separate_window.
Configurações: o número de buffers (3) e gráficos (2)
A configuração é obrigatória e é possível somente através da diretiva #property preprocessor. O número de buffers de indicadores (parameter indicator_buffers) e o número de gráficos (parameter_plots) não estão limitados.
Configurações: matrizes de indicadores (4)
Os arrays de indicadores são declarados a nível global como matrizes dinâmicas unidimensionais de tipo duplo.
Configurações: Configurando o link (5) entre as matrizes de indicadores, buffers de indicadores e gráficos gráficos.
O código está escrito na função OnInit () do manipulador de eventos Init ().
O link do buffer de indicadores com a matriz unidimensional correspondente é configurado com a função SetIndexBuffer ():
O buffer do indicador é uma matriz dinâmica unidimensional de tipo duplo, cujo tamanho é controlado pelo terminal do cliente, de modo que ele sempre corresponde ao número de barras nas quais o indicador é calculado. A indexação dos buffers indicadores começa a partir de 0.
Um buffer de indicadores pode armazenar três tipos de dados: INDICATOR_DATA, INDICATOR_COLOR_INDEX, INDICATOR_CALCULATIONS. Cada gráfico gráfico, de acordo com o método de exibição, pode ser correspondido por um a cinco buffers de indicadores: um a quatro valores de buffer de indicadores (tipo de dados INDICATOR_DATA) e um buffer de cor (tipo de dados INDICATOR_COLOR_INDEX).
Os buffers de indicadores com os dados do tipo INDICATOR_CALCULATIONS são projetados para cálculos intermediários. Após a ligação, a matriz de indicadores terá indexação, assim como nas matrizes convencionais (ver abaixo na Seção 1.4.1.2).
Configurações: Propriedades de gráficos gráficos (6)
Para a configuração de cada conjunto de gráficos, as seguintes coisas são especificadas:
Existem duas formas possíveis de configurar:
1) Através da directiva #property preprocessor (implementada desta forma):
O código está escrito na função OnInit () do manipulador de eventos Init. Especificação da função PlotIndexSet * ():
Para refinar a exibição do tipo selecionado de gráfico, usamos as IDs de propriedade do gráfico gráfico, listados na enumeração ENUM_PLOT_PROPERTY.
A indexação das parcelas gráficas começa a partir de 0. Com relação à preferência de configuração através de uma diretiva #property, veja acima na seção "Preferências de indicadores". Algumas propriedades dos gráficos (a cor, o estilo, a largura da linha) estão disponíveis para troca da janela "Propriedades" (a guia "Cores") do indicador.
Configurações: a precisão da exibição dos valores dos indicadores (7)
O código está escrito na função OnInit () do manipulador de eventos Init. A especificação da função da configuração das configurações do indicador IndicatorSet * ():
Os identificadores das propriedades dos indicadores estão listados na enumeração ENUM_CUSTOMIND_PROPERTY.
A precisão da exibição dos valores do indicador é dada apenas pela função IndicatorSetInteger (), a identificação das propriedades do indicador INDICATOR_DIGITS, ENUM_CUSTOMIND_PROPERTY_INTEGER enumeração.
In an example where the values of the indicator buffers, which are intended to render, under display: next to the short name of the indicator, in a pop-up message, when the mouse pointer is placed over the indicator line - will be rounded up to _Digits - number of digits after the decimal point in the price of the instrument, to which the indicator is attached.
Settings: Number of initial bars without rendering (8)
The data for rendering the q-period Momentum of William Blau is formed in four steps:
Step 1. On the basis of the data from the PriceBuffer[] prices array, the Momentum (the period q) is calculated. The values of the q-period Momentum are placed into the MtmBuffer[] array. Since the indexation of the prices array starts from 0, the significant data in the prices array also start at index 0, then the significant data in the MtmBuffer[] array start with the index (q-1).
Step 2. Significant data in the MtmBuffer[] array is smoothed (smoothing period r). The values of the smoothed q-period Momentum are placed in the EMA_MtmBuffer[] array. Since the indexation of the MtmBuffer[] array starts from 0, the significant data in the MtmBuffer[] array starts with the index (q-1), then the significant data in the EMA_MtmBuffer[] array start with the index (q-1) + (r-1).
The 3rd and 4th steps. Similar considerations are given for determining from which bar starts the meaningful data in the DEMA_MtmBuffer[] array (smoothing period s) and in the MainBuffer[] array (smoothing period u). See Fig. 1.7.
Fig. 1.7. The meaningful data of the Mtm (price, q,r, s,u) indicator.
On a global level the variables are declared:
The values of the variables - is the index of the bar, from which begins the meaningful data, in the corresponding to the variable indicator array. Variable values are calculated in the function OnInit() event handler Init, and will be used in the OnCalculate() function of the Calculate event handler.
The number of initial bars without the showing at the graphic plot is specified using the PlotIndexSetInteger() function, the identifier of the indicator property PLOT_DRAW_BEGIN enumerations ENUM_PLOT_PROPERTY_INTEGER.
Configuration: The short name of the indicator (11)
The code is written in the OnInit() function of the Init event handler. The short name of the indicator is specified only by using the IndicatorSetString() function, identifier of the indicator properties INDICATOR_SHORTNAME (ENUM_CUSTOMIND_PROPERTY_STRING enumeration). The PriceName () function returns the name of the price type, depending on the value of AppliedPrice input parameter. The code of the PriceName () function is located in the file "WilliamBlau. mqh" (see Introduction).
Input parameters.
For more information see input variables. Input parameters are available for change from the "Properties" window (the "Inputs" tab) of the indicator.
1.4.1.2. The calculation of the indicator Mtm (price, q,r, s,u)
Calculation: The algorithm.
The algorithm for calculating the indicator Mtm(price, q,r, s,u):
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 - the filling of the MtmBuffer[] array. The first smoothing by the EMA method (period r) - the filling of the EMA_MtmBuffer[] array. The second smoothing by the EMA method (period s) - the filling of the DEMA_MtmBuffer[] array. The third smoothing by the EMA method (period u) - the filling of the MainBuffer[] array - the calculation of values for the rendering of the graphic plot #0.
Calculation: The function OnCalculate()
The calculation of the indicator values is performed in the OnCalculate() function of the Calculate event handler. We use the second form of OnCalculate() function call.
The rates_total argument is the number of bars of the price chart, which are rendered and are available to the indicator for processing. The prev_calculated - is the number of bars of the price chart that have been processed by the indicator at the time of the start of the current OnCalculate() function call.
The OnCalculate() function returns the number of bars of the price chart that have been processed by the indicator at the time of the end of the current call. This function returns the rates_total parameter and must be constructed in such a way, that on the very first call, all of the unprocessed bars of the price chart, would be processed.
That is, if on the first call of the OnCalculate() function, the parameter prev_calculated is equal to 0, then the on the second call, the parameter prev_calculated is either equal to rates_total or rates_total +1 , and starting from the second call, the OnCalculate() function handles (counts) only the last bar. For further clarification with an example, see here.
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 rates_total_min 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. Let's 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 PriceBuffer[i], and the price(q-1) of the previous periods PriceBuffer[i-(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 EMA_MtmBuffer[] 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. "Blau_TSI. 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 "Blau_Mtm. mq5"):
Let us consider in detail only the modifications and additions to the code "Blau_Mtm. mq5".
1.4.2.1. The configurations of the indicator TSI (price, q,r s, u) (alterations and additions to the code "Blau_Mtm. 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 -> indicator buffer -> 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 "Blau_Mtm. 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 (DRAW_LINE - line), the line color (Blue), the line style (STYLE_SOLID - 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;
Color for the display of the line; Line style (see the possible styles enumerated in ENUM_LINE_STYLE);
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 INDICATOR_LEVEL * index are used, which are listed in the ENUM_CUSTOMIND_PROPERTY enumeration.
The description of each level is set only using the IndicatorSetString() function, the identifier of the indicator property INDICATOR_LEVELTEXT (ENUM_CUSTOMIND_PROPERTY_STRING 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 INDICATOR_MINIMUM and INDICATOR_MAXIMUM (ENUM_CUSTOMIND_PROPERTY_DOUBLE 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 -> indicator buffer -> 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 -> indicator buffer -> 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 "Blau_Mtm. 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 EMA_MtmBuffer[] and EMA_AbsMtmBuffer[] arrays. The second smoothing by the EMA method (period s) - the filling of DEMA_MtmBuffer[] and DEMA_AbsMtmBuffer[] arrays. The third method smoothing by the EMA method (period u) - the filling of TEMA_MtmBuffer[] and TEMA_AbsMtmBuffer[] 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. "Blau_Ergodic. 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 "Blau_TSI. mq5":
Let us consider in detail only the modifications and additions to the code "Blau_TSI. mq5".
1.4.3.1. Configurations of the indicator Ergodic (price, q,r, s,u, ul) (alterations and additions to the code "Blau_TSI. 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 -> indicator buffer -> 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 "Blau_TSI. 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 DRAW_LINE ), now we use a histogram from the zero line ( DRAW_HISTOGRAM of the ENUM_DRAW_TYPE 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 -> indicator buffer -> 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 -> indicator buffer -> 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 "Blau_TSI. 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 EMA_MtmBuffer[] and EMA_AbsMtmBuffer[] arrays. The second smoothing by the EMA method (period s) - the filling of DEMA_MtmBuffer[] and DEMA_AbsMtmBuffer[] arrays. The third method smoothing by the EMA method (period u) - the filling of TEMA_MtmBuffer[] and TEMA_AbsMtmBuffer[] 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 rates_total_min 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:
Blau_TStoch. mq5 - Stochastic (q-period Stochastic; smoothed q-period Stochastic); Blau_TStochI. mq5 - Stochastic Index (normalized smoothed q-period Stochastic); Blau_TS_Stochastic. mq5 - Stochastic TS-oscillator (based on the index of the Stochastic).
II. Indicators, based on the Stochastic Momentum:
Blau_SM. mq5 - Stochastic Momentum (q-period Stochastic Momentum; smoothed q-period Stochastic Momentum); Blau_SMI. mq5 - Stochastic Momentum Index (normalized smoothed q-period Momentum); Blau_SM_Stochastic. mq5 - Stochastic SM-Oscillator (based on the Stochastic Momentum Index).
2.1. Indicators based on the Stochastic.
The "User's 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 Lane's 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 Blau's Stochastic Oscillator.
Fig. 2.1. William Blau's indicators, based on the Stochastic.
2.1.2.1. Estocástico.
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.
Fig. 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 : Blau_TStoch. 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : q>0; r>0, s>0, u>0. 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 : Blau_TStochI. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. 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. Oscilador estocástico.
The definition of the Stochastic Oscillator:
TS_Stochastic() - 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 (> 1) EMA fast stochastic.
TS_Stochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification.
File name : Blau_TS_Stochastic. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, the EMA smoothing is not used; ul>0. 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 Blau's Stochastic Oscillator includes the Stochastic Oscillator by George Lane. In order for the TS_Stochastic (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 Lane's Stochastic Oscillator.
2.1.2.5. The code of the Stochastic Oscillator.
On the example of the indicator TS_Stochastic (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 Blau's 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.
Fig. 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/2*[LL(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 : Blau_SM. 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : q>0; r>0, s>0, u>0. 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/2*[LL(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/2*[HH(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 : Blau_SMI. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. 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. O Oscilador Estocástico.
The definition of the Stochastic Oscillator:
SM_Stochastic() - Stochastic Momentum Index SMI(price, q,r, s,u); SignalLine() - Signal Line - EMA of period, ul, applied to the Stochastic Momentum Index;
2.2.3.1. SM_Stochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification.
File name : Blau_SM_Stochastic. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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 SM_Stochastic (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.
Blau_MDI. mq5 - An indicator of an Average Deviation from the trend (mean deviation, moving average deviation); Blau_Ergodic_MDI. mq5 - Ergodic MDI oscillator (based on the mean deviation).
II. Indicators, based on the Moving Averages Convergence/Divergence.
Blau_MACD. mq5 - Moving Averages Convergence/Divergence (MACD; smoothed MACD); Blau_Ergodic_MACD. mq5 - Ergodic MACD-Oscillator (based on the MACD indicator).
3.1. Indicators, based on the deviation from the market trends.
Fig. 3.1. William Blau's 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 "User's 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 "User's 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 : Blau_MDI. 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 r=20); 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : r>1; s>0, u>0. If s or u are equal to 1, the EMA smoothing is not used; the minimum size of the prices array = (r+s+u-3+1).
3.1.2. Ergodic MDI-oscillator.
Definition of the Ergodic MDI-oscillator:
Ergodic_MDI() - 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 (>1) of the EMA ergodic.
3.1.2.2. Ergodic_MDI(price, r,s, u,ul) - Ergodic MDI-oscillator. Specification.
File name : Blau_Ergodic_MDI. 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 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 - Signal Line: ul - period EMA signal line, applied to the Ergodic (by default ul = 3); AppliedPrice - price type (default AppliedPrice= PRICE_CLOSE ). 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 : r>1; s>0, u>0. If s or u are equal to 1, the EMA smoothing is not used; ul>0. If ul = 1, then the Signal line and the Ergodic lines are the same; the minimum size of the prices array = (r+s+u+ul-4+1).
3.1.3. The code of the Ergodic oscillator.
As example, let's consider the Ergodic_MDI (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 increase|MACD| indicates the discrepancy between the moving averages, a decrease|MACD| 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 : Blau_MACD. mq5 Name : The MACD indicator (MACD;smoothed 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : r>1, s>1; s <r (limit by the requirements of the theory, is not checked on the program level); u>0. If u = 1, smoothing is not performed; the minimum size of the prices array = ([max(r, s)]+u-2+1).
3.2.2. Ergodic MACD-oscillator.
The definition of the Ergodic MACD-oscillator:
Ergodic_MACD () - 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 (>1) of the EMA ergodic.
The "User's 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. Ergodic_MACD(price, r,s, u,ul) - Ergodic MACD-oscillator. Specification.
File name : Blau_Ergodic_MACD. 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= PRICE_CLOSE ). 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 : r>1, s>1; s <r (limit by the requirements of the theory, is not checked on the program level); u>0. If u = 1, smoothing is not performed; ul>0. If ul = 1, then the signal line coincides with the ergodic; the minimum size of the prices array =([max(r, s)]+u+ul-3+1).
3.2.3. The code of the Ergodic MACD-Oscillator.
As example, let's consider the Ergodic_MACD (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 "User's Guide to the MetaTrader client terminal" of the "Analytics/Technical Indicators/Oscillators/MACD" section:
The MACD is also useful as an overbought/oversold indicator. When the shorter moving average pulls away dramatically from the longer moving average (i. e., the MACD rises), it is likely that the security price is overextending and will soon return to more realistic levels.
in this case, from the aspect of technical analysis.
4. Candlestick Momentum.
The considered indicators (see the attachment) are divided into two groups.
Blau_CMtm. 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): Blau_CMI. mq5 - the Candlestick Momentum Index (normalization by the absolute value of the q-period Candlestick Momentum); Blau_CSI. mq5 - the Candlestick Index (the normalized by the length q-period Candlestick); The ergodic oscillator of the candlestick Blau_Ergodic_CMI. mq5 - the Ergodic CMI-Oscillator (based on the Candlestick Momentum Index); Blau_Ergodic_CSI. mq5 - the Ergodic CSI-Oscillator (based on the Candlestick Index).
Fig. 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, today's closing price) and the previous price (usually yesterday's 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, let's extend the definition of the candlestick momentum :
The Candlestick Momentum can reflect the price change for any time period of the price chart;
Fig. 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; price2[q-1] - price[opening] 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 - price[opening] at the beginning of period q; cmtm(price1,price2,q)=price1-price2[q-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.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 - price[opening] at the beginning of period q; cmtm(price1,pric2,q)=price1-pric2[q-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 : Blau_CMI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. 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 - price[opening] at the beginning of period q; cmtm(price1,pric2,q)=price1-price2[q-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 : Blau_CSI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. 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:
Ergodic_CMI() - 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 (>1) of the EMA ergodic.
Ergodic_CMI(price1,pric2,q, r,s, u,ul) - ergodic CMI-oscillator. Specification.
File name : Blau_Ergodic_CMI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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, let's consider the Ergodic_CMI (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:
Ergodic_CSI() - 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 (>1) of the EMA ergodic.
4.3.2.1. Ergodic_CSI(price1,pric2,q, r,s, u,ul) - ergodic CSI-oscillator. Specification.
File name : Blau_Ergodic_CSI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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 Ergodic_CSI (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):
Blau_HLM. mq5 - is an indicator of the Virtual Close (q-period Composite High-Low Momentum; the smoothed q-period Composite High-Low Momentum); Blau_DTI. mq5 - the Directional Trend Index (normalized smoothed q-period Composite High-Low Momentum); Blau_Ergodic_DTI. mq5 - the Ergodic DTI-oscillator (based on the Directional Trend Index).
Fig. 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; High[q–1] - 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; Low[q-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.
The curve of the graph of the accumulated sum of complex momentums for the maximums and minimums is called a virtual close .
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:
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 : Blau_DTI. 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 : q>0; r>0, s>0, u>0. 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.
Ergodic_DTI() - 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 (>1) of the EMA ergodic. 5.3.2. Ergodic_DTI(q, r,s, u,ul) - Ergodic DTI-oscillator. Specification File name : Blau_Ergodic_DTI. 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, the EMA smoothing is not used; ul>0. 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 Ergodic_DTI (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|:
Conclusão.
The first part of the article "William Blau's 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 Blau's Indicators and Trading Systems in MQL5. Part 2: Trading Systems ".
The contents of the attachment archive of this article ("Blau_Indicators_MQL5_en. zip"):
Traduzido do russo pela MetaQuotes Software Corp.
Puxe pedidos 0.
Participe do GitHub hoje.
O GitHub é o lar de mais de 20 milhões de desenvolvedores que trabalham juntos para hospedar e rever o código, gerenciar projetos e criar software juntos.
Clone com HTTPS.
Use o Git ou o check-out com o SVN usando o URL da web.
A Ergodicity é uma plataforma de negociação automatizada baseada em atores de código aberto, fornecendo ferramentas para negociação orientada para a estratégia com o uso de dados de mercado de Nível 1 e Nível 2. A Ergodicity suporta a conectividade direta de dados de mercado com a Bolsa de Valores do "Russian Trading System" usando seu protocolo proprietário Plaza2 para execução em tempo real de baixa latência. Além disso, fornece mecanismo tick-by-tick backtest para executar as mesmas estratégias em dados históricos armazenados no MarketDb para análise de desempenho e otimização.
A Platfrom usa Scala como idioma primário e depende da arquitetura baseada em eventos usando Akka Actors para concorrência e escalabilidade.
O projeto MarketDb também é parte da plataforma de Ergodicity e usado para captura e captura de dados de mercado.
backtest - estratégias de captura de quadros de backtesting - captura de dados de mercado usando conectividade de mercado direto com RTS CGate API cgate - abstração baseada em ator em CGate núcleo - componentes principais da plataforma: pedido, OrderBook, Trade, Session etc. engine - esquema de mecanismo de execução de estratégia - projeto compartilhado para backtest e `capture 'com esquema de banco de dados.
A ergodicidade é construída usando a arquitetura conduzida por eventos. Todos os dados de mercado recebidos da Bolsa de Valores (comércio, adicionar ordem, cancelar pedido, atualizações de sessão, etc.) considerados como um evento. Componentes principais de uma plataforma apresentada como Atores: sessão de negociação, cada ação atribuída para sessão, cada ordem, etc. A Akka como espinha dorsal para a plataforma permite aproveitar esta abordagem e construir plataforma com tolerância a falhas e alta escalabilidade em sua natureza .
Para compilar projetos de Ergodicity, é necessário instalar a biblioteca CGate. Windows e Linux estão disponíveis no servidor RTS. Após a instalação, você deve adicionar o diretório $ CGATE_HOME / p2bin na variável $ Path para fornecer acesso à ferramenta de geração de código.
Consulte o projeto / SchemeTools. scala para obter detalhes.
&cópia de; 2018 GitHub, Inc. Termos Privacidade Segurança Status Ajuda.
Você não pode executar essa ação neste momento.
Você fez login com outra guia ou janela. Recarregue para atualizar sua sessão. Você se separou em outra guia ou janela. Recarregue para atualizar sua sessão.
Indicador ERGODIC NinjaTrader.
Experimente este indicador ERGODIC NinjaTrader na sua plataforma NT. Isso também pode ser conhecido como indicador ERGODIC. Olhe para o nosso artigo do tutorial sobre a instalação de indicadores NinjaTrader se você não tiver certeza de como adicionar este ERGODIC em sua plataforma NT.
Procure mais indicadores Forex NinjaTrader por nome.
Apenas baixado por outro visitante: indicador MACD BB LINES.
Alguns outros indicadores populares do Metatrader para instalar.
Aqui estão alguns dos indicadores NinjaTrader mais utilizados que caracterizamos em nosso site. Você encontrará várias versões modificadas destes no índice principal de download A a Z acima.
Ou volte ao nosso índice principal para ver todos os nossos indicadores NinjaTrader gratuitos.
Indicadores e sistemas de negociação de William Blau no MQL5. Parte 1: Indicadores.
O comércio técnico só pode ser explorado se houver boas ferramentas disponíveis.
As ferramentas de um bom comerciante são experiência, julgamento e uma hierarquia matemática fornecida pelo bom programa de computador de negociação.
Introdução.
A primeira parte do artigo "Indicadores e Sistemas Comerciais no MQL5 de William Blau. Parte 1: Indicadores" é uma descrição de indicadores e osciladores, descrito por William Blau no livro "Momentum, Direction e Divergence".
Os indicadores e osciladores, descritos neste artigo, são apresentados como códigos fonte em linguagem MQL5 e anexados no arquivo "Blau_Indicators_MQL5_en. zip".
A idéia-chave da análise de William Blau.
A análise técnica de William Blau consiste em quatro fases:
Usando os dados da série de preços (q barras), o indicador é calculado e plotado no gráfico. O indicador não reflete a tendência geral do movimento dos preços, e não permite determinar os pontos de reversão da tendência. O indicador é suavizado várias vezes usando o método EMA: a primeira vez (com o período r), a segunda vez (com o período s) e a terceira vez (com o período u); um indicador suavizado é plotado. Um indicador suavizado com bastante precisão e reproduz as flutuações de preços com um atraso mínimo. Ele permite determinar a tendência do movimento do preço e os pontos de reversão e elimina o ruído do preço. O indicador suavizado é normalizado, um indicador suavizado normalizado é plotado. A normalização permite que o valor do indicador seja interpretado como os estados de sobrecompra ou sobrevenda do mercado. Um indicador suavizado normalizado é alisado uma vez pelo método EMA (período ul); um oscilador é construído - o histograma do indicador e a linha de sinal, os níveis de sobrecompra e sobrevenda do mercado são adicionados. O Oscilador nos permite distinguir os estados de sobrecompra / sobrevenda do mercado, os pontos revertais e o fim de uma tendência.
Indicadores.
O artigo descreve os seguintes grupos de indicadores:
Indicadores, com base no Momentum:
Para cada grupo de indicadores, são apresentados os seguintes:
Índice de indicadores suavizados; O índice do indicador suavizado normalizado; O oscilador, com base no índice do índice de alisamento normalizado.
Uma análise detalhada da abordagem de William Blau no aspecto da análise técnica da tabela de preços; Uma descrição detalhada do algoritmo e código de cada indicador dos grupos de indicadores baseados em Momentum.
Como um método de suavização, William Blau usa as médias móveis suavizadas exponencialmente (EMA). A Média Móvel Exponencial é calculada adicionando ao valor anterior da Média Móvel, uma certa porcentagem do preço atual.
Ao usar o EMA, os últimos preços têm um peso maior.
A função de cálculo da EMA:
EMA (k, n) - média móvel suavizada exponencialmente do período n para o momento do período k; preço (k) - o preço no momento do período k.
A descrição dos quatro tipos de médias móveis e os métodos de seu uso na análise técnica (veja também iMA) podem ser encontradas na "MetaTrader 5 Help" ("Analytics / Indicadores Técnicos / Indicadores de Tendências / Média Mover").
A Biblioteca de Funções.
A biblioteca de funções para calcular as médias móveis está localizada nas "Moedas em Movimento. mqh". Estamos preocupados com o ExponentialMAOnBuffer (), que preenche o buffer de matriz de saída [] com valores EMA do preço da matriz de entrada []. No entanto, a implementação do ExponentialMAOnBuffer () apresentado no "MovingAmedes. mqh" tem a desvantagem de que não funciona com o período n = 1.
Veja no código-fonte:
No entanto, William Blau em seu livro usa o período de suavização n = 1 como a ausência de suavização.
Portanto, o código da função ExponentialMAOnBuffer () sofreu algumas alterações:
e obtemos o ExponentialMAOnBufferWB (). O código desta função está localizado no arquivo "WilliamBlau. mqh".
O arquivo "WilliamBlau. mqh" também possui as seguintes funções:
A função PriceName () retorna o tipo de preço como uma seqüência de caracteres: a função CalculatePriceBuffer () calcula a matriz de preços desse tipo de preço:
O tipo de preço aplicado eo prazo do gráfico de preços.
William Blau considera os preços de fechamento do prazo diário. Os indicadores, desenvolvidos neste artigo, permitem que você escolha o tipo de preço (veja as constantes de preços), o cronograma do gráfico de preços depende do prazo do indicador (veja os prazos do gráfico).
1. The True Strength Index.
Os indicadores considerados (ver anexo):
Blau_Mtm. mq5 - Indicador da taxa (Momentum do período de q, Momento do período q suavizado); Blau_TSI. mq5 - Índice de pontos fortes verdadeiros (Momentum do período q suavizado normalizado); Blau_Ergodic. mq5 - Oscilador Ergódico (baseado no índice True Strength).
A descrição do indicador técnico incorporado Momentum e seu uso está em análise técnica podem ser encontradas na seção "Ajuda do MetaTrader 5", "Analítica / Indicadores Técnicos / Osciladores / Momento" (veja também iMomentum). Em contraste com o Momentum padrão (iMomentum), o Momentum de William Blau calcula o Momentum como a mudança de preço absoluto.
Um exemplo do MQL5-implementação do True Strength Indicator (ETI) por William Blau é apresentado no artigo "MQL5: Criar seu próprio indicador".
1.1.1. Análise técnica usando o indicador Momentum.
O objetivo da análise técnica é o gráfico de preços do instrumento financeiro. Cada elemento do gráfico é uma barra de preços. A barra de preços tem as seguintes características: horário de abertura, preço de abertura, preço máximo, preço mínimo, preço de fechamento, volumes de negociação e outros. A barra de preços é formada e reflete o comportamento dos preços durante um período de tempo discreto específico (cronograma do gráfico).
A tarefa da análise técnica do gráfico de preços é determinar a tendência atual do movimento de preços, revelar os picos de preços e os fundos e prever a direção da mudança de preço no próximo período de tempo. A complexidade disso é que o preço, ao se mover dentro dos limites de sua tendência básica, faz flutuações multidirecionais criando um chamado ruído de preço.
O que William Blau propôs. A primeira diferença: o Momentum. William Blau calculou o Momentum como um parente da mudança de preço [fechando] por cada período de [dia]; e criou o indicador Momentum. Do ponto de vista matemático, a função Momentum é a primeira derivada do preço.
Fig. 1.1. Indicador Momentum (Momentum do período de q)
O Momentum exibe flutuações de um período do período de preços, que mostra a velocidade (magnitude) e a direção das mudanças de preços ao longo desse período, mas não reflete a tendência geral do movimento dos preços e não determina os pontos de reversão da tendência.
A segunda diferença é o alisamento. A média móvel do Momentum (a soma acumulada das flutuações diárias dos preços) reproduz quase exatamente ambas as variações principais e locais dos preços das curvas. A Fig. 1.2 (a) nas sub-janelas I, II apresentam o Momento de suavização (médias móveis com períodos 20 e 300, respectivamente).
Quanto maior for o período da Média Móvel, mais precisamente, o Momento estimulado aproxima (reproduz) as flutuações da curva de preços. Do ponto de vista matemático, a função de alisar o Momentum é a função integral do impulso ou a função restaurada do preço.
Fig. 1.2 (a). Indicador de Momento (Momento de Momento Liso)
Fig. 1.2 (b). Indicador de Momento (Momento de Momento Liso)
Na Fig. 1.2 (a), na janela principal, são apresentados os indicadores EMA-suavizados (com períodos de 5, 20, 100). Um ligeiro aumento no período da média móvel leva a um atraso e a média móvel praticamente se torna incapaz de reproduzir as flutuações da curva de preços.
A terceira diferença é a reabilitação. O primeiro alisamento do Momentum define a principal tendência do movimento do preço, bem como os pontos de reversão, mas não elimina o ruído. Para eliminar o ruído de preço é necessário um re-alisamento com um pequeno período da média móvel.
Fig. 1.2 (b), na sub-janela, eu apresento o indicador de Momento suavizado (média móvel com o período 20), as subventas II e III apresentam o Momentum duplo e triplo-suavizado (períodos de média móvel de 5, 3) . Um alisamento repetido elimina o ruído do preço, mas adiciona uma ligeira mudança da curva (um atraso).
A quarta diferença: a diferença em um sinal de mudanças nas tendências. O alisamento de Momentum com um pequeno período de média pode levar a uma divergência do Momentum suavizado com a tendência da curva de preços.
Na Fig. 1.2 (a), a discrepância é observada na sub-janela I e na Fig. 1.2 (b) - nas sub-janelas I, II, III (a direção das mudanças de preços diverge da direção da mudança na Momento de suavização). Tais diferenças geralmente indicam uma mudança de tendência. Do ponto de vista matemático, a divergência é uma função do período de suavização.
A confiabilidade da interpretação dessas diferenças como um sinal de evolução das tendências pode ser melhorada se considerarmos a divergência somente para as áreas de sobrecompra ou sobrevenda (ver п. 1.2.1).
1.1.2. Definição do Momentum.
O Momentum é uma mudança de preço relativa.
O sinal do Momentum mostra a direção da mudança de preço: um Momento positivo - o preço aumentou ao longo do período, um negativo - o preço diminuiu ao longo do período. A magnitude do Momentum - é a velocidade relativa da mudança de preço (primeira derivada do preço).
Fig. 1.3. Definição do Momentum.
Fórmula do Momentum:
preço - preço [encerramento] do período atual; preço [1] - preço de [fechamento] do período anterior.
William Blau examina o impulso como a diferença do preço de [fechamento] do período atual e do preço de [fechamento] do período anterior. William Blau, no cálculo de um momento único, usa os preços de dois períodos (os períodos atual e anterior).
Introduzimos na fórmula para calcular o momento um indicador de período, q - é o número de períodos de tempo envolvidos no cálculo (Por William Blau q = 2).
Fórmula de Momento de Momento Q:
q - número de barras, usado no cálculo do momentum; preço - preço [encerramento] do período atual; preço [q-1] - preço de [encerramento] (q-1) há períodos.
Na fórmula resultante, nosso Momentum de dois períodos corresponde a um Momento de um período relativo de William Blau.
Fórmula de um período suavizado de q Momentum:
preço - preço de [fechamento] - a base de preços do gráfico de preços; q - número de barras, usado no cálculo do Momentum; mtm (preço, q) = preço-preço [q-1] - Momento de período de q; EMA (mtm (preço, q), r) - o primeiro alisamento - o EMA (r), aplicado ao Momentum do período Q; EMA (EMA (.r), s) - o segundo alisamento - o EMA (s), aplicado ao resultado do 1º alisamento; EMA (EMA (EMA (.r), s), u) - o terceiro suavização - o EMA (u), aplicado ao resultado do segundo alisamento.
1.1.3. Mtm (preço, q, r, s, u) - indicador de taxa (momentum). Especificação Nome do arquivo: Blau_Mtm. mq5 O nome: Momentum (Momentum do período de q, Momento de um período de liso) de William Blau. Parâmetros de entrada: q - o período para o qual o Momentum é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; mudanças na renderização do gráfico gráfico - a cor, a espessura, o estilo da linha (a guia "Cores"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s ou u for igual a 1, o alisamento EMA não é usado. Por exemplo, se você definir o Mtm (preço, 2,20,5,1), obtemos um impulso de alívio duplo, mas se você definir o Mtm (preço, 2,1,1,1), obtemos um impulso não duradouro; o tamanho mínimo da tabela de preços = (q-1 + r + s + u-3 +1).
1.2. O índice True Strengths.
1.2.1. Análise técnica usando o índice True Strength.
Continuação: veja o início na Seção 1.1.1.
O quinto: a normalização. Trazendo a normalização dos valores do Momentum suavizado para uma única escala (mapeamento para o intervalo [-1, +1]), nos permite determinar os estados de sobrecompra ou sobrevenda do mercado. A multiplicação repetida dos valores do momento estimulado normalizado é um fator de 100 que converte a série numérica na faixa de porcentagem (mapeamento para o intervalo [-100, 100]).
Fig. 1.4. Momento de suavização normalizado.
Uma discrepância como sinal de mudança de tendências pode ser considerada confiável se o impulso alisado normalizado estiver no estado de um sobrecompra ou sobrevenda.
1.2.2. A definição do índice True Strength.
O Índice de Força Verdadeira (Índice de Força Verdadeira, TSI) - é um indicador do Momentum normalizado (Momentum do período q normalizado). Trazendo os valores do Momentum suavizado para uma única escala (mapeamento para o intervalo [-1, +1]) é fornecido com a normalização de cada valor do Momentum suavizado (a soma cumulativa das flutuações de preços suavizadas do período q ) pelo valor do Momentum suavizado, obtido em valor absoluto.
A multiplicação por um coeficiente de 100 altera o intervalo da exibição para [-100, +100] (porcentagem). A normalização permite a interpretação do valor da ETI como um nível de mercado de sobrecompra (positivo) ou sobrevendido (negativo).
A fórmula do índice True Strength:
preço - preço de [fechamento] - a base de preços do gráfico de preços; q - período do Momentum; mtm (preço, q) = preço-preço [q-1] - período de q-período; | Mtm (preço, q) | - o valor absoluto do Momento de Momento Q; Mtm (preço, q, r, s, u) - Momento de três vezes suavizado; EMA (.r) - o primeiro suavização - o EMA do período r, aplicado a:
1) Momento de período de q;
2) valor absoluto do Momentum do período Q; EMA (EMA (.r), s) - o segundo alisamento - o EMA (s), aplicado ao resultado do 1º alisamento; EMA (EMA (EMA (.r), s), u) - o terceiro suavização - EMA (u), aplicado ao resultado do segundo alisamento.
1.2.3. TSI (preço, q, r, s, u) - Índice True Strength. Especificação Nome do arquivo: Blau_TSI. mq5 O nome: The True Strength Index (Momentum relativo do período Q liso normalizado) de William Blau. Parâmetros de entrada: q - o período para o qual o momento é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; alterar o estilo de renderização do gráfico - a cor, a espessura, o estilo da linha (a aba "Cores"); (opcional) dois níveis (o padrão é -25 e +25) - adicionar / remover um nível; alterar o valor, a descrição do nível, alterar o estilo de renderização dos níveis (a guia "Níveis"); altere os limites inferior (por padrão -100) e superior (por padrão, 100) da escala da janela do indicador único (a guia "Escala"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s ou u for igual a 1, então no período EMA correspondente, o alisamento não será executado; o tamanho mínimo da tabela de preços = (q-1 + r + s + u-3 +1).
1.3. Oscilador ergódico.
1.3.1. Análise técnica usando o Oscilador Ergódico.
Continuação: veja o início nas Seções. 1.1.1, 1.2.1.
Sexto: as áreas de um mercado de sobrecompra e sobrevenda. O intervalo da unidade [-1, +1] ou um intervalo de porcentagem [-100.100], dentro do qual as mudanças ocorrem nos valores do impulso alisado normalizado, permite que você defina o mercado de sobrecompração ou sobreposição das áreas.
A classe de índices de análise técnica, que caracteriza o estado do mercado de sobrecompra ou sobrevenda, é chamado de oscilador. Para cada oscilador, os níveis são determinados, na abordagem a que, os sinais de um mercado de sobrecompra ou sobrevenda são recebidos. Osciladores são ineficazes nos mercados de tendências, já que o mercado pode estar em condições de sobrecompra / sobrevenda por um período arbitrariamente longo.
Sétimo: a linha de sinal. Para obter um sinal sobre o final de uma tendência e uma tendência de reversão de um movimento de preço, uma linha de sinal é usada. O sinal de compra é recebido quando a linha principal cruza a linha de sinal de baixo para cima. O sinal de venda é recebido quando a linha principal cruza a linha de sinal de cima para baixo. No caso de uma linha principal - isto é um ergódico (índice de força verdadeira), então um re-alisamento do ergódico forma uma linha de sinal. O procedimento de re-suavização é igual ao último processo de suavização ergódica.
Oitava: a tendência do movimento dos preços. A tendência do movimento do preço é ascendente (tendência ascendente), quando a linha principal (ergódica) passa acima da linha de sinal. A tendência do movimento do preço é descendente (tendência descendente), quando a linha principal (ergódica) passa sob a linha de sinal.
Fig. 1.5. Oscilador Ergódico.
1.3.2. Definição do Oscilador Ergódico.
Ergodic () - ergodic - TSI do Índice de Força Verdadeira (price, q, r, s, u); O SignalLine () - uma linha de sinal - o EMA (ul), aplicado ao ergódico; ul - um período EMA de uma linha de sinal - de acordo com William Blau, o valor ul deve ser igual ao período da última significativa (& gt; 1) do EMA ergódico. Por exemplo, se você estiver usando um Ergodic de suavização dupla (preço, q, r, s, u) = Ergódico (preço, 2,20,5,1), então por William Blau ul = s = 5.
1.3.3. Ergódico (preço, q, r, s, u, ul) - oscilador ergódico. Especificação Nome do arquivo: Blau_Ergodic. mq5 Nome: Ergodic Oscillator (baseado em um índice de força verdadeira) de William Blau. Parâmetros de entrada: gráfico gráfico # 0 - Ergódico (um índice de força verdadeira): q - o período para o qual o momento é calculado (padrão q = 2); R - period do 1-st EMA, aplicado ao Momentum (padrão r = 20); s - período da 2ª EMA, aplicado ao resultado do 1º alisamento (por padrão s = 5); u - período da 3ª EMA, aplicado ao resultado do segundo alisamento (por padrão, u = 3); gráfico gráfico # 1 - a linha de sinal: linha de sinal EMA de ul-período, é aplicada ao ergódico (por padrão ul = 3); AppliedPrice - tipo de preço (predefinição AppliedPrice = PRICE_CLOSE). Além disso: exibido em uma janela separada; alterar o estilo de renderização de cada gráfico - a cor, a espessura, o estilo da linha (a guia "Cores"); dois níveis (por padrão, -25 e +25) - adicionar / remover um nível, alterar o valor, a descrição do nível, alterar o estilo de renderização dos níveis (a guia "Níveis"); altere os limites inferior (por padrão -100) e superior (por padrão, 100) da escala da janela de indicador único (a guia "Escala"). Limitações: q & gt; 0; r & gt; 0, s & gt; 0, u & gt; 0. Se r, s, ou você é igual a 1, o alisamento EMA não é usado; ul & gt; 0. Se ul = 1, a linha de sinal e as linhas de Ergódico são as mesmas; o tamanho mínimo da tabela de preços = (q-1 + r + s + u + ul-4 +1).
1.4. O Código (descrição detalhada)
1.4.1. "Blau_Mtm. mq5" - indicador Mtm (preço, q, r, s, u) - momentum.
O código do indicador Mtm (preço, q, r, s, u):
Vamos considerar o código em detalhes.
1.4.1.1. Configurações do indicador Mtm (preço, q, r, s, u)
Literatura.
O que ler sobre as configurações do indicador na Referência MQL5:
Direito autoral. Descrição do indicador.
Configurações somente através da diretiva #property preprocessor. O сopyright (parâmetros de direitos autorais e link), a versão (a versão do parâmetro) e uma descrição do mql5-program (descrição do parâmetro) são exibidos nas "Propriedades" da janela do indicador (a guia "Propriedades", caixa "Adicional") .
Incluir arquivo.
O préprocessador substitui o #Include & lt; WilliamBlau. mqh & gt; linha com os conteúdos do arquivo "WilliamBlau. mqh". Os suportes angulares indicam que o arquivo "WilliamBlau. mqh" será retirado da pasta de dados do terminal. Para mais informações, consulte Incluindo arquivos.
Sobre o conteúdo do arquivo "WilliamBlau. mqh", veja a introdução.
Configurações do indicador (em geral)
O indicador personalizado - são poucas parcelas gráficas. O gráfico gráfico do indicador pode ser exibido na janela principal do gráfico de preços ou em uma janela separada. Cada gráfico tem um determinado método de desenho, cor, estilo e espessura.
Os dados para a renderização do gráfico são tirados dos buffers de indicadores (cada gráfico corresponde a um ou cinco buffers de indicadores). Usamos uma matriz de indicadores como um buffer de indicadores.
Para configurar o indicador, é necessário (veja a Fig. 1.6):
Especifique a janela para exibir os indicadores. Especifique o número de gráficos gráficos. Especifique o número de buffers de indicadores. Declaração dos arrays dos indicadores. Configure um link: matriz de indicadores - & gt; buffer indicador - & gt; gráfico gráfico. Descreva as propriedades de cada gráfico gráfico. Especifique a precisão da exibição dos valores dos indicadores. Especifique para cada construção gráfica, o número de barras iniciais sem a renderização do gráfico. Configure os níveis horizontais e descreva as propriedades de cada nível horizontal (não presente.) Defina as restrições da escala para a janela do indicador separado (não está presente). Especifique o nome curto do indicador.
Fig. 1.6. Indicador Momentum Mtm (preço, q, r, s, u)
As configurações do indicador são realizadas:
a) quer através da diretiva de préprocessador #property,
A diferença nos métodos de configuração do indicador é que as configurações através da diretiva #property estão disponíveis antes que o indicador seja anexado ao gráfico de preços, enquanto as configurações através de funções especiais estão disponíveis depois que o indicador é anexado ao gráfico de preços. A configuração das configurações é realizada a partir da janela "Propriedades" do indicador.
As configurações: uma janela para exibir o indicador (1)
A configuração é obrigatória e só é possível através da diretiva de préprocessador #property. Existem duas opções de exibição de indicadores:
Na janela principal do gráfico de preços - indicator_chart_window; Em uma janela separada - indicator_separate_window.
Configurações: o número de buffers (3) e gráficos (2)
A configuração é obrigatória e é possível somente através da diretiva #property preprocessor. O número de buffers de indicadores (parameter indicator_buffers) e o número de gráficos (parameter_plots) não estão limitados.
Configurações: matrizes de indicadores (4)
Os arrays de indicadores são declarados a nível global como matrizes dinâmicas unidimensionais de tipo duplo.
Configurações: Configurando o link (5) entre as matrizes de indicadores, buffers de indicadores e gráficos gráficos.
O código está escrito na função OnInit () do manipulador de eventos Init ().
O link do buffer de indicadores com a matriz unidimensional correspondente é configurado com a função SetIndexBuffer ():
O buffer do indicador é uma matriz dinâmica unidimensional de tipo duplo, cujo tamanho é controlado pelo terminal do cliente, de modo que ele sempre corresponde ao número de barras nas quais o indicador é calculado. A indexação dos buffers indicadores começa a partir de 0.
Um buffer de indicadores pode armazenar três tipos de dados: INDICATOR_DATA, INDICATOR_COLOR_INDEX, INDICATOR_CALCULATIONS. Cada gráfico gráfico, de acordo com o método de exibição, pode ser correspondido por um a cinco buffers de indicadores: um a quatro valores de buffer de indicadores (tipo de dados INDICATOR_DATA) e um buffer de cor (tipo de dados INDICATOR_COLOR_INDEX).
Os buffers de indicadores com os dados do tipo INDICATOR_CALCULATIONS são projetados para cálculos intermediários. Após a ligação, a matriz de indicadores terá indexação, assim como nas matrizes convencionais (ver abaixo na Seção 1.4.1.2).
Configurações: Propriedades de gráficos gráficos (6)
Para a configuração de cada conjunto de gráficos, as seguintes coisas são especificadas:
Existem duas formas possíveis de configurar:
1) Através da directiva #property preprocessor (implementada desta forma):
O código está escrito na função OnInit () do manipulador de eventos Init. Especificação da função PlotIndexSet * ():
Para refinar a exibição do tipo selecionado de gráfico, usamos as IDs de propriedade do gráfico gráfico, listados na enumeração ENUM_PLOT_PROPERTY.
A indexação das parcelas gráficas começa a partir de 0. Com relação à preferência de configuração através de uma diretiva #property, veja acima na seção "Preferências de indicadores". Algumas propriedades dos gráficos (a cor, o estilo, a largura da linha) estão disponíveis para troca da janela "Propriedades" (a guia "Cores") do indicador.
Configurações: a precisão da exibição dos valores dos indicadores (7)
O código está escrito na função OnInit () do manipulador de eventos Init. A especificação da função da configuração das configurações do indicador IndicatorSet * ():
Os identificadores das propriedades dos indicadores estão listados na enumeração ENUM_CUSTOMIND_PROPERTY.
A precisão da exibição dos valores do indicador é dada apenas pela função IndicatorSetInteger (), a identificação das propriedades do indicador INDICATOR_DIGITS, ENUM_CUSTOMIND_PROPERTY_INTEGER enumeração.
In an example where the values of the indicator buffers, which are intended to render, under display: next to the short name of the indicator, in a pop-up message, when the mouse pointer is placed over the indicator line - will be rounded up to _Digits - number of digits after the decimal point in the price of the instrument, to which the indicator is attached.
Settings: Number of initial bars without rendering (8)
The data for rendering the q-period Momentum of William Blau is formed in four steps:
Step 1. On the basis of the data from the PriceBuffer[] prices array, the Momentum (the period q) is calculated. The values of the q-period Momentum are placed into the MtmBuffer[] array. Since the indexation of the prices array starts from 0, the significant data in the prices array also start at index 0, then the significant data in the MtmBuffer[] array start with the index (q-1).
Step 2. Significant data in the MtmBuffer[] array is smoothed (smoothing period r). The values of the smoothed q-period Momentum are placed in the EMA_MtmBuffer[] array. Since the indexation of the MtmBuffer[] array starts from 0, the significant data in the MtmBuffer[] array starts with the index (q-1), then the significant data in the EMA_MtmBuffer[] array start with the index (q-1) + (r-1).
The 3rd and 4th steps. Similar considerations are given for determining from which bar starts the meaningful data in the DEMA_MtmBuffer[] array (smoothing period s) and in the MainBuffer[] array (smoothing period u). See Fig. 1.7.
Fig. 1.7. The meaningful data of the Mtm (price, q,r, s,u) indicator.
On a global level the variables are declared:
The values of the variables - is the index of the bar, from which begins the meaningful data, in the corresponding to the variable indicator array. Variable values are calculated in the function OnInit() event handler Init, and will be used in the OnCalculate() function of the Calculate event handler.
The number of initial bars without the showing at the graphic plot is specified using the PlotIndexSetInteger() function, the identifier of the indicator property PLOT_DRAW_BEGIN enumerations ENUM_PLOT_PROPERTY_INTEGER.
Configuration: The short name of the indicator (11)
The code is written in the OnInit() function of the Init event handler. The short name of the indicator is specified only by using the IndicatorSetString() function, identifier of the indicator properties INDICATOR_SHORTNAME (ENUM_CUSTOMIND_PROPERTY_STRING enumeration). The PriceName () function returns the name of the price type, depending on the value of AppliedPrice input parameter. The code of the PriceName () function is located in the file "WilliamBlau. mqh" (see Introduction).
Input parameters.
For more information see input variables. Input parameters are available for change from the "Properties" window (the "Inputs" tab) of the indicator.
1.4.1.2. The calculation of the indicator Mtm (price, q,r, s,u)
Calculation: The algorithm.
The algorithm for calculating the indicator Mtm(price, q,r, s,u):
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 - the filling of the MtmBuffer[] array. The first smoothing by the EMA method (period r) - the filling of the EMA_MtmBuffer[] array. The second smoothing by the EMA method (period s) - the filling of the DEMA_MtmBuffer[] array. The third smoothing by the EMA method (period u) - the filling of the MainBuffer[] array - the calculation of values for the rendering of the graphic plot #0.
Calculation: The function OnCalculate()
The calculation of the indicator values is performed in the OnCalculate() function of the Calculate event handler. We use the second form of OnCalculate() function call.
The rates_total argument is the number of bars of the price chart, which are rendered and are available to the indicator for processing. The prev_calculated - is the number of bars of the price chart that have been processed by the indicator at the time of the start of the current OnCalculate() function call.
The OnCalculate() function returns the number of bars of the price chart that have been processed by the indicator at the time of the end of the current call. This function returns the rates_total parameter and must be constructed in such a way, that on the very first call, all of the unprocessed bars of the price chart, would be processed.
That is, if on the first call of the OnCalculate() function, the parameter prev_calculated is equal to 0, then the on the second call, the parameter prev_calculated is either equal to rates_total or rates_total +1 , and starting from the second call, the OnCalculate() function handles (counts) only the last bar. For further clarification with an example, see here.
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 rates_total_min 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. Let's 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 PriceBuffer[i], and the price(q-1) of the previous periods PriceBuffer[i-(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 EMA_MtmBuffer[] 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. "Blau_TSI. 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 "Blau_Mtm. mq5"):
Let us consider in detail only the modifications and additions to the code "Blau_Mtm. mq5".
1.4.2.1. The configurations of the indicator TSI (price, q,r s, u) (alterations and additions to the code "Blau_Mtm. 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 -> indicator buffer -> 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 "Blau_Mtm. 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 (DRAW_LINE - line), the line color (Blue), the line style (STYLE_SOLID - 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;
Color for the display of the line; Line style (see the possible styles enumerated in ENUM_LINE_STYLE);
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 INDICATOR_LEVEL * index are used, which are listed in the ENUM_CUSTOMIND_PROPERTY enumeration.
The description of each level is set only using the IndicatorSetString() function, the identifier of the indicator property INDICATOR_LEVELTEXT (ENUM_CUSTOMIND_PROPERTY_STRING 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 INDICATOR_MINIMUM and INDICATOR_MAXIMUM (ENUM_CUSTOMIND_PROPERTY_DOUBLE 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 -> indicator buffer -> 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 -> indicator buffer -> 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 "Blau_Mtm. 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 EMA_MtmBuffer[] and EMA_AbsMtmBuffer[] arrays. The second smoothing by the EMA method (period s) - the filling of DEMA_MtmBuffer[] and DEMA_AbsMtmBuffer[] arrays. The third method smoothing by the EMA method (period u) - the filling of TEMA_MtmBuffer[] and TEMA_AbsMtmBuffer[] 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. "Blau_Ergodic. 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 "Blau_TSI. mq5":
Let us consider in detail only the modifications and additions to the code "Blau_TSI. mq5".
1.4.3.1. Configurations of the indicator Ergodic (price, q,r, s,u, ul) (alterations and additions to the code "Blau_TSI. 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 -> indicator buffer -> 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 "Blau_TSI. 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 DRAW_LINE ), now we use a histogram from the zero line ( DRAW_HISTOGRAM of the ENUM_DRAW_TYPE 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 -> indicator buffer -> 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 -> indicator buffer -> 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 "Blau_TSI. 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 EMA_MtmBuffer[] and EMA_AbsMtmBuffer[] arrays. The second smoothing by the EMA method (period s) - the filling of DEMA_MtmBuffer[] and DEMA_AbsMtmBuffer[] arrays. The third method smoothing by the EMA method (period u) - the filling of TEMA_MtmBuffer[] and TEMA_AbsMtmBuffer[] 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 rates_total_min 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:
Blau_TStoch. mq5 - Stochastic (q-period Stochastic; smoothed q-period Stochastic); Blau_TStochI. mq5 - Stochastic Index (normalized smoothed q-period Stochastic); Blau_TS_Stochastic. mq5 - Stochastic TS-oscillator (based on the index of the Stochastic).
II. Indicators, based on the Stochastic Momentum:
Blau_SM. mq5 - Stochastic Momentum (q-period Stochastic Momentum; smoothed q-period Stochastic Momentum); Blau_SMI. mq5 - Stochastic Momentum Index (normalized smoothed q-period Momentum); Blau_SM_Stochastic. mq5 - Stochastic SM-Oscillator (based on the Stochastic Momentum Index).
2.1. Indicators based on the Stochastic.
The "User's 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 Lane's 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 Blau's Stochastic Oscillator.
Fig. 2.1. William Blau's indicators, based on the Stochastic.
2.1.2.1. Estocástico.
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.
Fig. 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 : Blau_TStoch. 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : q>0; r>0, s>0, u>0. 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 : Blau_TStochI. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. 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. Oscilador estocástico.
The definition of the Stochastic Oscillator:
TS_Stochastic() - 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 (> 1) EMA fast stochastic.
TS_Stochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification.
File name : Blau_TS_Stochastic. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, the EMA smoothing is not used; ul>0. 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 Blau's Stochastic Oscillator includes the Stochastic Oscillator by George Lane. In order for the TS_Stochastic (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 Lane's Stochastic Oscillator.
2.1.2.5. The code of the Stochastic Oscillator.
On the example of the indicator TS_Stochastic (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 Blau's 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.
Fig. 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/2*[LL(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 : Blau_SM. 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : q>0; r>0, s>0, u>0. 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/2*[LL(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/2*[HH(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 : Blau_SMI. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. 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. O Oscilador Estocástico.
The definition of the Stochastic Oscillator:
SM_Stochastic() - Stochastic Momentum Index SMI(price, q,r, s,u); SignalLine() - Signal Line - EMA of period, ul, applied to the Stochastic Momentum Index;
2.2.3.1. SM_Stochastic(price, q,r, s,u, ul) - Stochastic Oscillator. Specification.
File name : Blau_SM_Stochastic. 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= PRICE_CLOSE ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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 SM_Stochastic (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.
Blau_MDI. mq5 - An indicator of an Average Deviation from the trend (mean deviation, moving average deviation); Blau_Ergodic_MDI. mq5 - Ergodic MDI oscillator (based on the mean deviation).
II. Indicators, based on the Moving Averages Convergence/Divergence.
Blau_MACD. mq5 - Moving Averages Convergence/Divergence (MACD; smoothed MACD); Blau_Ergodic_MACD. mq5 - Ergodic MACD-Oscillator (based on the MACD indicator).
3.1. Indicators, based on the deviation from the market trends.
Fig. 3.1. William Blau's 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 "User's 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 "User's 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 : Blau_MDI. 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 r=20); 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : r>1; s>0, u>0. If s or u are equal to 1, the EMA smoothing is not used; the minimum size of the prices array = (r+s+u-3+1).
3.1.2. Ergodic MDI-oscillator.
Definition of the Ergodic MDI-oscillator:
Ergodic_MDI() - 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 (>1) of the EMA ergodic.
3.1.2.2. Ergodic_MDI(price, r,s, u,ul) - Ergodic MDI-oscillator. Specification.
File name : Blau_Ergodic_MDI. 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 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 - Signal Line: ul - period EMA signal line, applied to the Ergodic (by default ul = 3); AppliedPrice - price type (default AppliedPrice= PRICE_CLOSE ). 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 : r>1; s>0, u>0. If s or u are equal to 1, the EMA smoothing is not used; ul>0. If ul = 1, then the Signal line and the Ergodic lines are the same; the minimum size of the prices array = (r+s+u+ul-4+1).
3.1.3. The code of the Ergodic oscillator.
As example, let's consider the Ergodic_MDI (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 increase|MACD| indicates the discrepancy between the moving averages, a decrease|MACD| 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 : Blau_MACD. mq5 Name : The MACD indicator (MACD;smoothed 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= PRICE_CLOSE ). Additionally : displayed in a separate window; changes of the rendering of the graphical plotting - the color, thickness, line style (the "Colors" tab). Limitations : r>1, s>1; s <r (limit by the requirements of the theory, is not checked on the program level); u>0. If u = 1, smoothing is not performed; the minimum size of the prices array = ([max(r, s)]+u-2+1).
3.2.2. Ergodic MACD-oscillator.
The definition of the Ergodic MACD-oscillator:
Ergodic_MACD () - 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 (>1) of the EMA ergodic.
The "User's 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. Ergodic_MACD(price, r,s, u,ul) - Ergodic MACD-oscillator. Specification.
File name : Blau_Ergodic_MACD. 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= PRICE_CLOSE ). 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 : r>1, s>1; s <r (limit by the requirements of the theory, is not checked on the program level); u>0. If u = 1, smoothing is not performed; ul>0. If ul = 1, then the signal line coincides with the ergodic; the minimum size of the prices array =([max(r, s)]+u+ul-3+1).
3.2.3. The code of the Ergodic MACD-Oscillator.
As example, let's consider the Ergodic_MACD (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 "User's Guide to the MetaTrader client terminal" of the "Analytics/Technical Indicators/Oscillators/MACD" section:
The MACD is also useful as an overbought/oversold indicator. When the shorter moving average pulls away dramatically from the longer moving average (i. e., the MACD rises), it is likely that the security price is overextending and will soon return to more realistic levels.
in this case, from the aspect of technical analysis.
4. Candlestick Momentum.
The considered indicators (see the attachment) are divided into two groups.
Blau_CMtm. 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): Blau_CMI. mq5 - the Candlestick Momentum Index (normalization by the absolute value of the q-period Candlestick Momentum); Blau_CSI. mq5 - the Candlestick Index (the normalized by the length q-period Candlestick); The ergodic oscillator of the candlestick Blau_Ergodic_CMI. mq5 - the Ergodic CMI-Oscillator (based on the Candlestick Momentum Index); Blau_Ergodic_CSI. mq5 - the Ergodic CSI-Oscillator (based on the Candlestick Index).
Fig. 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, today's closing price) and the previous price (usually yesterday's 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, let's extend the definition of the candlestick momentum :
The Candlestick Momentum can reflect the price change for any time period of the price chart;
Fig. 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; price2[q-1] - price[opening] 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 - price[opening] at the beginning of period q; cmtm(price1,price2,q)=price1-price2[q-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.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 - price[opening] at the beginning of period q; cmtm(price1,pric2,q)=price1-pric2[q-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 : Blau_CMI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. 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 - price[opening] at the beginning of period q; cmtm(price1,pric2,q)=price1-price2[q-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 : Blau_CSI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. 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:
Ergodic_CMI() - 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 (>1) of the EMA ergodic.
Ergodic_CMI(price1,pric2,q, r,s, u,ul) - ergodic CMI-oscillator. Specification.
File name : Blau_Ergodic_CMI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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, let's consider the Ergodic_CMI (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:
Ergodic_CSI() - 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 (>1) of the EMA ergodic.
4.3.2.1. Ergodic_CSI(price1,pric2,q, r,s, u,ul) - ergodic CSI-oscillator. Specification.
File name : Blau_Ergodic_CSI. 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= PRICE_CLOSE ); AppliedPrice2 - price type [opening] (by default AppliedPrice= PRICE_OPEN ). 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, then in the corresponding EMA period, smoothing will not be performed; ul>0. 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 Ergodic_CSI (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):
Blau_HLM. mq5 - is an indicator of the Virtual Close (q-period Composite High-Low Momentum; the smoothed q-period Composite High-Low Momentum); Blau_DTI. mq5 - the Directional Trend Index (normalized smoothed q-period Composite High-Low Momentum); Blau_Ergodic_DTI. mq5 - the Ergodic DTI-oscillator (based on the Directional Trend Index).
Fig. 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; High[q–1] - 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; Low[q-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.
The curve of the graph of the accumulated sum of complex momentums for the maximums and minimums is called a virtual close .
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:
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 : Blau_DTI. 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 : q>0; r>0, s>0, u>0. 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.
Ergodic_DTI() - 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 (>1) of the EMA ergodic. 5.3.2. Ergodic_DTI(q, r,s, u,ul) - Ergodic DTI-oscillator. Specification File name : Blau_Ergodic_DTI. 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 : q>0; r>0, s>0, u>0. If r, s, or u are equal to 1, the EMA smoothing is not used; ul>0. 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 Ergodic_DTI (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|:
Conclusão.
The first part of the article "William Blau's 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 Blau's Indicators and Trading Systems in MQL5. Part 2: Trading Systems ".
The contents of the attachment archive of this article ("Blau_Indicators_MQL5_en. zip"):
Traduzido do russo pela MetaQuotes Software Corp.
Комментариев нет:
Отправить комментарий