Questions from a "dummy" - page 70

 
Expert:

Hello. Could you please tell me. Why do orders and trades have a ticket but positions don't?

And what is the difference between a ticket and an identifier?

RTFM
 
sergeev:
RTFM
))))))))))
 
sergeev:
RTFM
Oh... It's too big to find necessary information there quickly
 
Expert:
Oh... It's too big to find necessary information there quikly
And you take your time. )) You need to study it. And then it will be very quick and easy to find many answers to your questions. Have a look at the Trading Functions section for your question.
Документация по MQL5: Торговые функции
Документация по MQL5: Торговые функции
  • www.mql5.com
Торговые функции - Документация по MQL5
 
rlx:

Calling imported functions from ex5 library.

Explain please. Read https://www.mql5.com/ru/docs/runtime/imports

The system libraries (DLL) are loaded by operating system rules. If the library is already loaded (e.g. by another Expert Advisor, or even from another client terminal, running in parallel), then the reference is to the already loaded library.

How are ex5 libraries loaded?If the library is already loaded (e.g. by another Expert Advisor and even from another client terminal running in parallel),

And still: how to make only one instance of ex5 library be loaded.

And further EAs will connect only to this instance.

I have made a library.

#property library
static int      i=0;
int lib[10 000 000]; /// разделил пробелами для наглядности
int Get(void) export {return(i++);}

I have created an Expert Advisor, which includes the library.

#import "lib.ex5"
  int Get(void);
#import
void OnTick(){}

1. Not a single Expert Advisor is loaded. The terminal.exe process is 91,000 KB.

2. Connecting one Expert Advisor to EURUSD. Terminal.exe process -- 131 000 KB. (+41 MB).

3. I connect the same Expert Advisor (additionally) to GBPUSD. terminal.exe process - 171 000KB.(+41MB).

How by means of MT5 only (through classes or libraries or scripts, EAs, etc.) create access to specific data (that will dynamically change) jointly?

PS// Tried to do both

static  int lib[10 000 000]
Anyway, a different instance of the library is loaded for each EA.
 

rlx:

It still loads a different library instance for each EA.

It may be possible to implement this with global terminal variables. That is, both instances use the terminal's global variables for calculations.
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
  • www.mql5.com
Основы языка / Переменные / Глобальные переменные - Документация по MQL5
 
rlx:

Still: How can I make only one instance of ex5 be loaded.

And subsequent EAs will only connect to this instance.

I have made a library.

I have created an Expert Advisor, which includes this library.

1. Not a single Expert Advisor is loaded. The terminal.exe process is 91,000 KB.

2. Connecting one Expert Advisor to EURUSD. Terminal.exe process -- 131 000 KB. (+41 MB).

3. I connect the same Expert Advisor (additionally) to GBPUSD. terminal.exe process - 171 000KB.(+41MB).

How by means of MT5 only (through classes or libraries or scripts, EAs, etc.) create access to specific data (that will dynamically change) jointly?

PS// Tried to do both

It still loads a different library instance for each EA.

I think global terminal variables can help you, or write data to a file
 
tol64:
Maybe it can be implemented with global terminal variables. That is, both instances use global terminal variables for calculations.
sergey1294:
I think global terminal variables can help you, or write the data to a file

Thanks for the suggestion.

Maybe there are other ways.

 
rlx:

Thanks for the suggestion.

Maybe there are other ways.

I think there are no other ways to use the same data with different EAs, scripts and indicators
 
sergey1294:
I think there are no other ways of using the same data by different Expert Advisors, scripts and indicators

I wish I could.

For example, I made up such a variant. It cannot be implemented through global variables.

advisor.ex5

struct Info
  {
   uint      id;
   uint   info1;
   uint   info2;
   double info3;
  };
Info   test;
void OnTick()
  {
//---
   test.info3 = 78;
  }
bool  GetInfo(Info& massiv[]) export
  {
   ArrayResize(massiv, 10);
   massiv[0].id = 123;
   massiv[0].info1= 56;
   massiv[0].info3=test.info3;
   return(true);
  }

trader.ex5

struct Info
  {
   uint      id;
   uint   info1;
   uint   info2;
   double info3;
  };
#import "advisor.ex5"
  bool  GetInfo(Info& massiv[]);
#import
void OnTick()
  {
   Info req[];
   GetInfo(req);
   Print(req[0].info3);
  }

Passing the array!!! structures!! to another Expert Advisor that fills this array.

This code works correctly. BUT trader.ex5 does not link to an already running advisor.ex5, but creates another instance ofadvisor.ex5.

Документация по MQL5: Основы языка / Переменные / Глобальные переменные
Документация по MQL5: Основы языка / Переменные / Глобальные переменные
  • www.mql5.com
Основы языка / Переменные / Глобальные переменные - Документация по MQL5
Reason: