[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 134

 

MQL Tutorial - Operators - The while loop operator

This is an example from the textbook:

//--------------------------------------------------------------------
// fibonacci.mq4
// Предназначен для использования в качестве примера в учебнике MQL4.
//--------------------------------------------------------------------
int start()                               // Спец. ф-ия start()
  {
//--------------------------------------------------------------------
   int i;                                 // Формальн параметр,счётчик
   double
   A,B,C,                                 // Числа последовательности
   Delta,                                 // Фактич. разница между Кф
   D;                                     // Заданная точность
//--------------------------------------------------------------------
   A=1;                                   // Начальное значение
   B=1;                                   // Начальное значение 
   C=2;                                   // Начальное значение
   D=0.0000000001;                        // Задаём точность
   Delta=1000.0;                          // Начальное значение
//--------------------------------------------------------------------
   while(Delta > D)                       // Заголовок оператора цикла
     {                                    // Скобка начала тела цикла
      i++;                                // Счётчик
      A=B;                                // Следующее значение
      B=C;                                // Следующее значение
      C=A + B;                            // Следующее значение
      Delta=MathAbs(C/B - B/A);           // Искомая разница между Кф
     }                                    // Скобка конца тела цикла
//--------------------------------------------------------------------
   Alert("C=",C," Число Фибоначчи=",C/B," i=",i);//Сообщение на экран
   return;                                // Выход из start()
  }
//--------------------------------------------------------------------

If possible, please give some practical example of how to apply this operator to trade...... i.e. for example a brief condition and that it could be checked on a chart.

Thank you in advance

 

Good day to all. Please help me to convert zip file to mq4 indicator https://www.mql5.com/ru/code/9136.

 
GALO4KA1971:

Good day to all. Please help me to convert the zip file to mq4 indicator https://www.mql5.com/ru/code/9136.

Do you mean open the archive?
 
rustein:
You mean open the archive?

Yes. I don't have this function supported by my beech...
 
GALO4KA1971:

Yes. I don't have this function supported by my beech...
Files:
 
rustein:


Is this the second file that zipped? The one with the alert?
 
GALO4KA1971:

Is that the second file that zipped? The one with the alert?
This file is in the archive.
 
rustein:
This file is in the archive.

Thank you very much. I'll give it a try...
 

Everything works. Thanks again. If it's not too much trouble, take a look at this inductor https://www.mql5.com/ru/code/9139. Is it possible to attach a beep when it crosses the zero line?

 
For the needs of an Expert Advisor (not an indicator) it is necessary to go through all or part of the history. How do I know how many bars are in the history? (The Bars operator shows how many bars are on the chart. )