Perguntas de Iniciantes MQL4 MT4 MetaTrader 4 - página 12

 

Favor informar quem sabe como se conectar ao tempo do sistema do computador no terminal MT4:

- gráficos

- pedidos em aberto

- histórico do negócio

- logs

- logs

O problema é que o tempo não está sincronizado.

Qual poderia ser o problema?

 

Boa tarde!

Tomei um dosindicadores de volume como base, refiz para adequá-lo aos meus parâmetros, deixei apenas o necessário, agora ele mostra apenas as setas que são necessárias.

Não consigo anexar o ALERTA para que quando a seta verde ou vermelha acender, a mensagem apareça.

Por favor, ajude!

Z.U. Olhou para diferentes tutoriais de como fazer algo não funciona.

 
Refresh052:

Boa tarde!

Tomei um dosindicadores de volume como base, refiz para adequá-lo aos meus parâmetros, deixei apenas o necessário, agora ele mostra apenas as setas que são necessárias.

Não consigo anexar o ALERTA para que quando a seta verde ou vermelha acender, a mensagem apareça.

Por favor, ajude!

Z.U. Olhou para diferentes tutoriais de como fazer algo não funciona.

Vamos lá, coloque aqui todo o código do indicador
 
Stanislav Aksenov:
Vá em frente, coloque aqui todo o código do indicador

#propriedade rigorosa

#janela_do_cartão_indicador de propriedade


#indicador de propriedade_mínimo 0

#property indicator_buffers 2

#indicador de propriedade_cores1 Vermelho

#indicador de propriedade_color2 Cal




#largura_do_indicador de propriedade1 4

#largura_do_indicador de propriedade2 4


preço externo ENUM_APPLIED_PRICE = PREÇO_CLOSE;

Duplo sobre-comprado externo = 80;

duplo externo sobrevenda = 20;

int externo NumberOfBars = 500;

fio externo Nota = "0 significa Mostrar todas as barras";

período MAP MAP = 100;

LookBack int externo = 20;

alerta externo = Verdadeiro;

duplo vermelho[],cal[];

//+------------------------------------------------------------------+

//| Função de inicialização do indicador personalizado |

//+------------------------------------------------------------------+

int init()

{

//---- indicadores

SetIndexBuffer(0,vermelho);

SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID,3);

SetIndexArrow(0,234);

SetIndexLabel(0, "Clímax Alto");

SetIndexBuffer(1,lima);

SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID,3);

SetIndexArrow(1.233);

SetIndexLabel(1, "Clímax baixo");

SetIndexEmptyValue(0,0,0.0);

SetIndexEmptyValue(1,0.0);

SetIndexDrawBegin(0,0);

SetIndexDrawBegin(1,0);

IndicatorShortName("MKSP_Volume" );


//----

retorno(0);

}

//+------------------------------------------------------------------+

//| Função de desinicialização de indicadores personalizados |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

retorno(0);

}

//+------------------------------------------------------------------+

//| Função de iteração de indicador personalizada |

//+------------------------------------------------------------------+

int start()

{


duplo VolLowest,Range,Value2,Value3,HiValue2,HiValue3,LoValue3,tempv2,tempv3

limite int;

int counted_bars=IndicatorCounted();

//---- última barra contada será recontada

if(counted_bars>0) counted_bars--;

se ( NumberOfBars == 0 )

NumberOfBars = Bars-counted_bars;

limit=NumberOfBars; //Bars-counted_bars;

for(int i=0; i<limit; i++)

{

vermelho[i] = 0; cal[i] = 0;

Value2=0;Value3=0;HiValue2=0;HiValue3=0;LoValue3=99999999;tempv2=0;tempv3=0;tempv=0;

VolLowest = Volume[iLowest(NULL,0,MODE_VOLUME,20,i)];

se (Volume[i] == VolLowest)

{

}

Alcance = (Alto[i]-Baixo[i]);

Valor2 = Volume[i]*Valor [i]*Valor;

se ( Faixa != 0 )

Valor3 = Volume[i]/Variação;

para ( int n=i;n<i+MAPeriod;n++ )

{

tempv= Volume[n] + tempv;

}

para ( int n=i;n<i+LookBack;n+++)

{

tempv2 = Volume[n]*((Alto[n]-Baixo[n]));

se ( tempv2 >= HiValue2 )

HiValue2 = tempv2;

se ( Volume[n]*((Alto[n]-Baixo[n])) != 0 )

{

tempv3 = Volume[n] / ((Alto[n]-Baixo[n]);

se ( tempv3 > HiValue3 )

HiValue3 = tempv3;

se ( tempv3 < LoValue3 )

LoValue3 = tempv3;

}

}

se ( Valor2 == HiValue2 && Close[i] > (Alto[i] + Baixo[i]) / 2 )

{

red[i] = High[i]+10*Point;

}

se ( Valor3 == HiValue3 )

{

NormalizeDuplo(Volume[i],0);

vermelho[i]=0;

}

se ( Valor2 == HiValue2 && Valor3 == HiValue3 )

{

NormalizeDuplo(Volume[i],0);

vermelho[i]=0;

}

if ( Valor2 == HiValue2 && Close[i] <= (Alto[i] + Baixo[i]) / 2 )

{

lime[i] = Low[i]-10*Point;

}

}

//----

//----

retorno(0);

}

//+------------------------------------------------------------------+

E uma captura de tela

Arquivos anexados:
 
Stanislav Aksenov:
Vamos, coloque aqui todo o código para o indicador.
Eu não sei onde colocar Alerta
 
Refresh052:


E uma captura de tela

if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )

            {

               red[i] = High[i]+10*Point;

             Alert("===================");  

            }  

            

          if ( Value3 == HiValue3 )

            {

               NormalizeDouble(Volume[i],0);                

               red[i]=0;

            }

          if ( Value2 == HiValue2 && Value3 == HiValue3 )

            {

               NormalizeDouble(Volume[i],0);

               red[i]=0;

              

            }

         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )

            {

               lime[i] = Low[i]-10*Point;

               Alert("===================");            

              }
 
Alekseu Fedotov:
if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )

            {

               red[i] = High[i]+10*Point;

             Alert("===================");  

            }  

            

          if ( Value3 == HiValue3 )

            {

               NormalizeDouble(Volume[i],0);                

               red[i]=0;

            }

          if ( Value2 == HiValue2 && Value3 == HiValue3 )

            {

               NormalizeDouble(Volume[i],0);

               red[i]=0;

              

            }

         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )

            {

               lime[i] = Low[i]-10*Point;

               Alert("===================");            

              }
cada vela sinaliza com mais precisão a cada segundo
 

#property strict
#property indicator_chart_window
#property indicator_minimum 0
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_width1 4
#property indicator_width2 4

extern ENUM_APPLIED_PRICE price = PRICE_CLOSE;
extern double Overbought = 80;
extern double Oversold   = 20;
extern int     NumberOfBars = 500;
extern string  Note = "0 means Display all bars";
extern int     MAPeriod = 100;
extern int     LookBack = 20;
extern bool Alert=True;
double red[],lime[];
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
      SetIndexBuffer(0,red);
      SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (0,234);
      SetIndexLabel(0,"Climax High ");
      SetIndexBuffer(1,lime);
      SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (1,233);
      SetIndexLabel(1,"Climax Low ");
      SetIndexEmptyValue(0,0.0);
      SetIndexEmptyValue(1,0.0);
      SetIndexDrawBegin(0,0);
      SetIndexDrawBegin(1,0);
      IndicatorShortName("MKSP_Volume" );
   return(0);
  }
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
int start()
{
   double VolLowest,Range,Value2,Value3,HiValue2,HiValue3,LoValue3,tempv2,tempv3,tempv;
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   if ( NumberOfBars == 0 ) NumberOfBars = Bars-counted_bars;
   limit=NumberOfBars; //Bars-counted_bars;

   for(int i=0; i<limit; i++)  
      {
         red[i] = 0; lime[i] = 0;
         Value2=0;Value3=0;HiValue2=0;HiValue3=0;LoValue3=99999999;tempv2=0;tempv3=0;tempv=0;
         VolLowest = Volume[iLowest(NULL,0,MODE_VOLUME,20,i)];
         if (Volume[i] == VolLowest)
            {
                           }

         Range = (High[i]-Low[i]);
         Value2 = Volume[i]*Range;

         if (  Range != 0 ) Value3 = Volume[i]/Range;

         for ( int n=i;n<i+MAPeriod;n++ )
            {
               tempv= Volume[n] + tempv;
            }

          for( int n=i;n<i+LookBack;n++)
            {
               tempv2 = Volume[n]*((High[n]-Low[n]));
               if ( tempv2 >= HiValue2 )
                  HiValue2 = tempv2;

               if ( Volume[n]*((High[n]-Low[n])) != 0 )
                  {          
                     tempv3 = Volume[n] / ((High[n]-Low[n]));
                     if ( tempv3 > HiValue3 )  HiValue3 = tempv3;
                     if ( tempv3 < LoValue3 ) LoValue3 = tempv3;
                  }
            }
          if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )
            {
               red[i] = High[i]+10*Point;

if(i==0) Alert("Вроде бы красная стрелка"); 

            }  

          if ( Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);                
               red[i]=0;
            }
          if ( Value2 == HiValue2 && Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);
               red[i]=0;
            }
         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )
            {
               lime[i] = Low[i]-10*Point;

if(i==0) Alert("Вроде бы зеленая стрелка");  

              }
      }
   return(0);
  }

Não coloque o código em texto simples, use um layout especial para ele.

Eu realmente não entendi,

Como regra é emitido um alerta se houver um sinal na última barra (zero)

 
Stanislav Aksenov:

#property strict
#property indicator_chart_window
#property indicator_minimum 0
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_width1 4
#property indicator_width2 4

extern ENUM_APPLIED_PRICE price = PRICE_CLOSE;
extern double Overbought = 80;
extern double Oversold   = 20;
extern int     NumberOfBars = 500;
extern string  Note = "0 means Display all bars";
extern int     MAPeriod = 100;
extern int     LookBack = 20;
extern bool Alert=True;
double red[],lime[];
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
      SetIndexBuffer(0,red);
      SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (0,234);
      SetIndexLabel(0,"Climax High ");
      SetIndexBuffer(1,lime);
      SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (1,233);
      SetIndexLabel(1,"Climax Low ");
      SetIndexEmptyValue(0,0.0);
      SetIndexEmptyValue(1,0.0);
      SetIndexDrawBegin(0,0);
      SetIndexDrawBegin(1,0);
      IndicatorShortName("MKSP_Volume" );
   return(0);
  }
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
int start()
{
   double VolLowest,Range,Value2,Value3,HiValue2,HiValue3,LoValue3,tempv2,tempv3,tempv;
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   if ( NumberOfBars == 0 ) NumberOfBars = Bars-counted_bars;
   limit=NumberOfBars; //Bars-counted_bars;

   for(int i=0; i<limit; i++)  
      {
         red[i] = 0; lime[i] = 0;
         Value2=0;Value3=0;HiValue2=0;HiValue3=0;LoValue3=99999999;tempv2=0;tempv3=0;tempv=0;
         VolLowest = Volume[iLowest(NULL,0,MODE_VOLUME,20,i)];
         if (Volume[i] == VolLowest)
            {
                           }

         Range = (High[i]-Low[i]);
         Value2 = Volume[i]*Range;

         if (  Range != 0 ) Value3 = Volume[i]/Range;

         for ( int n=i;n<i+MAPeriod;n++ )
            {
               tempv= Volume[n] + tempv;
            }

          for( int n=i;n<i+LookBack;n++)
            {
               tempv2 = Volume[n]*((High[n]-Low[n]));
               if ( tempv2 >= HiValue2 )
                  HiValue2 = tempv2;

               if ( Volume[n]*((High[n]-Low[n])) != 0 )
                  {          
                     tempv3 = Volume[n] / ((High[n]-Low[n]));
                     if ( tempv3 > HiValue3 )  HiValue3 = tempv3;
                     if ( tempv3 < LoValue3 ) LoValue3 = tempv3;
                  }
            }
          if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )
            {
               red[i] = High[i]+10*Point;

if(i==0) Alert("Вроде бы красная стрелка"); 

            }  

          if ( Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);                
               red[i]=0;
            }
          if ( Value2 == HiValue2 && Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);
               red[i]=0;
            }
         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )
            {
               lime[i] = Low[i]-10*Point;

if(i==0) Alert("Вроде бы зеленая стрелка");  

              }
      }
   return(0);
  }

Não coloque o código em texto puro em suas mensagens, use o layout do código.

Ainda não percebi bem,

Como regra é emitido um alerta se houver um sinal no último bar, acho que o coloquei nos lugares certos...

Ok obrigado, vou tentar, também uma lição separada))))
 
Stanislav Aksenov:

#property strict
#property indicator_chart_window
#property indicator_minimum 0
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_width1 4
#property indicator_width2 4

extern ENUM_APPLIED_PRICE price = PRICE_CLOSE;
extern double Overbought = 80;
extern double Oversold   = 20;
extern int     NumberOfBars = 500;
extern string  Note = "0 means Display all bars";
extern int     MAPeriod = 100;
extern int     LookBack = 20;
extern bool Alert=True;
double red[],lime[];
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
      SetIndexBuffer(0,red);
      SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (0,234);
      SetIndexLabel(0,"Climax High ");
      SetIndexBuffer(1,lime);
      SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID,3);
      SetIndexArrow (1,233);
      SetIndexLabel(1,"Climax Low ");
      SetIndexEmptyValue(0,0.0);
      SetIndexEmptyValue(1,0.0);
      SetIndexDrawBegin(0,0);
      SetIndexDrawBegin(1,0);
      IndicatorShortName("MKSP_Volume" );
   return(0);
  }
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
int start()
{
   double VolLowest,Range,Value2,Value3,HiValue2,HiValue3,LoValue3,tempv2,tempv3,tempv;
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   if ( NumberOfBars == 0 ) NumberOfBars = Bars-counted_bars;
   limit=NumberOfBars; //Bars-counted_bars;

   for(int i=0; i<limit; i++)  
      {
         red[i] = 0; lime[i] = 0;
         Value2=0;Value3=0;HiValue2=0;HiValue3=0;LoValue3=99999999;tempv2=0;tempv3=0;tempv=0;
         VolLowest = Volume[iLowest(NULL,0,MODE_VOLUME,20,i)];
         if (Volume[i] == VolLowest)
            {
                           }

         Range = (High[i]-Low[i]);
         Value2 = Volume[i]*Range;

         if (  Range != 0 ) Value3 = Volume[i]/Range;

         for ( int n=i;n<i+MAPeriod;n++ )
            {
               tempv= Volume[n] + tempv;
            }

          for( int n=i;n<i+LookBack;n++)
            {
               tempv2 = Volume[n]*((High[n]-Low[n]));
               if ( tempv2 >= HiValue2 )
                  HiValue2 = tempv2;

               if ( Volume[n]*((High[n]-Low[n])) != 0 )
                  {          
                     tempv3 = Volume[n] / ((High[n]-Low[n]));
                     if ( tempv3 > HiValue3 )  HiValue3 = tempv3;
                     if ( tempv3 < LoValue3 ) LoValue3 = tempv3;
                  }
            }
          if ( Value2 == HiValue2  && Close[i] > (High[i] + Low[i]) / 2 )
            {
               red[i] = High[i]+10*Point;

if(i==0) Alert("Вроде бы красная стрелка"); 

            }  

          if ( Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);                
               red[i]=0;
            }
          if ( Value2 == HiValue2 && Value3 == HiValue3 )
            {
               NormalizeDouble(Volume[i],0);
               red[i]=0;
            }
         if ( Value2 == HiValue2  && Close[i] <= (High[i] + Low[i]) / 2 )
            {
               lime[i] = Low[i]-10*Point;

if(i==0) Alert("Вроде бы зеленая стрелка");  

              }
      }
   return(0);
  }

Não coloque o código em texto simples, use um layout especial para ele.

Eu realmente não entendi,

Como regra é emitido um alerta se houver um sinal na última barra (zero)

A cada segundo, um alerta dispara.
Razão: