Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1930

 

Question about OnTimer

If timer event occurs before program execution, will it wait (program will skip timer event), or program will abort, and start working on new timer event? Will it hang in an endless loop, or will it loop again every second?

int OnInit()
{
 EventSetTimer(1);
      
    }
//---
  return(INIT_SUCCEEDED);
}

void OnTimer()
{
  
  int i=0;
  while(i<1) {
   
  }
}

There is no direct indication in the docs about the priority of the timer event and the course of the program, only about the order of events.

Or maybe I don't understand it correctly. The timer event on which the action started counts as being in the queue?

Docks:

EventSetTimer

No more than one timer event can be started for each program. Each mql4-program and each graph has its own queue of events, where all the newly arrived events are stored. If there is already a Timer event in the queue or this event is in the processing state, a new Timer event is not placed in the mql4-program queue.


 
Valeriy Yastremskiy program execution, will it wait (program will skip timer event), or program will abort, and start working on new timer event? Will it hang in an endless loop, or will it loop again every second?

There is no direct indication in the docs about the priority of the timer event and the course of the program, only about the order of events.

Or maybe I don't understand it correctly. The timer event on which the action started counts as being in the queue?

Docks:

EventSetTimer

No more than one timer event can be started for each program. Each mql4-program and each graph has its own queue of events, where all the newly arrived events are stored. If there is already an event in the Timer queue, or if this event is in the processing state, a new Timer event is not placed in the queue of the mql4-program.


The events are NOT TIMES. They are handled in OnXXX one by one, without interrupting any of the functions.

Until OnInit terminates no other OnTimer handler OnTick will be called by terminal. (Unless you yank it yourself as a function).

 
Maxim Kuznetsov #:

Events are NOT interruptions. They are processed in OnXXX one by one, without interrupting the text functions.

Until OnInit terminates no other OnTimer OnTick handler will be called by the terminal. (Unless you yank it yourself as a function).

Thank you)

 
Vitaly Muzichenko #:

The important thing in all this is a properly working trawling algorithm, i.e. the trades themselves.

Drawing is in the background, it is informational and has nothing to do with the system profitability.

Therefore, if there is a position but the chart is closed and it did not close by itself, there is no need to open anything, the trawl algorithm will work and stops will be moved over. It is much worse, when a chart is closed, but the program has opened it again literally for drawing of the chart - this is a bad thing.

My God - why have you been sent to the car wash? Have you written in a wrong place and wrong variables: z or v...?

 
Hello! If someone is not too difficult please write or help me write a function for an MT4 EA. The idea is that if I manually change an open position or a market order, the EA will send a message to e-mail. For example: I have moved the stop loss of an open Limit order, the EA will write an email saying that the stop loss for that order has changed from so-and-so to so-and-so.
 
Vitaly Muzichenko #:


It looks like it should work. Haven't tested it.

Drawing logic. I don't control levels, I draw again and below price, if in Buy I draw in grey, above in blue, in Sell, if above price level, it is grey, below in red.

Yes, I forgot to set the levels removal)))

Files:
 
Valeriy Yastremskiy #:

It looks like it should work. Haven't tested it.

Drawing logic. I don't control levels, I draw again and below price, if in Buy I draw in grey, above in blue, in Sell, if above price level, it is grey, below in red.

Yes, I forgot to set the levels removal)))

ALLO! ? :-) YOU'RE KIDDING ME????????????????
 
Roman Shiredchenko #:
ALLO! ? :-) YOU'RE MOCKING????????????????

Vitaly can read and download files. Or do you consider the help to be bullying?

 
Roman Shiredchenko #:
ALLO! ? :-) YOU'RE KIDDING ME????????????????

We communicate by post, in case someone tests it and shows mistakes))))

 

I don't understand what's wrong. There are 3 options in the description. There are 2 in the line identifiers of the induced line.

and do I understand correctly that the middle one is a simple waveform with the same period?

iBands

Возвращает значение технического индикатора Bollinger Bands®.

double  iBands( 
   string       symbol,           // имя символа 
   int          timeframe,        // таймфрейм 
   int          period,           // период 
   double       deviation,        // кол-во стандартных отклонений 
   int          bands_shift,      // сдвиг относительно цены 
   int          applied_price,    // тип цены 
   int          mode,             // индекс линии 
   int          shift             // сдвиг 
   );
 

Параметры

........
mode

[in]  Индекс линии индикатора. Может быть любым из перечисленных идентификаторов линии индикаторов (0 - MODE_MAIN, 1 - MODE_UPPER, 2 - MODE_LOWER).




Reason: