[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 371

 
ILL:
All even((((
Sorry, I got confused - you should put 1 there, then it will be correct. I mean the Close/Close price on the chart will match the price in the function.
 
khorosh:
Sorry, I got confused - you have to put 1 there, then it will be correct. I mean the Close/Close price on the chart will match the price in the function.

HOORAY! It's working!!!!

Thank you very much!

 

Check it out!

//+------------------------------------------------------------------+
//| скорость.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern double razniza=20;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
double HIGH;double LOW;
int start()
{ HIGH=iHigh( NULL, PERIOD_M1, 0) ;
LOW=iLow( NULL, PERIOD_M1, 0);if (HIGH-LOW>razniza*Point || LOW-HIGH<0-razniza*Point)
Alert("Движение!!!",Symbol() );



// PERIOD_M1;PRICE_HIGH;PRICE_LOW;double High[];iHigh( NULL, PERIOD_M1, 0) ; iLow( string symbol, int timeframe, int shift) ;

//----

//----
return(0);
}
//+------------------------------------------------------------------+
 
Dimka-novitsek:

Check it out!

Whoa!
 
Thank you!!!!!
 
Zhunko:

Well, finally! Read about it here. Only in the Expert Advisor and script startup functions with waiting. In all other places it is strictly prohibited.

Your code does not fit the standards of MQL4. Also, it was written somewhere that the waiting time in the ininit and deinit functions during a system call is limited to 2.5 seconds. Then the function is forcibly terminated.

Everything works. Here's the code for the real time mini system. Outside the start() function. Although of course it's absolutely not principal to put it in init().

Below is the code checked on the working terminal; the order opens and all the alerts are written in the message window. Function Sleep() also

Function Sleep() works fine too. I checked it with 30 sec waiting time - Sleep(30000). Although such a wait is absolutely unnecessary, 50 ms is enough.

//--- input parameters
  extern int       int10 = 10; // вызов процедуры каждые 10 сек.
  extern int       int30 = 30; // вызов процедуры каждые 30 сек.
  extern int       int60 = 60; // вызов процедуры каждые 60 сек.                

  int  orders; // кол-во открытых ордеров

int init()
  {
   bool end = 1; // для завершения работы установить в false
   
   bool f_int10 = 1; // флаг разрешающий прерывание int10
   bool f_int30 = 1; // флаг разрешающий прерывание int30
   bool f_int60 = 1; // флаг разрешающий прерывание int60
   
   
   int  St_Time_10; // стартовое время отсчета 10 сек;
   int  St_Time_30; // стартовое время отсчета 30 сек;
   int  St_Time_60; // стартовое время отсчета 60 сек;
   
   St_Time_10 = TimeLocal();
   St_Time_30 = TimeLocal();
   St_Time_60 = TimeLocal();
   
   

//-----------------------------основной цикл программы--------------------------------
   while(end)
     {
       Sleep (50);
       if ((TimeLocal()==(St_Time_10 + int10))&&f_int10) {St_Time_10 = TimeLocal(); Call_int10();}
       if ((TimeLocal()==(St_Time_30 + int30))&&f_int30) {St_Time_30 = TimeLocal(); Call_int30();}
       if ((TimeLocal()==(St_Time_60 + int60))&&f_int60) {St_Time_60 = TimeLocal(); Call_int60();}
       RefreshRates();
      }  
   return(0);
  }
//-----------------------------конец основного цикла----------------------------------
//--------------------процедура вызываемая по прерыванию int10------------------------
  void Call_int10()
        {
          Alert ("Прерывание = 10 сек. Котировка >>>>", Close[0]);
        }
//------------------------------------------------------------------------------------
//--------------------процедура вызываемая по прерыванию int30------------------------
  void Call_int30()
        {
        Alert ("Прерывание === 30 сек.  В резерве.");
        }
//------------------------------------------------------------------------------------
//--------------------процедура вызываемая по прерыванию int60------------------------
  void Call_int60()
 {
        Alert ("Прерывание ===== 60 сек");
        if (orders!=0) return;
        if (OrdersTotal( ) == 0) {
            OrderSelect(1, SELECT_BY_POS, MODE_TRADES);
            int ticket = OrderSend(Symbol(), OP_BUY, 0.01, Ask, 3, 0, 0, "from init()",123,Blue);
                              if (ticket<0)
                                       {
                                         Alert("OrderOpen BUY failed, with error #",GetLastError()); return;
                                       }      
        Alert (" Открытие ордера BUY из init() прошло успешно");                 
        orders++;              
                                  }
 }
//------------------------------------------------------------------------------------
//---------------------------эти функции не используются------------------------------
int start()  {return(0);}
//--------------------------------------------
int deinit() {return(0);}
//--------------------------------------------
 

Question about arrays.

There are three one-dimensional arrays:

1. закрытие бара

Close[i]={Close_1,Close_2,...,Close_i};

2. открытие бара

Open[i]={Open_1,Open_2,...,Open_i};

3. его индекс

Index[i]={1, 2, ..., i};

Задача: необходимо организовать двумерный массив mas[i,2], отвечающий условиям

mas[i,0]= |Close_i-Open_i|;

mas[i,1]=i;

Как это правильно сделать?

Please help me with this question.
 
I have the following problem, I registered on MT4 yesterday, I started to get acquainted and experiment on demo. I decided to continue studying MT4 in the morning, but the chart stopped at the time of May 6 23:57, I didn't try to reboot the computer or reinstall the program, what to do?
 

Arthibald:
1. У меня такая проблема, вчера зарегистрировался на МТ 4, начал ознакамливатся и эксперементировать на демо. С утра решил продолжить изучать МТ4, но графики остановились на отметке времени 6 мая 23:57, ни помогает ни перезагрузка компа, не переутановка программы,...

2.... what to do ?


1. The world has collapsed, the market is up - look at the day of the week... :-)) ALL NORMAL PEOPLE HAVE THE WEEKEND OFF... :-)))

2. rest... :-)))

 
Roman.:


1. The world has collapsed, the market is up - look at the day of the week...:-)) ALL NORMAL PEOPLE HAVE THE WEEKEND OFF... :-)))

2. rest...:-)))

Thanks :-) I guess I'm off the hook, but that's the way it is.)