Errors, bugs, questions - page 2111

 
Vladimir Pastushak:

All within normal limits...


There was something similar once when an indicator was reading data from a file into an array, but I can't remember now...

 

Created an order waiting for

MQL5: Error
Unprocessed, Started: 2018.01.24 16:17, #1940209

Terminal version and bit mode

64 1755

Problem description

Not unloading indicator,

I install indicator, indicator works, I remove indicator, indicator is removed and it is not in the list, but it works draws objects as if it has not been removed, it is not in the list.

I reopen the chart, it works even if the chart of another symbol.

It's been working for about 10 minutes, no looped cycles, everything is in the normal range, I attached the code...
 

A compile-time error

#define \
    MACRO
In addition, it was expected that line feeds would work in ALL directives
 
Vladimir Pastushak:

Created an order waiting for

MQL5: Error
Unprocessed, Started: 2018.01.24 16:17, #1940209

Terminal version and bit mode

64 1755

Problem description

Not unloading indicator,

I install indicator, indicator works, I remove indicator, indicator is removed and it is not in the list, but it works draws objects as if it has not been removed, it is not in the list.

I reopen the chart, it works even if the chart of another instrument.

It has been working for about 10 minutes, no loops, everything is in the normal range, I attached the code...

The same problem

 
Evgeny Belyaev:

Same problem


Recursion?

 
Evgeny Belyaev:

Same problem


IndicatorRelease();

 

Error during compilation

int  TerminalInfoInteger( 
   int  property_id      // идентификатор свойства 
   );

Attachment needs to be compiled

Where did I get such "spaces"? There are a lot of them here https://www.mql5.com/ru/docs/check/terminalinfointeger. I copied the fragment in Microsoft Edge with my mouse

Документация по MQL5: Проверка состояния / TerminalInfoInteger
Документация по MQL5: Проверка состояния / TerminalInfoInteger
  • www.mql5.com
Проверка состояния / TerminalInfoInteger - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
Files:
Error157.mq5  1 kb
 

Confusing macro highlighting - context-independent

//вариант A
#ifdef   MACRO //1
#endif
#define  MACRO //2
#ifdef   MACRO //3
#endif
#undef   MACRO //4
#ifdef   MACRO //5
#endif

either always present (option B) or always absent (option A)

//вариант B
#ifdef   MACRO //1
#endif
#define  MACRO //2
#ifdef   MACRO //3
#endif
//#undef  MACRO //4
#ifdef   MACRO //5
#endif
It was expected that if a macro was defined in a particular string it would be highlighted, if it was not defined it would not be highlighted. Otherwise it is not clear what presence/absence of highlighting means
 

Highlighting C2C++ files in MetaEditor

https://www.mql5.com/ru/docs/basis/preprosessor/constant

Макрос __MQL5__  доступен при компиляции файла *.mq5, при компиляции *.mq4 доступен макрос __MQL4__.

These macros (and also __MQL__) are not expected to be available when highlighting files with .c, cpp, .h extensions

//Test.h
#ifndef __MQL__
#define  MACRO
#endif
//Test.mq5
#include "Test.h"
#ifdef  MACRO //не подсвечивается... нормально
#endif
//Test.cpp
#include "Test.h"
#ifdef  MACRO //не подсвечивается... но этот .cpp файл не предназначен для компиляции в MetaEditor,
             //а компилируется в С\С++, где макрос __MQL__ не является предопределенным
             //в результате подсвечивается то что не должно и наоборот не подсвечивается что должно
#endif

This is a case (like the previous one) where incorrect, misleading highlighting is much worse than the lack of it

Документация по MQL5: Основы языка / Препроцессор / Макроподстановка (#define)
Документация по MQL5: Основы языка / Препроцессор / Макроподстановка (#define)
  • www.mql5.com
Директива #define подставляет expression вместо всех последующих найденных вхождений identifier в исходном тексте. identifier заменяется только в том случае, если он представляет собой отдельный токен. identifier не заменяется, если он является частью комментария, частью строки, или частью другого более длинного идентификатора. expression...
 

I've repeatedly encountered discussion on the forum of users about MetaEditor's lack of a predefined macro similar to _WIN64. The administration's answer was that there is no need because MetaEditor generates universal 32-64-bit code at the same time.

At the same time, many people use the https://www.mql5.com/ru/forum/225498/page2#comment_6401835 alignment by appending the fields to the structure

And indeed, if you use a ready-made .dll (which cannot be changed anymore), you cannot do without additional alignment. But in x86 and x64 this addition may look different, which means that the _WIN64 analog is still needed because the structure is defined at the stage of compiling .mq5 file where TerminalInfoInteger( TERMINAL_X64 ) does not work

//Test.mq5
#ifdef _WIN64
#define  ALIGN (8-2) //добавить к элементу структуры 6 байт
#else
#define  ALING (4-2) //добавить к элементу структуры 2 байта
#endif

Now we have to keep extra information in mind. As a result of saving on a trifle, there is a risk of getting an elusive error

Передача структуры в dll C++
Передача структуры в dll C++
  • 2018.01.26
  • www.mql5.com
Пишу dll, которая будет выполнять логику, и собственно возник вопрос. Можно ли передавать в dll структуру данных? Т.е...
Reason: