Errors, bugs, questions - page 1509

 
Дмитрий Касаткин:
I can't access the platform, the website says web terminal is not supported by this MetaTrader Server. Please contact your broker to update server, the platform says no connection?
Your broker does not support web terminal. If the terminal is installed on your computer and there is no connection, you should open the port443 if it was closed before.
 
Dear developers, what is the order of the OnDeinit function - the order of deleting objects and other variables, clearing memory, etc.
 
coderex:
Dear developers, what is the order of the OnDeinit function operation - the order of deleting objects and other variables, memory clearing, etc.?

OnDeinit is an ordinary function in MQL4/5 that is called in certain situations. This is how you program it, so it will be.

Please be more specific in your question. What exactly are you interested in?

 
Slawa:

OnDeinit is an ordinary function in MQL4/5 that is called in certain situations. This is how you program it, so it will be.

Please be more specific in your question. What exactly are you interested in?

With objects that are explicitly deleted (created in the allocated memory), everything is clear. What I'm interested in is the process of freeing memory and deleting objects created in unattended memory.

I.e. there are, for example, two objects and a variable of a fundamental type:

class CFirst {...};
class CSecond {...};

int iVolume = 100;
CFirst first_obj;
CSecond *second_obj;

int OnInit(void) {
   second_obj = new CSecond();
// текст функции OnInit
}
void OnDeinit(const int reason) {
   if(CheckPointer(second_obj == POINTER_DYNAMIC)
      delete second_obj;
}

I am interested in what will be the order of memory freeing and deleting all objects, when the program is deleted.

 
Slawa:

...

When can the terminal freeze? - There seem to be normal situations where the terminal is supposed to hang.

From what I've seen, it always hangs (hangs for an indefinite period of time) when:

1. Connecting to a server.

2. P1. When switching between accounts.

3. While starting the terminal.

Last time I did this, the terminal froze on startup. I looked at task manager, terminal ate memory byte by byte, after a couple of minutes it ate all the 8 GB memory and operating system hung up together with the terminal. I had to press "reset" button on the system unit.

After restarting the computer I started the terminal and the history with hangs repeats, the system stopped responding to my frantic attempts to wake it up together with the terminal.

After restarting the computer I deleted all configuration files of the terminal, launched it - history with hangs again.

After restarting the computer, I deleted all the trade server history files and only after that the mobile computer started working normally, and only after some thought for about 3 minutes.

Terminal hangs from build to build. Win10x64.

 
Joo Zepper:

When can the terminal hang up? - There seem to be normal situations in which the terminal is supposed to hang.

According to my observations, the terminal always hangs (hangs for an indefinite period of time) when:

1. Connecting to a server.

2. P1. When switching between accounts.

3. While starting the terminal.

Last time I did this, the terminal froze on startup. I looked at task manager, terminal ate memory byte by byte, after a couple of minutes it ate all the 8Gb memory and operating system hung up together with the terminal. I had to press "reset" button on the system unit.

After restarting the computer I started the terminal and the history with hangs repeats, the system stopped responding to my frantic attempts to wake it up together with the terminal.

After restarting the computer I deleted all configuration files of the terminal, launched it - history with hangs again.

After restarting the computer, I deleted all the trade server history files and only after that the mobile computer started working normally, and only after some thought for about 3 minutes.

Terminal hangs from build to build. Win10x64.

The same wind, terminal runs only from admin, and all metaeditor files also from admin, no problems.
 

This is the first time I've encountered this kind of code, so I'm asking experienced experts how to divide code into parts and include files correctly

Here is an example

class WL : public C_Object
  {
private:
   MqlTick           tick;
   struct STRUCT_SYMBOL // Структура символа
     {    
      bool              TRADING_IS_ALLOWED;      // Обновлять
      double            INDIKATOR_VOLUME;        // Обновлять
     };
   struct STRUCT_WATCH_LIST // Структура сохраненных листов
     {
      string            NAME_LIST;
     };
   STRUCT_WATCH_LIST WatchList[];
   STRUCT_SYMBOL     SymbolMass[];
}

I.e. a class inherits from another class and has a structure; the structure in the example, I abbreviated it, and then there are methods of working with an array of the structure

I have 40-50 or maybe more of these methods.

I would like to move each method to the include file or arrange the code structure in some other way, so that I won't create 10 000-20 000 lines of code in the Expert Advisor itself that will be difficult to search for later.

The only thing I can see at present is sending an array of the structure by reference

like

func(STRUCT_SYMBOL & str)

It seems to me that this is not a good choice.

What can we do?

 
coderex:

I understand the process of deleting explicitly deleted objects (created in allocated memory). I'm interested in the process of freeing memory and deleting objects created in automatic memory.

For example, there are two objects and a variable of a fundamental type:

I would like to know what order of memory deallocation and deleting all objects will follow when deleting the program.

OnDeinit has nothing to do with this.

Have you read the documentation?

 
Vladimir Pastushak:
The terminal is run only from admin, and all meta-editor files are also from admin, no problems.
from the admin? or maybe the terminal should be given a hat with a cross, a golden apple and a staff, and be called the most Holy King of all Russia?
 
Vladimir Pastushak:

This is the first time I've encountered this kind of code, so I'm asking experienced experts how to divide code into parts and include files correctly

Here is an example

I.e. a class inherits from another class and has a structure; the structure in the example, I abbreviated it, and then there are methods of working with an array of the structure

I have 40-50 or maybe more of these methods.

I would like to move each method to the include file or arrange the code structure in some other way, so that I won't create 10 000-20 000 lines of code in the Expert Advisor itself that will be difficult to search for later.

The only thing I can see at the moment is sending an array of structure by reference

like

I don't think this is the best choice.

What can I do ?

If classes are capacious, it is better to create a separate listing for each class and in the code where the objects of this class are used, include the listing of the class through #include. The same applies to structures and function libraries. If the classes and structures are not capacious, you can include them in one listing. You can also create a listing of common defines and macros.

And do not be afraid that you will have a whole family of listings related to one program, it is common, I have in my trading systems used 15-20 listings, plus directories with .bmp and .gif for the interface. I distribute all the listings in separate directories. It's easier to navigate when catching errors and upgrading.

Reason: