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

 
ALXIMIKS:

nowhere, for STYLE_DASH there is no thickness greater than normal
I'm drawing a five without a dotted line.
 

I've already sorted it out, but thanks anyway!

:)
 
ALXIMIKS:

Nowhere, for STYLE_DASH is the thickness more than normal

I know that thickness can only be adjusted with line type STYLE_SOLID, but that was not the question
 

So here it is, By the way, you can't skip parameters, you can omit the last ones, but you can't skip them at all)))) I think, that the last zero is a colour. It turns out, that the width is skipped, but it must be, if the colour is specified.

void SetIndexStyle( int index, int type, int style=EMPTY, int width=EMPTY, color clr=CLR_NONE)

 
Sepulca:

So here it is, By the way, you can't skip parameters, you can omit the last ones, but you can't skip them at all)))) I think, the last zero is a colour. It turns out, that the width is skipped, but it must be, if the colour is specified.

void SetIndexStyle( int index, int type, int style=EMPTY, int width=EMPTY, color clr=CLR_NONE)

If it is not difficult, please look through my code on previous page. I have tried everything and can't make a mask with filter.
And I also tested the search for lows and highs in Metatrader 5, I have some assumptions on that basis.
 
Forexman77:
If it's not too much trouble, have a look at my code on the previous page. Tried everything and no way to make a mask with filter.
And I also tested the search for lows and highs in Metatrader 5, I have some assumptions on that basis.

Ok. I'll have a look now.
 
Forexman77:
I am drawing a five without a dotted line.


Well, it seems to be drawing something.

Although I may not have fully

#property indicator_chart_window
#property indicator_buffers 1
#property  indicator_color1 Red 
//--- input parameters
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3,Aqua);
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,MA_0_t,MA_1_t;
   static double MA_otshet;  //здесь хранится запись значения MA_otshet
   
   for(int i=0;i<Bars;i++)
   {  
      MA_0_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_1_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_0_t-MA_1_t; //разница между сегодня и вчера по скользящей средней
      raznica_static=MA_0_t-MA_otshet; //разница между сегодня и MA_otshet

      if(MathAbs(raznica)<=0.005) // если raznica не превышает заданное число 
          {
          MA_otshet=MA_1_t; // записываем значение MA_otshet
          }
      if(MathAbs(raznica_static) <= 0.005) //если raznica_static не превышает заданное число
          {
          ExtMapBuffer1[i]=MA_otshet;  // то рисуем значение индикатора, как записанный MA_otshet
          }
      if(MathAbs(raznica_static)> 0.005) // если raznica превышает заданное число
          {
          ExtMapBuffer1[i]=MA_0_t; // то рисуем значение по текущей цене
          }
   } 
   return(0);
  }

I may not fully understand the meaning of the indicator.

 

Forexman77:
У меня пятерку рисует без пунктира.


Are you kidding me? Dashed lines have no thickness other than standard (and in the documentation somewhere was written, I can not specify the place, but I remember that I read)

We prove:

1) throw in a normal mask

2) enter "Colours" properties

3) set line type - dashed line

4) Select thickness 2-5.

Result - a dotted line becomes a normal line.

 
Hello all!!! Tried to write a simple expert myself. But there is some problem I don't understand. Here's a simple oscilloscope I've seen in a book. I compile it and nothing is displayed. Although, if you put "-" instead of division in the while loop, everything works.
#property copyright "Lelik"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1 White
//-------------------------------------------------------------------
extern int Period_valroc=10;            //Период за который расчитывается осцилятор
double Line0[];                  //Массив значений
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    SetIndexBuffer(0,Line0);

   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    i,Counted_bars=IndicatorCounted();
   if(Bars<Period_valroc) return(0);            
   
//----
    i=Bars-Counted_bars-1;
    while(i>=0)
      {
        Line0[i]=100*(Close[i]/Close[i+Period_valroc]);
        i--;
      }
//----
   return(0);
  }
 
Sepulca:


There, it seems to be drawing something.

Although I may not have fully

fully understand the meaning of the indicator

The point is that if there is a fall or rise not exceeding 50 pips, the indicator should not change from the previous value,

which we recorded if there was no overshoot. And on every tick we compare it.

While there is no excess, a straight line is drawn; if there is an excess, the indicator gets the current value.

Approx.

the code below. But when I run it in the tester I see that it shows different things in real life. It starts to deviate when there is no excess

by the same 50 points. I can see that it delays especially on the rise and starts to change through the bar.

I made a mistake somewhere, I do not know where.

//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION,0,1);
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,MA_1_t,MA_2_t;
    
  if(counted_bars>0)
      counted_bars--;
   limit=Bars-counted_bars;
  static double MA_otshet; 
  for(int i=0;i<limit;i++)
   {    
      MA_1_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_2_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_1_t-MA_2_t;
      raznica_static=MA_1_t-MA_otshet;
      if(raznica_static > -0.005 && raznica_static < 0.005)
      {
      ExtMapBuffer1[i]=MA_otshet;
      }
      else
      if(raznica > -0.005 && raznica < 0.005)
      {
      ExtMapBuffer1[i]=MA_2_t;
      MA_otshet=MA_2_t;
      }
      if((raznica > 0.005) || (raznica <- 0.005))
      {
      ExtMapBuffer1[i]=MA_1_t;
      }  
   } 
   return(0);
  }
//+------------------------------------------------------------------+
Reason: