Excelente tutorial, Samuel! Parabéns e obrigado!!!
Excelente one.... meu pensamento sobre o candle stick também é um pensamento reto que pode fazer alguém entender um pouco sobre o termo de negociação, eu acredito que o vermelho é para vender enquanto o verde é para comprar, mas eles são iguais quando o verde sobe para comprar enquanto o vermelho desce para vender, mas no final do ponto da linha, o verde deve tomar um reverso e o vermelho deve se mover também, enquanto o amarelo está rindo do preço.
Olá Samuel,
Boa ideia, mas não consigo fazer esse trabalho. Você pode enviar esse exemplo neste artigo?
Com os melhores cumprimentos,
como criar velas de tique-taque de qualquer valor para negociação de futuros
scalp-91 #:
como criar candlesticks de ticks de qualquer valor para negociação de futuros
como criar candlesticks de ticks de qualquer valor para negociação de futuros
Creación de indicadores de tick en MQL5
- www.mql5.com
En este artículo vamos a ver la creación de dos indicadores: el indicador de tick, que representa el gráfico de tick del precio, y el indicador de vela de tick, que representa las velas con el número de ticks especificados. Cada uno de los indicadores escribe los precios de llegada en un archivo y utiliza los datos guardados tras el reinicio del indicador (estos datos pueden ser usados también por los demás programas).
Muito obrigado, muito didático.
cf23EA1l #:
Olá, Samuel,
Boa ideia, mas não consigo fazer esse trabalho. Você pode enviar esse exemplo neste artigo?
Com os melhores cumprimentos,
//+------------------------------------------------------------------+ //|Velas coloridas.mq5 | //|Copyright 2020, Samuel Manoel de Souza //| https://www.mql5.com/pt/users/samuelmnl | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Samuel Manoel de Souza" #property link "https://www.mql5.com/pt/users/samuelmnl" #property version "1.00" #property indicator_chart_window #property indicator_buffers 12 #property indicator_plots 3 //--- touro da trama #property indicator_label1 "bull" #property indicator_type1 DRAW_CANDLES #property indicator_color1 clrGreen,clrBlack,clrGreen #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- urso de plotagem #property indicator_label2 "bear" #property indicator_type2 DRAW_CANDLES #property indicator_color2 clrRed,clrBlack,clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- intervalo de plotagem #property indicator_label3 "wait" #property indicator_type3 DRAW_CANDLES #property indicator_color3 clrGold,clrBlack,clrGold #property indicator_style3 STYLE_SOLID #property indicator_width3 1 //--- buffers de indicadores double bullBuffer1[]; double bullBuffer2[]; double bullBuffer3[]; double bullBuffer4[]; double bearBuffer1[]; double bearBuffer2[]; double bearBuffer3[]; double bearBuffer4[]; double rangeBuffer1[]; double rangeBuffer2[]; double rangeBuffer3[]; double rangeBuffer4[]; input int inpShift = 0; //Mudança de indicador input int inpBlue = 10;//Blue Shift input int inpRed = 20; //Turno vermelho //+------------------------------------------------------------------+ //| Função de inicialização do indicador personalizado //+------------------------------------------------------------------+ int OnInit() { if(inpBlue <= 0) { Alert("Blue Shift must be greater then 0!"); return INIT_PARAMETERS_INCORRECT; } if(inpRed <= inpBlue) { Alert("Red Shift must be greater then Blue Shift!"); return INIT_PARAMETERS_INCORRECT; } //--- mapeamento de buffers de indicadores SetIndexBuffer(0, bullBuffer1, INDICATOR_DATA); SetIndexBuffer(1, bullBuffer2, INDICATOR_DATA); SetIndexBuffer(2, bullBuffer3, INDICATOR_DATA); SetIndexBuffer(3, bullBuffer4, INDICATOR_DATA); SetIndexBuffer(4, bearBuffer1, INDICATOR_DATA); SetIndexBuffer(5, bearBuffer2, INDICATOR_DATA); SetIndexBuffer(6, bearBuffer3, INDICATOR_DATA); SetIndexBuffer(7, bearBuffer4, INDICATOR_DATA); SetIndexBuffer(8, rangeBuffer1, INDICATOR_DATA); SetIndexBuffer(9, rangeBuffer2, INDICATOR_DATA); SetIndexBuffer(10, rangeBuffer3, INDICATOR_DATA); SetIndexBuffer(11, rangeBuffer4, INDICATOR_DATA); //---Definição do valor que torna as barras invisíveis PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0); PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0); PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, 0); //---Definição dos valores de deslocamento para cada barra PlotIndexSetInteger(0, PLOT_SHIFT, inpShift); PlotIndexSetInteger(1, PLOT_SHIFT, inpShift); PlotIndexSetInteger(2, PLOT_SHIFT, inpShift); //---Definição de onde as barras devem ser desenhadas PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, inpRed - 1); PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, inpRed - 1); PlotIndexSetInteger(2, PLOT_DRAW_BEGIN, inpRed - 1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Função de iteração de indicador personalizado| //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- //---Se não houver barras suficientes, não calcular if(rates_total < inpRed) { return rates_total; } //---Definindo a partir de onde devemos iniciar o cálculo int limit; if(prev_calculated < inpRed) limit = inpRed; else limit = prev_calculated - 1; //---Loop de cálculo principal for(int i = limit; i < rates_total; i++) { int shift = BarIndex2shift(i); double open = iOpen(_Symbol, _Period, shift); double high = iHigh(_Symbol, _Period, shift); double low = iLow(_Symbol, _Period, shift); double close = iClose(_Symbol, _Period, shift); double red = price[i - (inpRed)]; /Obtenção do valor da linha vermelha double blue = price[i - inpBlue]; /Obtenção do valor da linha azul double yellow = price[i]; /Obtenção do valor da linha amarela /Existem três sinalizadores para esse filtro //0 = vender, 1= esperar, 1 = comprar // podemos comprar se 2 linhas estiverem acima do vermelho // podemos vender se 2 linhas estiverem abaixo do vermelho int direction = 0; direction += (yellow > red) ? 1 : 0; // Se o amarelo estiver acima do vermelho, adicione 1 red = blue; blue = yellow; direction += (blue > red) ? 1 : 0; // Se o azul estiver acima do vermelho, adicione 1 . /Por padrão, as barras não são visíveis bullBuffer1[i] = 0; bullBuffer2[i] = 0; bullBuffer3[i] = 0; bullBuffer4[i] = 0; bearBuffer1[i] = 0; bearBuffer2[i] = 0; bearBuffer3[i] = 0; bearBuffer4[i] = 0; rangeBuffer1[i] = 0; rangeBuffer2[i] = 0; rangeBuffer3[i] = 0; rangeBuffer4[i] = 0; //Atribuiremos valor a cada barra de acordo com o sinalizador de direção switch(direction) { case 0: // É um mercado em baixa { bearBuffer1[i] = open; bearBuffer2[i] = high; bearBuffer3[i] = low; bearBuffer4[i] = close; break; } case 1: // É um mercado em alta { rangeBuffer1[i] = open; rangeBuffer2[i] = high; rangeBuffer3[i] = low; rangeBuffer4[i] = close; break; } case 2: // É um mercado de alcance { bullBuffer1[i] = open; bullBuffer2[i] = high; bullBuffer3[i] = low; bullBuffer4[i] = close; break; } } } //--- valor de retorno de prev_calculated para a próxima chamada return(rates_total); } int BarIndex2shift(int bar) {return Bars(_Symbol, _Period) - bar - 1;} //+------------------------------------------------------------------+
//+------------------------------------------------------------------+ //| Color Candles.mq5 | //| Copyright 2020, Samuel Manoel de Souza | //| https://www.mql5.com/pt/users/samuelmnl | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Samuel Manoel de Souza" #property link "https://www.mql5.com/pt/users/samuelmnl" #property version "1.00" #property indicator_chart_window #property indicator_buffers 12 #property indicator_plots 3 //--- plot bull #property indicator_label1 "bull" #property indicator_type1 DRAW_CANDLES #property indicator_color1 clrGreen,clrBlack,clrGreen #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot bear #property indicator_label2 "bear" #property indicator_type2 DRAW_CANDLES #property indicator_color2 clrRed,clrBlack,clrRed #property indicator_style2 STYLE_SOLID #property indicator_width2 1 //--- plot range #property indicator_label3 "wait" #property indicator_type3 DRAW_CANDLES #property indicator_color3 clrGold,clrBlack,clrGold #property indicator_style3 STYLE_SOLID #property indicator_width3 1 //--- indicator buffers double bullBuffer1[]; double bullBuffer2[]; double bullBuffer3[]; double bullBuffer4[]; double bearBuffer1[]; double bearBuffer2[]; double bearBuffer3[]; double bearBuffer4[]; double rangeBuffer1[]; double rangeBuffer2[]; double rangeBuffer3[]; double rangeBuffer4[]; input int inpShift = 0; //Indicator Shift input int inpBlue = 10;//Blue Shift input int inpRed = 20; //Red Shift //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { if(inpBlue <= 0) { Alert("Blue Shift must be greater then 0!"); return INIT_PARAMETERS_INCORRECT; } if(inpRed <= inpBlue) { Alert("Red Shift must be greater then Blue Shift!"); return INIT_PARAMETERS_INCORRECT; } //--- indicator buffers mapping SetIndexBuffer(0, bullBuffer1, INDICATOR_DATA); SetIndexBuffer(1, bullBuffer2, INDICATOR_DATA); SetIndexBuffer(2, bullBuffer3, INDICATOR_DATA); SetIndexBuffer(3, bullBuffer4, INDICATOR_DATA); SetIndexBuffer(4, bearBuffer1, INDICATOR_DATA); SetIndexBuffer(5, bearBuffer2, INDICATOR_DATA); SetIndexBuffer(6, bearBuffer3, INDICATOR_DATA); SetIndexBuffer(7, bearBuffer4, INDICATOR_DATA); SetIndexBuffer(8, rangeBuffer1, INDICATOR_DATA); SetIndexBuffer(9, rangeBuffer2, INDICATOR_DATA); SetIndexBuffer(10, rangeBuffer3, INDICATOR_DATA); SetIndexBuffer(11, rangeBuffer4, INDICATOR_DATA); //---Setting which value make the bars invisible PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, 0); PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, 0); PlotIndexSetDouble(2, PLOT_EMPTY_VALUE, 0); //---Setting the shift values for each bar PlotIndexSetInteger(0, PLOT_SHIFT, inpShift); PlotIndexSetInteger(1, PLOT_SHIFT, inpShift); PlotIndexSetInteger(2, PLOT_SHIFT, inpShift); //---Setting from where the bars must be drawed PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, inpRed - 1); PlotIndexSetInteger(1, PLOT_DRAW_BEGIN, inpRed - 1); PlotIndexSetInteger(2, PLOT_DRAW_BEGIN, inpRed - 1); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- //---If there is no sufficient bars, don't calculate if(rates_total < inpRed) { return rates_total; } //---Defining from where we should start the calculation int limit; if(prev_calculated < inpRed) limit = inpRed; else limit = prev_calculated - 1; //---Main calculation loop for(int i = limit; i < rates_total; i++) { int shift = BarIndex2shift(i); double open = iOpen(_Symbol, _Period, shift); double high = iHigh(_Symbol, _Period, shift); double low = iLow(_Symbol, _Period, shift); double close = iClose(_Symbol, _Period, shift); double red = price[i - (inpRed)]; //Getting the Red line value double blue = price[i - inpBlue]; //Getting the Blue line value double yellow = price[i]; //Getting the Yellow line value //There are three flags for this filter //0 = sell, 1= wait, 1 = buy // we can buy if 2 lines is above the red // we can sell if 2 lines is below the red int direction = 0; direction += (yellow > red) ? 1 : 0; // If Yellow is above Red, add 1 red = blue; blue = yellow; direction += (blue > red) ? 1 : 0; // If Blue is above Red, add 1 . //For default bars isn't visible bullBuffer1[i] = 0; bullBuffer2[i] = 0; bullBuffer3[i] = 0; bullBuffer4[i] = 0; bearBuffer1[i] = 0; bearBuffer2[i] = 0; bearBuffer3[i] = 0; bearBuffer4[i] = 0; rangeBuffer1[i] = 0; rangeBuffer2[i] = 0; rangeBuffer3[i] = 0; rangeBuffer4[i] = 0; //We'll assign value to each bar according with the direction flag switch(direction) { case 0: // Is bear market { bearBuffer1[i] = open; bearBuffer2[i] = high; bearBuffer3[i] = low; bearBuffer4[i] = close; break; } case 1: // Is bull market { rangeBuffer1[i] = open; rangeBuffer2[i] = high; rangeBuffer3[i] = low; rangeBuffer4[i] = close; break; } case 2: // Is range market { bullBuffer1[i] = open; bullBuffer2[i] = high; bullBuffer3[i] = low; bullBuffer4[i] = close; break; } } } //--- return value of prev_calculated for next call return(rates_total); } int BarIndex2shift(int bar) {return Bars(_Symbol, _Period) - bar - 1;} //+------------------------------------------------------------------+
Minha pergunta é: você escreveu algum artigo que explique como chamar esse indicador em um EA para usá-lo para fazer negociações automáticas, bem como um testador de estratégia com visualização?
Você está perdendo oportunidades de negociação:
- Aplicativos de negociação gratuitos
- 8 000+ sinais para cópia
- Notícias econômicas para análise dos mercados financeiros
Registro
Login
Você concorda com a política do site e com os termos de uso
Se você não tem uma conta, por favor registre-se
Novo artigo Explorando as possibilidades de criar gráficos de velas multicoloridas foi publicado:
Neste artigo, veremos as possibilidades de criação de indicadores de velas personalizados, e falaremos sobre suas vantagens e desvantagens.
Neste artigo, veremos as possibilidades de criação de gráficos de velas personalizados, e falaremos sobre suas vantagens e desvantagens. Adicionalmente, consideraremos quatro alternativas para esse tipo de indicadores:
Assim, alcançamos o objetivo deste artigo, que era o de demonstrar como criar regras de coloração com base em certas condições de negociação escolhidas para criar um gráfico de velas personalizado. O resultado do trabalho feito é mostrado na figura abaixo:
Autor: Samuel Manoel De Souza