Errors, bugs, questions - page 3069

 

I'm sure the question has been asked before, but I couldn't find it.

Have a script

void OnStart()
  {
   uchar uchar0 = 0;
   uchar uchar1 = 1;
   Print(uchar0 - uchar1);      //-1
   Print(0 - uchar1);           //-1
   Print(-uchar1);              //255
   Print(typename(-uchar1));    //int
   Print(-(int)uchar1);         //-1

   ushort ushort0 = 0;
   ushort ushort1 = 1;
   Print(ushort0 - ushort1);      //-1
   Print(0 - ushort1);           //-1
   Print(-ushort1);              //65535
   Print(typename(-ushort1));    //int
   Print(-(int)ushort1);         //-1

   uint uint1 = 1;
   Print(0 - uint1);           //4294967295
   Print(-uint1);              //4294967295
   Print(typename(-uint1));    //long
  }

Please explain:

1. Why does 0-uchar1 (and uchar0-uchar1) give a different result than (-uchar1)? After all, in operations with (u)char and (u)short types, the operands are automatically converted to int. And typename(-uchar1) returns int. (Same question for ushort1)

2. With uint the situation is different. -uint1 returns the expected result but typename(-uint1) returns long. Is this a typename bug?

 
guys tell me how many buffers.... were allocated per indicator in the old quad before version 506 now i know 512
 
ruslan:
guys tell me how many buffers.... were allocated per indicator in the old quad before version 506 now i know 512

By memory 64. Try to declare more than 100, if there were updates earlier there will be no error, if later it will give an error.

 
Valeriy Yastremskiy:

By memory 64. Try to declare more than 100, if there were updates earlier there will be no error, if later it will give an error.

Do you have a 225 terminal installer by any chance?
 
ruslan:
do you have the 225 terminal installer by any chance?

No most likely, since 18 here. The upgrade of 4k to 5k in terms of functionality took place between 14 and 16.

 
mktr8591:

I'm sure the question has been asked before, but I couldn't find it.

Have a script


Please explain:

1. Why does 0-uchar1 (and uchar0-uchar1) give a different result than (-uchar1)? After all, in operations with (u)char and (u)short types, the operands are automatically converted to int. And typename(-uchar1) returns int. (Same question for ushort1)

2. With uint the situation is different. -uint1 returns the expected result but typename(-uint1) returns long. Is this a typename bug?

Thanks for the post.

1. the operand type was indeed selected as the result type for the unary minus - fixed

2. we departed from the standard and the unary minus operation returns long type for uint type, because of the error in item 1 the result type remained uint type (not long)

 
Valeriy Yastremskiy:

By memory 64. Try to declare more than 100, if there were updates earlier there will be no error, if later it will give an error.

found 8 buffers there.... thank you
 

Now MQL5.com has Market first, then Signals and only then Forum. Previously, it was stipulated that for authorised users the Forum was at the top of the main page.


ZZY After this post, Forum will appear at the top. As soon as you delete this post, the Forum goes back to third.

 
fxsaber:

Now MQL5.com has Market first, then Signals and only then Forum. Previously, it was stipulated that for authorised users the Forum was at the top of the main page.


ZZY After this post, Forum will appear at the top. As soon as you delete that post, the Forum goes back to third.

I second that - Forum is more convenient first!

 

I can't manage to write a function that only outputs true in the EA when the focus switches to the EA chart.

Can you give me a hint if you've encountered one.


Not enough CHARTEVENT on losing and gaining focus.

Reason: