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

 
DanilaMactep:

Good afternoon, all. Could you please tell me which function or other way to write a variable value to an excel file? That is, I want to collect the values of the variables at the moments I need in the form of a table in excel file. It is not possible to do it manually, because it is not possible to switch the timeframe during the test. So how can I automatically take the values I need to write to the excel file in order to open it(excel file) at the end of the test and analyse the results? P/S if there is such information in the form of video tutorial then please share the video...

You can borrow it from me:
https://www.mql5.com/ru/code/30455
There CSV_fast.mqh

 
Aliaksandr Hryshyn:
You can get it from me:
https://www.mql5.com/ru/code/30455
There CSV_fast.mqh

Thanks - I'll see what kind of cult you have there;-)
 
DanilaMactep:
Thanks - I'll see what kind of sect you have there;-)

The sect of the monks of St Opinus

 

Greetings. Can you give me a hint?

An Expert Advisor creates objects with "RED-LINE" in their names.

The task: when OnDeinit deleteobjects whose names contain "RED-LINE".

I do this:

void DeleteVisual(){
   for (int i=ObjectsTotal(0, 0, -1)-1; i>=0; i--){
      if(StringFind(ObjectName(0, i, 0, -1), "RED-LINE")>-1 ) {
            ObjectDelete(0, ObjectName(0, i, 0, -1));
      }      
   } 
}

If there are not many objects, everything is OK. If more than a certain amount, then not all are removed, and the log gives out"Abnormal termination".

What am I doing wrong?

 

Andrei, do you not want to use template-based deletion? Put "RED-LINE" at the beginning of the name, and things will be easier.

Deletes by name prefix in the sub-window of the chart all objects of the specified type.

int  ObjectsDeleteAll(
   long           chart_id,   // идентификатор графика
   const string     prefix,   // префикс имени объекта
   int    sub_window=EMPTY,   // индекс окна
   int    object_type=EMPTY   // тип объекта для удаления
   );
 
Andrey Sokolov:

What am I doing wrong?

You're reading the documentation wrong.

int  ObjectsDeleteAll( 
   long           chart_id,   // идентификатор графика 
   const string     prefix,   // префикс имени объекта 
   int    sub_window=EMPTY,   // индекс окна 
   int    object_type=EMPTY   // тип объекта для удаления 
   );
 
Alexey Viktorov:

Man, this branch has got it all, I'm going to get some air ;)

 
Aleksei Stepanenko:

Man, this branch has got it all, I'm going to get some air ;)

Yeah... try to outrun you... ;)))

 
.
 
Aleksey Stepanenko,Alexey Viktorov

there "RED-LINE" is not prefixed, but in the middle of the name. Is it possible to organise deletion with "RED-LINE" not in the prefix? How can I do it?

Reason: