Questions from Beginners MQL4 MT4 MetaTrader 4 - page 12

 

Please advise who knows how to link to the system time of the computer in the MT4 terminal:

- charts

- open orders

- deal history

- logs

- logs

The thing is that the time is not synchronised.

What could be the problem?

 

Good afternoon!

I took one ofthe volume indicators as a basis, remade it to fit my parameters, left only what is needed, now it shows only the arrows that are needed.

I can't get it to attach the ALERT so that when the green or red arrow lights up, the message will pop up.

Please help!

Z.U. Looked at different tutorials how to do something does not work.

 
Refresh052:

Good afternoon!

I took one ofthe volume indicators as a basis, remade it to fit my parameters, left only what is needed, now it shows only the arrows that are needed.

I can't get it to attach the ALERT so that when the green or red arrow lights up, the message will pop up.

Please help!

Z.U. Looked at different tutorials how to do something does not work.

Come on, put all the code of the indicator here
 
Stanislav Aksenov:
Go ahead, put all the code of the indicator here

#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[];

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

//| Custom indicator initialisation function |

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

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);

}

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

//| Custom indicator deinitialisation function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{


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

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 ( 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;

}

}

//----

//----

return(0);

}

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

And a screenshot

Files:
 
Stanislav Aksenov:
Come on, put all the code for the indicator here.
I don't understand where to put Alert
 
Refresh052:


And a screenshot

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("===================");            

              }
every candle signals more precisely every second
 

#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);
  }

Don't put the code in plain text, use a special layout for it.

I didn't really understand it,

As a rule an alert is issued if there is a signal on the last bar (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);
  }

Don't put the code in plain text in your messages, use the code layout.

I haven't really figured it out,

As a rule an alert is issued if there is a signal on the last bar, I think I put it in the right places...

Ok thanks, I'll try, also a separate lesson))))
 
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);
  }

Don't put the code in plain text, use a special layout for it.

I didn't really understand it,

As a rule an alert is issued if there is a signal on the last bar (zero)

Every second an alert goes off
Reason: