Learning and writing together in MQL5

 

I suggest that those who would like to try and learn FIVE together.

Unfortunately, in the main branch, where beta testing is going on, there is little help in learning a new language.

There is really testing for bugs and the branch is intended for PROFISERS.

For the other 90% of programmers I suggest to discuss more "understandable" topics.

I will begin by saying that I have started to rewrite one very handy indicator for A, but I have faced many problems that required brainstorming.

The first problem is that now it is impossible to implement the approach used in the 4 indicators in 5.

I have to implement everything through Expert Advisor. I am attaching it for reviewing and accepting suggestions (not for criticism :-). The description of what has been implemented and what will happen, a bit later.

So far I have managed to implement in it 15% of what was in Quartet.

Briefly, what I am trying to implement:

1) Struggle with the 3/5 mark. For those who trade on "adult" fifth sign is like a fifth leg for a dog. Personally, it gets in my way. I optimize displaying of information and management of positions and orders as if there were 4 of them

2) To display all possible information on instruments, orders, etc. directly on the chart. Very convenient and clear, especially for F11.

3) Graphical display of positions and trades of the current instrument on the chart, as well as information on all positions in the lower left corner

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов - Документация по MQL5
 

The topic is closed, I don't know how or if I can delete it?

 

Please test the following script to remove trend lines (code presented in 2 variants):

void OnStart()
{ bool ticket;string name;int obj_total=ObjectsTotal(0,0,OBJ_TREND);
for(int i=0;i<obj_total;i++){
name = ObjectName(0,i,0,OBJ_TREND);
ticket=ObjectDelete(0,name);
if(!ticket){Alert("Delete TrendLine error #",GetLastError());return;}
}/for(int i=0;i<ObjectsTotal(0,0,OBJ_TREND);i++)
}

and another variant:

void OnStart()

{ bool ticket;string name;int obj_total=ObjectsTotal(0,0,OBJ_TREND);int i=0;
while(obj_total>0){
name = ObjectName(0,i,0,OBJ_TREND);
ticket=ObjectDelete(0,name);
if(!ticket){Alert("Delete TrendLine error #",GetLastError());return;}
obj_total=ObjectsTotal(0,0,OBJ_TREND);i++;
}//while
}
For some reason, for example out of ten lines, it deletes several and hangs. In MT4 everything works - all are deleted and instantly.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Типы объектов - Документация по MQL5
 

In general, both are wrong. It is advisable to organise the traversal of objects in any list from the end. I don't write the word "always", because there may be cases when it is not so.

A wish: make the code correctly, use the Ctrl+ key combination in MetaEditor 5 for code formatting (simultaneous pressing of Ctrl and comma), then it will be better readable. Try this option:

 void OnTick()
  {
//---
   void OnStart()
     {
      bool ticket;
      string name;
      int obj_total=ObjectsTotal(0,0,OBJ_TREND);
      for(int i=obj_total-1;i>=0;i--)
        {
         name=ObjectName(0,i,0,OBJ_TREND);
         ticket=ObjectDelete(0,name);
         if(!ticket)
           {
            Alert("Delete TrendLine error #",GetLastError());
            return;
           }
     }
//---
  }
MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • 2010.02.23
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
 
Rosh :

In general, both are wrong. It is desirable to traverse the objects in any list from the end. I don't write the word "always", because there may be cases when it is not so.

A wish: make the code correctly, use the Ctrl+ key combination in MetaEditor 5 for code formatting (simultaneous pressing of Ctrl and comma), then it will be better readable. Try this option:


Thank you. It works. As for the layout - I indent the code as well. In this particular post, I inserted the code as plain text, so it's not indented.

MQL5.community - Памятка пользователя
MQL5.community - Памятка пользователя
  • 2010.02.23
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
 

And perhaps this akazija:

//+------------------------------------------------------------------+
//||

//+------------------------------------------------------------------+


replace with:

/*------------------------------------------------------------------+

//+----------------------------------------------------------------*/


As they are inserted automatically, it is very inconvenient to edit them later (add new lines)

Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
  • www.mql5.com
Основы языка / Типы данных / Целые типы / Символьные константы - Документация по MQL5
 
Boroff :

And perhaps this akazija:

//+------------------------------------------------------------------+
//||

//+------------------------------------------------------------------+


replace with:

/*------------------------------------------------------------------+

//+----------------------------------------------------------------*/


As they are inserted automatically, it is very inconvenient to edit them afterwards (add new lines)


You can edit the template right in the unitor, for example:

...\mt5\MQL5\Templates\Expert.mqt

(do not prevent to save a copy, for example under Russian name Expert.mqt)



SZS: By the way, a question to the developers.

In addition to #header#, is it possible to add #filename#?
so it would be easier and more flexible to shape the header to your needs...

 

You can change the template to suit your needs, for example:

...\mt5\MQL5\Templates\Expert.mqt

(do not prevent to save a copy, for example, under the Russian name Expert.mqt)

I haven't found such directories and files, or do I have to create them myself?

 
vdv2001 :

You can change the template to suit your needs, for example:

...\mt5\MQL5\Templates\Expert.mqt

(do not prevent to save a copy, for example, under the Russian name Expert.mqt)

I have not found such directories and files, or do you have to create them yourself?


They are there!

You have to put a tick in the context menu "Show All Files".

Learn the basics. ;)

 
kombat :


They are there!

You must put a tick in the context menu "Show All Files".

Learn the math... ;)


Yeah, and search the whole drive too... it could all be in the most unexpected place :)
 
Please send me an example of this file... I searched all over the computer, I couldn't find any mqt files :(