Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 42

 
Forexman77 :
Thank you very much!
Look at the second option... I think it's more reliable than the first.
 
I need to mark a Friday on the chart with an arrow. I tried to make an indicator according to the template. There are no errors, but the arrow does not appear. What could be the reason?
//+------------------------------------------------------------------+
//|                                                   пятый день.mq4 |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Aqua
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),  
    pyatnica,                    
    limit;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   
   for(int i=0;i<limit;i++)
   {
      pyatnica = (DayOfWeek() == 5); 
      
      {
      ExtMapBuffer1[i]=pyatnica;
      }
   }
   return(0);
  }
//+------------------------------------------------------------------+
 
pyatnica = (TimeDayOfWeek (Time[i]) == 5);
if (pyatnica) ExtMapBuffer1[i] = Bid;
and there will be arrows all Friday.
 
TarasBY :
and there will be arrows all Friday.

Only they will be off-screen
 

Wrote the code.

int start()
  {
    int counted_bars=IndicatorCounted(),  
    pyatnica,                    
    limit;
 
   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   
   for(int i=0;i<limit;i++)
   {
      pyatnica = (TimeDayOfWeek (Time[i]) == 5);
      if (pyatnica) ExtMapBuffer1[i] = Bid;
      
      {
      ExtMapBuffer1[i]=pyatnica;
      }
   }
   return(0);
  }
error: 'pyatnica' - comparison expression expected.
 
Forexman77 :

I have written the code.

error: 'pyatnica' - comparison expression expected.

Since your variable is of the int type, you should write it like this:

if (pyatnica!=0) ExtMapBuffer1[i] = Bid;
Also, you have missed else.
 
PapaYozh :

Since you have an int type variable, you should write it like this:

and also, you're missing else.
Thank you, it worked. Only why "pyatnica" to write in double, it seems to be an integer? I tried it in int also works.
 
Vinin :

Only be off-screen

There is such a thing. From time to time the arrows fly up or down. Is it possible to link them to the graph axis?
 
Forexman77 :

There is such a thing. From time to time the arrows fly up or down. Is it possible to link them to the graph axis?

bool pyatnica; // убрать её объявление из int
for(int i=0;i<limit;i++)
   {
      pyatnica = (TimeDayOfWeek (Time[i]) == 5);
      if (pyatnica) ExtMapBuffer1[i] = Bid;
   }
 
Vinin : Just be off the screen.

How did you know he was going to write "nonsense" again! :)))

P.S. By the way, I didn't pay attention to "what type of pyatnica" right away.

Reason: