Errors, bugs, questions - page 448

 

Question about implicit type conversion.

Can we use this construct?

int Value = 0;
...
if (Value) ...

Or should we still use an explicit type conversion?

int Value = 0;
...
if ((bool)Value) ...
Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Основы языка / Типы данных / Приведение типов - Документация по MQL5
 
voix_kas:

Question about implicit type conversion.

Can we use this construct?

Or should we still use an explicit type conversion?

I think so.
 
When upgrading from 470 to 478 the build 470 started again after agreeing to restart. After manual exit the update to 478 took place.
Log message "update 'C:\Program Files\MetaTrader 5\metatester.exe' failed [32]" and "failed to update terminal".
Files:
 
Ashes:
When upgrading from 470 to 478 after agreeing to restart, build 470 started again. After manually unloading, the update to 478 happened.
Log message "update 'C:\Program Files\MetaTrader 5\metatester.exe' failed [32]" and "failed to update terminal".

We know the problem - you have test agents installed as services, but they did not unload in time, so there was an error on their upgrade.

The terminal in this case postpones the update until the next start.

 

I can't see the bug in my code, it's written:

ObjectSetInteger(0, ID, OBJPROP_XOFFSET, x);

I print the name of the object ID and x are correct values, but in the chart it's in the upper left corner (0, 0) for some reason. What can it be?

P.S. Maybe it's not the equivalent of a quadruple call to ObjectSet(ID, OBJPROP_XDISTANCE, x) ? Then how to make an analogue?
 
marketeer:

I can't see the bug in my code, it's written:

ObjectSetInteger(0, ID, OBJPROP_XOFFSET, x);

I print the object name ID and x are correct values, but in the chart it's tucked in the upper left corner (0, 0) for some reason. What could be the problem?

P.S. Maybe it's not the equivalent of a quadruple call to ObjectSet(ID, OBJPROP_XDISTANCE, x) ? Then how to make an analogue?

OBJPROP_XOFFSET is used to position the displayed sprite within the image. This is explained in more detail in the exampleat Demo_BitmapOffset (OBJPROP_XOFFSET and OBJPROP_YOFFSET)

Most likely you need OBJPROP_XDISTANCE.

 
When calculating the amount of lots of closed trades in MT4, I came across the fact that OrderLots() for orders of the balance type returns 0.01. Is this a bug or a feature? How is it in MT5?
 
This is neither a feature nor a bug. You have to check the types of trades before counting volumes. There are other types of transactions in MT5 besides balance - be sure to read about them - some of them may appear in the history without the trader's actions.
 

Good afternoon, could you please tell me if it is possible to know which period buttons I have selected on the toolbar when running the program??? (for example, I have set M2, M10, H1)

Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Программы MQL5 / Выполнение программ - Документация по MQL5
 
marketeer:

A couple of questions.

1. Reading in the documentation:

StringSetCharacter

Returns a copy of a string with a changed character value at a specified position.

boolStringSetCharacter(

Either there is an error in the verbal description or in the declaration.

2. Trying to compile the string:

StringConcatenate(Indicator_Name, " ", Base);

I get an error about wrong number of parameters. The documentation says there should be at least 2 parameters in addition to the first one, and here there are only 3.

1. Here is a more correct description of the function(https://www.mql5.com/ru/docs/strings/stringconcatenate) for the moment the description corresponds to reality

2. We need more details. It is not reproducible.

Документация по MQL5: Строковые функции / StringConcatenate
Документация по MQL5: Строковые функции / StringConcatenate
  • www.mql5.com
Строковые функции / StringConcatenate - Документация по MQL5