Errors, bugs, questions - page 1168

 
TheXpert:

Ta maaa...

You have to put in a double from the long before the transfer. For global variable. It's not zero, it's just a random double, it can be 1.34*e-307 or 4.29*e+120, because it's got log bits.

After transferring unzip from dub to long.

That's it.

OK, you got it ;)

 
artmedia70:

OK, you got it ;)

Well I just don't understand what's unclear.

Double truncates the data, so you can't transfer long to double directly. But both are 8 bytes each, so you can transfer losslessly just using double as a container, which is what I did in the example.

 
TheXpert:

Well I just don't understand what is unclear.

Double truncates the data, so you can't transfer long to double directly. But both are 8 bytes each, so you can transfer losslessly just using double as a container, which is what I did in the example.

Andrey, I didn't understand the format of storing and displaying in GV of the terminal. It seemed to show graph ID, but it shows 0.
 
artmedia70:
Andrey, I did not understand the format of storage and display in the GV of the terminal. It seemed to show the graph ID, but it shows 0.

GV will show something resembling rubbish in appearance, this "rubbish" will turn into chart ID after reverse conversion.

The duble has its own data format, when tucking the long, we put on the duble format and use it just as 8 bytes of memory.

 
TheXpert:

GV will show something resembling rubbish in appearance, this "rubbish" will turn into graph ID after reverse conversion.

The duble has its own data format, when tucking the duble we put on the duble format and use it simply as 8 bytes of memory.

Yes, I've already figured that out, thanks.
 
Something I notice is that updating a library or resources plugged into some other script (indicator) causes it (the indicator) to recompile and reload the terminal. No demand! Is it a bug or a feature? P.S. It's about MT4.
 
artmedia70:

More of a question:

Looking for an existing GV of the terminal by name. Through it the ID of the chart on which the EA is running is passed to the indicator. The indicator hangs on another symbol. I.e., I want to pass to the indicator the ID of the chart the Expert Advisor is running on. I am looking for it like this:

This is what the terminal says:


I tried to read the variable. I put it directly to the string and put it to the journal, as well as in variables of different types - all the same. There's two differences.

What's wrong with that?

Read here https://www.mql5.com/ru/docs/basis/types/casting paragraph "Data conversion of simple structures".

Exactly your case. Doublets have much lower precision in _number_ of characters than longs. That's why you get this result with simple assignment.

But you can fully use 64 bits of a global variable to store _any_ information 64 bits long (like short strings 8 bytes long. Not to mention longs)

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
I have encountered the following problem. After restarting the terminal the indicator returns "strange" values from another timeframe when called from the EA.
The Expert Advisor is on M2, the indicator data is taken from M3.
1) There is a terminal restart at 14:40:
PE 0 14:39:50.524 Terminal
MD 0 14:40:06.009 Terminal MetaTrader 5 Alfa-Forex x64 build 930 started
II 0 14:40:06.586 Terminal OpenCL not found, install the latest OpenCL driver for better performance
JO 0 14:40:07.257 Experts expert FX_Money_Flow_v1_06 (EURUSD,M2) loaded successfully
Expert Advisor writes out the indicator values on the last and penultimate bar:
OF 0 14:40:11.540 FX_Money_Flow_v1_06 (EURUSD,M2) The value of indicator TF1: -1.#QNAN -1.#QNAN
already on the next bar the data is correct:
NJ 0 14:41:46.622 FX_Money_Flow_v1_07 (EURUSD,M2) value of indicator TF1: -0.02798411604597126 -0.04893498839583753
2) Second restart at 19:55:
CO 0 19:55:06.918 Terminal
RO 0 19:55:28.399 Terminal MetaTrader 5 Alfa-Forex x64 build 930 started
OP 0 19:55:28.992 Terminal OpenCL not found, install the latest OpenCL driver for better performance
RD 0 19:55:29.507 experts expert FX_Money_Flow_v1_07 (EURUSD,M2) loaded successfully
Again the same song:
PQ 0 19:55:38.168 FX_Money_Flow_v1_07 (EURUSD,M2) indicator value TF1: -1.#QNAN -1.#QNAN

But it does not work properly all the time:

KF 0 23:59:51.987 FX_Money_Flow_v1_07 (EURUSD,M2) Factor value TF1 indicator: -1.#QNAN -1.#QNAN


The M3 chart is open at this time and there is an indicator on it which shows everything correctly:
(time difference between terminal and logs is 5 hours, the screenshot refers to the second restart)
Files:
 
OBJ_LABEL does not seem to support UNICODE in MT4? I changed the value both programmatically and from the Label properties dialog: the symbol is inserted and displayed correctly in the dialog itself, but on the chart it appears as a question mark (?). The font is unicode, and in the dialogue of Label properties it is correctly selected in the drop-down list with fonts.
 
stringo:

Read here https://www.mql5.com/ru/docs/basis/types/casting paragraph "Data conversion of simple structure types".

This is exactly your case. Doublets have much lower precision in _number_ of characters than longs. That's why you get this result with simple assignment.

But you can fully use 64 bits of the global variable to store _any_ information 64 bits long (like short strings 8 bytes long. Not to mention longs)

Yes, I've read it, thanks.