Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1636

 
Alexey Viktorov #:
It was quite the opposite. In OnDeInit(), the Expert Advisor didn't have time to delete all objects by the loop. It was discussed here on the forum. The solution is unambiguous, to delete everything by prefix...

Isn't the prefix without a cycle?

 
Valeriy Yastremskiy #:

Isn't the prefix without a cycle?

int  ObjectsDeleteAll( 
   long           chart_id,   // идентификатор графика 
   const string     prefix,   // префикс имени объекта 
   int       sub_window=-1,   // индекс окна 
   int      object_type=-1    // тип объекта для удаления 
   );
ObjectsDeleteAll - Графические объекты - Справочник MQL4
ObjectsDeleteAll - Графические объекты - Справочник MQL4
  • docs.mql4.com
ObjectsDeleteAll - Графические объекты - Справочник MQL4
 
Alexey Viktorov #:

Oh, man... You know, it's just old times, you know?

Yeah, that's what I do. As a good rule of thumb, don't remove anything superfluous, just your own)

 
Alexey Viktorov #:
It was quite the opposite. In OnDeInit(), the Expert Advisor had no time to delete all objects by the loop. This has been discussed here on the forum. The solution is unambiguous, delete everything by prefix...

Exactly the opposite was true,ObjectsDeleteAll had no time to delete everything because it was interrupted by deinit)

while a simple loop deletes everything - the terminal is waiting for the program.


ps.ObjectsDeleteAll is the same loop, no different from the custom one.

 
How to work with a file in mql5 program without writing the file to disk, but to work only in RAM, to speed up. I want to transfer data from an mql5 program to a program on my computer.
 
pribludilsa #:
How to work with file in mql5 program without writing the file to disk, but to work only in RAM, to speed up. I want to transfer data from an mql5 program to a program on my computer.

Without writing to disk you can try BD SQLite, but I haven't done that and am not very confident of success. In general you need to experiment.

 
Alexey Viktorov #:

Without writing to disk you can try BD SQLite, but I haven't done that and am not very confident of success. In general you need to experiment.

Thanks.
 
Valeriy Yastremskiy #:

It is better to give the reason, about the displacement, well done, I wanted to write)

That's what I was counting on - either the person will want to think about the reason, or someone else will tell the person the second (third, fifth) time - it's easier to understand (especially if the person wants to understand it, shows interest)

 
Artyom Trishkin #:

The cycle for deleting must be reversed:

and this applies not only to deleting graphical objects, but in general to deleting any objects in the terminal lists.

Is it because objects are systematically stored in an array?

If you delete each group of objects separately by a cycle (ArrowDown and ArrowUp), they are deleted correctly from the chart.

for(ushort i=0; i < n_arrow_down ; i++) {
      Print("ObjectName ",ObjectName(i),", i-down = ",i);
      ObjectDelete("ArrowDown"+IntegerToString(i, 4, '0'));
    }
    for(ushort i=0; i < n_arrow_up ; i++) {
      Print("ObjectName ",ObjectName(i),", i-up = ",i);
      ObjectDelete("ArrowUp"+IntegerToString(i, 4, '0'));
    }
While the output of the cycles is the same as in the first case:
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 21
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 20
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 19
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 18
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 17
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 16
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 15
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 14
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 13
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 12
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName , i-up = 11
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0020, i-up = 10
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0018, i-up = 9
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0016, i-up = 8
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0014, i-up = 7
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0012, i-up = 6
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0010, i-up = 5
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0008, i-up = 4
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0006, i-up = 3
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0004, i-up = 2
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0002, i-up = 1
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0000, i-up = 0
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0017, i-down = 18
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0015, i-down = 17
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0013, i-down = 16
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0011, i-down = 15
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0009, i-down = 14
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0007, i-down = 13
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0005, i-down = 12
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0003, i-down = 11
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowUp0001, i-down = 10
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0018, i-down = 9
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0016, i-down = 8
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0014, i-down = 7
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0012, i-down = 6
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0010, i-down = 5
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0008, i-down = 4
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0006, i-down = 3
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0004, i-down = 2
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0002, i-down = 1
2021.09.30 15:15:59.721 2021.01.04 07:56:37  test EURUSD,M1: ObjectName ArrowDown0000, i-down = 0
 
MakarFX #:
Why do you need to delete through a loop?
I didn't know there was an ObjectsDeleteAll, and now I want to get to the bottom of it.