Errors, bugs, questions - page 507

 
sergey1294:
A trade has no closing time because a trade is a transaction and it has an execution time HistoryDealGetInteger(ticket,DEAL_TIME).If a trade has caused closing of a position, then this will be the time of closing the position. But it is strange that the PositionGetInteger function has the identifier POSITION_TIME - position opening time, but it does not have the position closing verification.
There is nothing strange from the netting point of view. The open time is the time of the first trade, and God knows what happens next...
 

Hello, I'm downloading history for all instruments (over 600, BroCo-Demo server), around the 300th character the terminal logs writes:

NI 0 Scripts 12:19:11 script Download_history (EURUSD,H1) loaded successfully
MJ 3 MemoryException 12:24:20 31703040 bytes not available
EE 3 MemoryException 12:24:20 31703040 bytes not available
NM 3 MemoryException 12:24:21 31703040 bytes not available
HD 3 MemoryException 12:25:15 245760 bytes not available
LL 3 MemoryException 12:25:15 245760 bytes not available
PG 3 MemoryException 12:25:15 245760 bytes not available

DN 3 MemoryException 12:25:15 245760 bytes not available

I downloaded the history using the script described in section "Organizing access to the data" (I changed it a little bit - in other way it worked for currencies only) I attach the script code

Files:
 

Can you tell me if, for example, we have a :

Class cClass()

{

Public:

cClass2 *pointer;

void fn() { pointer = new cClass2; }

~Class()

{

delete(pointer);// is this line needed here???

}

}

OnTick()

{

{

cClass var;

} // Here dynamically allocated memory will be free without delete?

}

I.e. when the class is destroyed, is the dynamically allocated memory within the class freed?

 
220Volt:

Can you give me a hint, for example we have a :

I have a destructor that is roughly the same layout and works. The only thing is that we need to check the descriptor for invalidity (or rather, for lack of it) before accessing it.

There's also Roche's article on using pointers, there's a lot to look at.

 

I have a class that works with a dynamic array, no deleuthing in the destructor, no errors, but I'm hesitant.

Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5
 
220Volt:

I have a class that works with a dynamic array, there are no delays in the destructor, no errors are generated,

So the memory occupied by the object is not freed.

When I experimented on this, I had messages in the log after closing the program about not freeing memory (or something like that).

And the standard Achtung:

An object created with the new operator must be explicitly destroyed with the delete operator.

 

I understood why I was hesitant, arrays cannot be deleted via delete, that's why I didn't delete them. I've been messing around in C, that's why all sorts of nonsense started coming into my head.

 
220Volt:

I understood why I was hesitant, arrays cannot be deleted via delete, that's why I didn't delete them. I've been messing around in C, that's why all sorts of nonsense started coming into my head.

Ahem. I thought that when speaking about"dynamic arrays" you meant "dynamic objects" and descriptors associated with them. Judging from the beginning of the thread about classes and descriptors.
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5
 

My bad :(

Thank you.

 
220Volt:

My bad :(

Thank youcf