Download MetaTrader 5
To add comments, please log in or register
You sell neither signals nor apps? No problem, everyone can make profit!
Ingvar Engelbrecht
4438
Ingvar Engelbrecht 2014.02.13 12:48 

 Working on class to send trade information from a MT5 EA to an MT4(Latest) EA using named pipes.

 I am using the tick server example as a guidance. So I am planning to use a struct like this to send the info:

 struct TradeInfo
 {
   string symbol;
   datetime  timestamp;
   double price;
   double TP;
   double SL:
   double size;
 }

To use this I need to supply the length of the struct. How do I calculate that?

Alain Verleyen
Moderator
30323
Alain Verleyen 2014.02.13 12:51  

Hello,

Please use the SRC button when you post code. Thank you.


Can you edit your message please.

Alain Verleyen
Moderator
30323
Alain Verleyen 2014.02.13 13:13  
ingvar_e:

 Working on class to send trade information from a MT5 EA to an MT4(Latest) EA using named pipes.

 I am using the tick server example as a guidance. So I am planning to use a struct like this to send the info:


To use this I need to supply the length of the struct. How do I calculate that?

Thank you for editing.

The solution is here ...

Documentation on MQL5: Language Basics / Operations and Expressions / Other Operations
Documentation on MQL5: Language Basics / Operations and Expressions / Other Operations
  • www.mql5.com
Language Basics / Operations and Expressions / Other Operations - Documentation on MQL5
Ingvar Engelbrecht
4438
Ingvar Engelbrecht 2014.02.13 13:23  
angevoyageur:

Thank you for editing.

The solution is here ...

  That is simple  :-)

  Thanks.

  Since one of the variables is string and the size is calculated at compilation time it seems proper to prime the string

  with a symbol name before getting the length by "sizeof"

/
To add comments, please log in or register