Interview with Stanislav Starikov: Features of New MQL5 - page 8

To add comments, please log in or register

stringo wrote:

2008.05.29 17:15

ukt, there are "global_initialization" and "global_deinitialization" functions in addition to custom init and deinit functions.


global_initialization called once after loading program. global and static variables are initialized, constructors of global and static objects are called.

global_deinitialization called once before unloading progfam. destructors of global and static objects are called, global and static dynamic arrays are destroyed.


Custom deinit function can not call global destructors, but can explicitly resize to zero global dynamic arrays.

Custom init function can not call global constructors, but can explicitly reinitialize global variables.

Static variables is matter of theyr functions. Only static variable's owner function can explicitly change this static variable.

2008.05.30 09:55

ukt, prodolzhaem razgovor. We continue discussion.

It will be special function "DeinitializeAll". This function calls global deinitialization routine and sets critical error "forced deinitialization". You can call this function from custom deinit after deinit reason analyze. You can call this function from any your function. But in this case EA's functions (start, OnSomeEvent, deinit and so on) cannot be called. First custom init function must be called.

stringo, tbh - this is for me all very confusing. Why? there is much here that is hidden regards why these functions added and how/when should be used and the implications of so doing.

Like the current behaviour of MT4 regarding uninit reasons and static memory - what is now being said, does not deal with the original point raised.

The added [automatic global_[init|deinit]ialization] functionality for OOD is required yet the added complexity in the init/deinit features are imho still not dealing with original point.

More functionality but what for? The uninit reason issue still there.

Please can you expose your thinking as to why deinit must make such decisions about EA memory?

DeinitializeAll: why needed if global_deinitialization called at unloading?

Is and when is - custom deinit() called: before/after DeinitAll ?

global init sets up global,static memory. Why does global deinit not unset global,static memory?

yet... is stated that global deinit destroys global,static arrays - so why would custom deinit need to resize to zero?

and how can custom deinit access/resize if global deinit destroys?

am confused...

Design more complicated, no reasons given as to WHY more layers of complication and still no clear picture of the clearing up of original point raised about static memory not always being reinitialized when deinit() called. Appears MQL4 design decisions in this area are being propagated to MQL5 and being further complicated with new features.

This all infers that there is no exposed reasoning to new features and why original point raised has not been dealt with?

Either EA global and function static memory is reinitialized or not... that is simple functionality, yes?

I believe your comments still leave this area unanswered...



Hi Stringo,

In my feeling as a EA Developer, it seems optimization is a major problem of MQL4. This is a product of having to wait for price tick before EA is run, This problem could be amicably resolved if MQL5 could come up with an option setting to run EA BASED ON INCMING TICKS or ON TIME INTERVAL e.g. 1sec, 1min, 5min, etc So that developers could choose which way ones EA should be initialized!

With this in proper place, I passive a major breakthrough for scholarly EAs to improve on performance optimizations.


interface to C# dll

MetaEditor is associated with MQL presently

Is support taking requests associated with this item on this thread?


so then, when is MQL5 and supporting environment hitting the beaches?

are you intending to alpha,beta,xyz test it before release?

surely support can give a guesstimate - how about a resolution no finer grained than which half of a xx year for instance?

I say above as no reason to expend further energies on this thread is there?

MetaQuotes gives 100% signal that design cast in concrete... as the saying goes resistance is futile - You WILL be assimilated!

I think beta testing will be


As of this post, MQL4 uses 9 pre-defined timeframe constants.

I require to know if this number will be larger in future MetaTrader versions ?


The video (first post here) seems to be broken.

Hi Stani,

I am a professional trader and privat fund manager now for 12 years.

I worked with Metastock and Amibroker for many years.

They have their advanteges but also strong disadvantages.

I learn to apreciate MT4 very much for severall reasons. But if I can make a strong sujestion that makes a world of difference on the resultsof a trader that uses

systems-(indicator) that are programmed and build up by severall indicators, is that it looks to time and NO LONGER waiting for a new tick to come in before it realizes that a bar is finshed and that it must give a signal on a new bar.

A chart should be build up by PRICE (bid and ask price on that moment) not by new ticks that come in.

Specially systems that work on very short time frames like a 1min chart and give many signals in a day suffer enormously by the slipage that is generated by waiting for new ticks to come in instead of telling the trader that a 1min bar is finished based on time and not on a new tiick that comes in 15seconds after a new bar is made.

You are a programmer but you need to understand that a trader wants get in as quickly as possible on the CLOSE of a bar and if he needs to wait with a trend following system on the new tick of a new bar that this will be most of the time a worse price because price start to move a way from the close of the intial bar where normally the signal needed to be given .

Maybe this was already sujested to you or maybe this feature is already implemented.

Metastock has also the possibility to let a bar be finshed based on the time of the data server or based on the time of computer of the user. Wich most people do. They install a iittle program as Dimension4 that updates every 15min to an atom clock. This way a trader knows that the CLOSE of a bar will be precisly on time and the OPEN of a new bar will be PRECISLY on time.

And that a signal will be given based on the CLOSE of bar and not when price start to MOVE away from you.

friendly regards...iGoR

Please add debugging feature to MQL. Thanks.
To add comments, please log in or register