Errors, bugs, questions - page 127

 
xeon:
The compiler does not detect the absence of the second equal sign as an error.

It doesn't have to, your code doesn't contain an error.

int a = 0;
if(a=1){Print("TEST");}

and it is identical to this code.

int a = 0;
a=1;
if(a){Print("TEST");}
 
xeon:
The compiler does not detect the absence of a second equal sign as an error.
for(int i=0;i<total_deal;i++)
        {
         //--- try to get deals ticket
         if(ticket=HistoryDealGetTicket(i)) // Предупреждение к этой строке
           {
            Deal.Ticket(ticket);

But it gives a warning, at least for my code like this:

'DealInfo.mqh' DealInfo.mqh 1 1
expression is not boolean Shou History.mq5 60 19
0 error(s), 1 warning(s) 1 1
 
Urain:

It doesn't have to, your code doesn't contain an error.

and it's identical to this code.


And in vain, for example, the studio detects this code as an error.

Besides, then it would appear that this code

int a = 0;
a=1;
if(a){Print("TEST");}

is identical to this one:

int a = 19;
if(a=14){Print("TEST");}

let's say 0 = false, 1 = true, then what do the other digits equal? 2,3,4, ...... :-)

Imho this approach does not lead to anything good, adds only unnecessary possibility to look through the error.

 
xeon:

Imho, this approach does not do any good, it only adds an extra opportunity to view the error.

The reason for adding a non-boolean value is so that the user can see what they are doing.

 

If I save the set in the terminal (on the chart) and then open it in the tester or the terminal, everything is fine. But if I save it in the tester and then open it in the terminal, all values of variables of non string type are displayed in abracadabra. If I click OK, then when I open the parameter window again, it will look fine, all parameters will be replaced with new ones correctly, except for boolean ones. EVERYTHING that was troue becomes falsa... In the tester, the set saved from the tester opens correctly.

 

Sorry for the annoyance, the bug I wrote about earlier still hasn't been fixed. When running the indicator given in the description of the CopySpread function, the spread history is drawn with a hole. The hole always covers the period from when the terminal starts to when the indicator starts. It seems that the spreads coming from the server with each new tick are not recorded in the spreads history.Thank you!

 

I get warnings from the compiler:

implicit enum conversion
possible loss of data due to type conversion

when using this string:

ENUM_POSITION_TYPE posType=PositionGetInteger(POSITION_TYPE);

What's wrong here?

I found it: you should use long

long posType=PositionGetInteger(POSITION_TYPE);

Then another question. Will this construction work correctly

if(posType==POSITION_TYPE_BUY)

when posType is defined as long?

 
ENUM_POSITION_TYPE posType=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
 
gpwr:

I get warnings from the compiler:

implicit enum conversion
possible loss of data due to type conversion

when using this string:

What's wrong here?

I found it: you should use long

Then another question. Will this construction work correctly

when posType is defined as long?

will work, it's a type conversion warning, you can ignore it
 
AlexinSergey:

Sorry for the annoyance, the bug I wrote about earlier still hasn't been fixed. When running the indicator given in the description of the CopySpread function, the spread history is drawn with a hole. The hole always covers the period from the time the terminal is started to the time the indicator is started. It seems that the spreads coming from the server with each new tick are not recorded in the spreads history.Thank you!

Thanks, we'll deal with the example.
Reason: