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

 
rapid_minus:

OK. Then how to write this correctly?

MB_2=iBands(NULL,0,10,0,2.0,PRICE_CLOSE,2);
Delta_0=iBands(ExtUpperBuffer[0]-ExtLowerBuffer[0]);

How to extract values of ExtUpperBuffer[0] and ExtUpperBuffer[1], well and bottom respectively?

Here again the indicator call is written incorrectly.

I already wrote it correctly here. You don't have to make anything up from yourself, everything is in the reference.

Once again:

High_2=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,2); //это и есть ExtUpperBuffer[2]
High_1=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,1); //ExtUpperBuffer[1]
High_0=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,0); //ExtUpperBuffer[0]
Low_2=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,2); //ну и нижние соответственно, ExtLowerBuffer[2]
Low_1=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1); //ExtLowerBuffer[1]
Low_0=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,0); //ExtLowerBuffer[0]
 
evillive:

Here again, the indicator call is written down incorrectly.

I have already written the correct way here. You don't have to make anything up for yourself, everything is in the handbook.

One more time:

Well, I got it the third time. It seems.

So the mistake in MB_2 is that there's no callable line designation, right? But I haven't found how to call the Bollinger middle line yet. Or just as a moving average? MODE_SMA ?

 
rapid_minus:

Well, I got it on the third time. Seems to be.

So, the error in MV_2 is that there is no callable line designation, right? But I haven't found how to call the Bollinger mean line yet. Or just as a moving average? MODE_SMA ?

Mid=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0); - to zero bar (last digit in brackets - offset to desired bar).

No need to rush, read the help carefully.

 
evillive:

Mid=iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_MAIN,0); - to zero bar (last digit in brackets - offset to the required bar).

No need to rush, read the help carefully.

Thank you!

Only how to find it in the help when you don't know how to phrase the question - that's the question!

Thanks again. Off to do some more digging.

 
rapid_minus:

Thank you!

Only how to find it in the help when you don't know how to phrase the question - that's the question!

Thanks again. I'm off to do some more digging.

Learning to ask the right questions is half the answer, somehow ;)
 
mario065:
Here is an example where I showed how to measure a bar after crossing 2 muves.

tried your code

Question is bar number?

I explained its value it draws different numbers including zero on the hour hand

tried to run it through a tester, same thing.

If the value of one is the same as the other, it will try to draw numbers like I need

thanks

 
sannin:

tried your code

Question is bar number?

I explained its value it draws different numbers including zero on the hour hand

tried to run it through a tester, same thing.

If the value of one is the same as the other, it will try to draw numbers like I need

Thanks

I'm just trying to give an example.

I see you did it.)

Here is the code:

//+------------------------------------------------------------------+
//|                                                    count bar.mq4 |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

extern int limit = 300;
//+------------------------------------------------------------------+
int init(){return(0);}
int deinit(){Comment("");return(0);}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
    static datetime time,timeup,timedn;
    double spread=MarketInfo(Symbol(),MODE_SPREAD);
    double maslow1,mafast1,maslow2,mafast2;
    int    shift,shift1,shift2,f,j;
    
    for(shift=limit;shift>0;shift--){
        shift1=shift+1;shift2=shift+2;
        maslow1 = iMA(NULL,0,20,0,MODE_SMA,PRICE_OPEN,shift1);
        mafast1 = iMA(NULL,0,5,0,MODE_SMA,PRICE_OPEN,shift1);
        maslow2 = iMA(NULL,0,20,0,MODE_SMA,PRICE_OPEN,shift2);
        mafast2 = iMA(NULL,0,5,0,MODE_SMA,PRICE_OPEN,shift2);
 
     if(mafast2<maslow2 && mafast1>maslow1){
        timeup=Time[shift1];
       } 
     if(mafast2>maslow2 && mafast1<maslow1){
        timedn=Time[shift1];
       } 
     
     if(timeup > timedn){
        time = timeup;
       } else {
        time = timedn;
       }
     }
 
      int b1=iBarShift(Symbol(), 0, time);      
      int b2=iBarShift(Symbol(), 0, TimeCurrent());
//Преброяване на баровете-от нулевия до началната дата
    for(j=b2;j<=b1;j++){
        f=b1-b2;
       }
      
   Comment("\n Време на брокера: ",TimeToStr(TimeCurrent(),TIME_SECONDS)," Локално време: "+TimeToStr(TimeLocal(),TIME_SECONDS),
           "\n Текущ спред: ",DoubleToStr(spread/10,1),
           "\n=====================",
           "\n Начална дата:           ",TimeToStr(time,TIME_DATE|TIME_SECONDS), 
           "\n Брой барове:            ",f,
           "\n=====================" 
             ); 
   return(0);
  }
//+------------------------------------------------------------------+

 
mario065:

I wrote it as an example.

I see you've made it :)

Here is the code:

Thank you very much.

I'll share when I'm rich.

 
sannin:

Thank you very much.

I'll share when I'm rich.

Coffee is enough when you get rich ;)
 

SOS! Here's a snippet of the included global variables file. The rest of it is exactly the same.

I did everything I could: changed parameters, removed variables from the file individually and in groups to find the error - all the same:

"not all control paths return a value" warning. What is the reason then?

//|Включаемый файл "Глобальные переменные"                           |
//+------------------------------------------------------------------+
int Variables()
{
//-----Объявляем Глобальные переменные:------------------------------------------

double High_0, High_1, High_2;             // Значение верхней линии Bollinger на 0, 1 и 2 барах
   double Low_0, Low_1, Low_2;                // Значение нижней линии Bollinger на 0, 1 и 2 барах
   double Delta_0, Delta_1;                   // Разница межу значениями верхней и нижней ...
                                              // ...линий Bollinger на 0 и 1 барах

High_0=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_UPPER,0);
     High_1=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_UPPER,1);
     High_2=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_UPPER,2);
     Low_0=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_LOWER,0);
     Low_1=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_LOWER,1);
     Low_2=iBands(NULL,0,10,2,0,PRICE_CLOSE,MODE_LOWER,2);
     Delta_0=(High_0-Low_0);
     Delta_1=(High_1-Low_1);
}
//------------------------------------------------------------------------------------------
I'm going crazy: everything seems to be simple, but it doesn't work.