Errors, bugs, questions - page 1628

 
HistoryOrderGetInteger(OrderTicket, ORDER_TIME_DONE_MSC ) - returns zero in the tester!
 

Error in opening a file by the examiner. And if for example

1. remove "some irrelevant code" (see below)

2. or remove ::Sleep(1000)

there is no error

//Test.mq5
#import "Test001.ex5"
        string f( string file );
#import
string __Period() { return StringSubstr( EnumToString((ENUM_TIMEFRAMES)Period()), 7 ); }
void OnInit()
{
        Print( Symbol(), ",", __Period(), ", результат=", f( "test.txt" ));
}

Sequence of actions:

1. Create a new profile (e.g. "Test")

2. open two new charts attaching the Test.ex5 Expert Advisor to both of them (see picture)

4. Select any other existing profile

5. Select "Test" profile

result:

With Test001.mq5 looking like this:

//Test001.mq5
#property library
//---
//здесь некий код не имеющий отношения к делу
//---
string f( string file ) export
{
        ::ResetLastError();
        int hFile = ::FileOpen( file, FILE_READ | FILE_SHARE_READ | FILE_TXT | FILE_ANSI | FILE_COMMON );
        if ( hFile == INVALID_HANDLE )
                return ::StringFormat( "Error(%d): Не был открыт файл: %s", ::GetLastError(), file );
        ::Sleep( 1000 );
        ::FileClose( hFile );
        return "OK";
}
Files:
Test001.ex5  16 kb
 

The test.txt file itself is not attached to the message, but looks like this

Additional information: location of the file to be opened in the sense of FILE_COMMON - does not affect the error

 
Andrey Barinov:

This is code optimization.

If in metaeditor.ini in [Experts] field write OPTIMIZE=0, then compilation speed will be like in 4. I have some projects compile in 20 sec. and some go into infinite optimization loop :)

Wow, thanks buddy! Where were you before! ) And we were agonizing here... The strangest thing is that the developers didn't say anything about this option
 
Alexey Navoykov:
Wow, thanks mate! Where have you been before! ) And here we are suffering ... The strange thing is that the developers were silent about this option.

Not silent. There's an 18 page topic on the forum where this option was just described.

By the way, optimization is not enabled when compiling for debugging.

 
Andrey Barinov:

This is code optimisation.

If in metaeditor.ini in [Experts] field write OPTIMIZE=0, then compilation speed will be like in 4. I have some projects compile in 20 sec, and some go into infinite optimization loop :)

Exactly! That said, I set it to 1 myself some time ago and just forgot about it. ))

Alexey Navoykov:
... And we're still struggling here... The strange thing is that developers didn't say anything about this option

The topic was discussed in details:Testing of a new MQL5 compiler for x64 platforms - speed-up from 2 to 10 times!>>>

>>> I forgot about it. )

I didn't even have this optimization working at first. I.e. compilation would fail in some cases. But then I managed to find the reason. Then it was fixed and I set the parameter to 1 in one of terminals and forgot about it. And yesterday I was sitting and wondering why in one MT5 editor the compilation is much faster than in another MT5 editor.

//---

Now, if I set it to 0, the compilation is ~25 times faster.

0 error(s), 0 warning(s), compile time: 668 msec                1       1
 
Anatoli Kazharski:

Of course, my most complex projects in MetaTrader 5 also take a long time to compile. It even takes up to 11 seconds. Exactly the same versions, but in MetaTrader 4 can be up to 25 times faster.

In MT5, the compiler is more advanced and optimizes the code so that it runs up to 10 times faster than in MT5. We have written about it and explained it before.

The MQL5 compiler has to create two copies of the code for compatibility - for the old 32-bit version (without full optimization) and the maximally optimized version for 64 bits. The full power of MQL5 is revealed only in 64 bits.

 
Renat Fatkhullin:

The MT5 compiler is more advanced, it optimises the code so that it runs up to 10 times faster than MT5.

In addition, the compiler has to create two copies of the code for compatibility - for the old 32-bit version (without full optimization) and maximally optimized version for 64 bits. The entire power of MQL5 is revealed only in 64 bits.

Thank you. I've already refreshed my memory on the thread where all this was discussed.

I will set it to 0 for the time of development since I often have to perform compilation and it is very tiresome to wait for 10 seconds. And for the final product before the final compilation, I will put 1.

 
Renat Fatkhullin:

In MT5, the compiler is more advanced and optimises the code so that it runs up to 10 times faster than in MT5. We have written and explained this before.

The MQL5 compiler has to create two copies of the code for compatibility - for the old 32-bit version (without full optimization) and the maximally optimized version for 64 bits. The full power of MQL5 is revealed only in 64 bits.

If theOPTIMIZE parameter is changed when MetaEditor is running, does it need to be reloaded to accept the settings or not?
 
coderex:
if theOPTIMIZE parameter is changed when the MetaEditor is running, does it need to be reloaded to accept the settings or not?
It's quicker to try it yourself. I have just tested it. It is not necessary to restart the editor.
Reason: