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

 
inuboh:

It does! But why doesn't it work in this combination?

Although in the picture below it all fits together.


Read about comparing real numbers
 
inuboh:

It does! But why doesn't it work in a combination like this?

Although in the picture below it all fits


Nothing there converges. It often happens that the price is higher than MA on the previous tick, and the price is already lower than MA on this tick, but the exact equality does not happen, or it happens so seldom that nobody has ever seen it. Especially, it cannot be seen on tester ticks. It cannot be seen on the chart. And to subtract a whole unit from the double price and then compare it with МА, as"PC--> MA" - it won't suit at all, such a comparison will never obtain the truth.

 

Good day to you all. A word of advice...

I am writing an indicator. I need a separate indicator in the upper window - fresh data (tick values) to be drawn on the right - like the price - with a green arrow.

I edit indicator from tutorial - my fresh data (new tick values) are drawn on the left - red arrow...

Help me change their drawing. To be on the right, like the price and as on the top indicator in a separate window of the terminal. Thank you.

//--------------------------------------------------------------------
// separatewindow.mq4 
// Предназначен для использования в качестве примера в учебнике MQL4.
//--------------------------------------------------------------------
#property indicator_separate_window // Отображение в отдельном окне
#property indicator_buffers 1       // Количество буферов
#property  indicator_color1 Blue     // Цвет первой линии
#property  indicator_color2 Red      // Цвет второй линии
 
extern int History  =100;           // Колич.баров в расчётной истории
//extern int Aver_Bars=5;             // Количество баров для расчёта
 
double Buf_0[];                     // Объявление индикаторного массива
int Count=0;                        // Глобальная перемен.
//--------------------------------------------------------------------
int init()                          // Специальная функция init()
  {
   SetIndexBuffer(0,Buf_0);         // Назначение массива буферу
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Стиль линии
   //--- установим индексацию для буфера как в таймсерии
   ArraySetAsSeries(Buf_0,true);

   return(0);                          // Выход из спец. ф-ии init()
  }
//--------------------------------------------------------------------
int start()                         // Специальная функция start()
  {
   int i,                           // Индекс бара
   n,                               // Формальный параметр
   Counted_bars;                    // Количество просчитанных баров 
   double
   Sum_H,                           // Сумма значений High за период
   Sum_L;                           // Сумма значений Low  за период
//--------------------------------------------------------------------
 /*  Counted_bars=IndicatorCounted(); // Количество просчитанных баров 
   i=Bars-Counted_bars-1;           // Индекс первого непосчитанного
   if (i>History-1)                 // Если много баров то ..
      i=History-1;                  // ..рассчитывать заданное колич.
 while(i>=0)                      // Цикл по непосчитанным барам
     {
        Sum_H=0;                      // Обнуление в начале цикла
      Sum_L=0;                      // Обнуление в начале цикла
      for(n=i;n<=i+Aver_Bars-1;n++) // Цикл суммирования значений 
        {
         Sum_H=Sum_H + High[n];     // Накопление суммы макс.значений
         Sum_L=Sum_L + Low[n];      // Накопление суммы мин. значений
        }
      Buf_0[i]=(Sum_H-Sum_L)/Aver_Bars;// Знач. 0 буфера на i-ом баре
     
     
      i--;                          // Расчёт индекса следующего бара
      */
      double Price = NormalizeDouble(MarketInfo(_Symbol,MODE_BID),Digits); 
      Buf_0[Count] = Price;
                          
   Count++;                                     // Счётчик тиков
   Comment ("Новый тик ",Count,"   Цена = ",Price);// Сообщение
     
    
//--------------------------------------------------------------------
   return(0);                          // Выход из спец. ф-ии start()
  }
 
Hello! I'm new here. Can someone please tell me or give me a link where I can learn how to use the full functionality of mt4
 

Hi all!

Question:

ticket = OrderSend(blah, blah, blah, ......................)

After reviewing the tutorial, documentation, articles, and forum I've seen thatticket variable- some put it inside the OnTick() function

- Others put it outside (making it external).i.e. in front of (making it external, they did a stat)

- some simply declare it ( int ticket; )

- others assign it to 0 (which is the same as a simple declaration)

- others assign -1

If this is significant (except in individual cases), could it lead to errors, if so how is it correct ? ? ?

Thank you !

 
evillive:

Nothing there fits. It often happens that on the previous tick the price is above the MA, and on this tick the price is already below the MA, but the exact equality does not happen, or it happens so seldom that nobody has ever seen it. Especially, it cannot be seen on tester ticks. It cannot be seen on the chart. And to subtract a whole unit from the price and then compare it with MA, as"PC-- > MA" - it does not work at all, such a comparison will never return the truth.

I got it, thanks! Just tell me something for the future: for example, if I have a line (may it be a muving), how should I write, that when the Ask price reaches this line, a buy order will be opened? ))
 
pavlo555:
Hi, I'm new here. Can someone please tell me or give me a link where you can learn how to use the full functionality of mt4

 
inuboh:
I got it, thanks! Can you tell me something for the future: for example, if I have a line (may it be a muving), how can I write, that when the Ask price reaches this line, a buy order will be opened? ))
If Ask(1) is less than MA and Ask(0) is greater than or equal to MA, that is, a touch-down below, you can buy. But on the next period the price may "change its mind" and go even lower, it's normal, such is the market.
 
Hello. i have a power outage for a couple of minutes and then turn it back on. no power. when the computer suddenly shuts down due to lack of light, the history of EA messages is not saved to disk, and i really need them. can you set the program or the terminal to save the history on hard drive . so the next time you turn on you can see how the expert behaved (what alerts he gave)