Errors, bugs, questions - page 2689

 
fxsaber:

Not needed. See Services.

Yeah, I haven't smoked them until now. Thanks for the idea.

 
Dmitri Custurov:

Web requests and sockets are understandable, but wss, for example, I understand it doesn't work.

This is a protocol - it has to be written in MQL on top of the socket API provided by the terminal. It can be "ripped off" from public implementations in other languages.

 
When EA sends an order, is there any way to catch this event from another EA and get the order data? No response from the server.
 
Dmitri Custurov:
When EA sends an order, is there any way to catch this event from another EA and get the order data? No response from the server.

From the magazine.

 
Andrey Khatimlianskii:

From the magazine.

Yeah, it's a crutch. But it could work. (chuckles): Thank you.

 

Not good, I get an error:

void OnStart()
  {
   int my_num=4444;
   uchar uchar_array[];
   StructToCharArray(my_num,uchar_array,0);
  }
code generation error           1       1

Making a "crutch" for a simple situation is necessary :( .

 
Aliaksandr Hryshyn:

Not good, I get an error:

You have to make a "crutch" for a simple situation :( .

There is no way int can be a structure. Correct error.

 
Nikolai Semko:

There is no way int can be a structure. Correct error.

Well, yes. It would just be logical to make it possible, for example, to add a similar function for simple types.

 
Aliaksandr Hryshyn:

Well, yes. It would just be logical to make it possible, for example, to add a similar function for simple types.

TypeToBytes does this uniformly.

 
Aliaksandr Hryshyn:

Well, yes. It would just be logical to make it possible, for example, to add a similar function for simple types.

I don't see the logic in that.
for simple types, firstly, you can do it like this:

void OnStart()
  {
   struct Int {
   int i;};
   Int my_num={4444};
   uchar uchar_array[];
   StructToCharArray(my_num,uchar_array,0);
   for (int i=0;i<ArraySize(uchar_array);i++) printf("char[%d] = %d",i,uchar_array[i]);
  }

secondly, yes:

void OnStart()
  {
   union _int {
   int i;
   uchar c[sizeof(int)]; };
   _int _i;
   _i.i=4444;
   for (int i=0;i<sizeof(_int);i++) printf("char[%d] = %d",i,_i.c[i]);
  }

and it's not all crutches

result in both cases:

2020.03.31 12:58:11.353 Test_StructToCharArray (EURUSD,M10)     char[0] = 92 
2020.03.31 12:58:11.353 Test_StructToCharArray (EURUSD,M10)     char[1] = 17 
2020.03.31 12:58:11.353 Test_StructToCharArray (EURUSD,M10)     char[2] = 0
2020.03.31 12:58:11.353 Test_StructToCharArray (EURUSD,M10)     char[3] = 0
17*256+92=4444
Reason: