Discussion on the implementation of councillors.

 

Hello, I'm studying mql5 and it's been a long time since I could get off the ground. It's because everyone is writing programs differently, everyone is sure of his approach, and it's hard for beginners to understand which one is optimal.

I myself would like to understand and I think that the community would benefit from public discussion of the implementation of optimal solutions for typical EA blocks. For example, someone writes almost nothing in the initialisation, and someone fills this block very heavily. What checks an EA should or should not do. Virtual Takes and Stops or not, etc. The very ways of implementing the strategy are also interesting.

So, my suggestion is that if someone wants to share the knowledge. Then we can discuss the implementation, for example, on the example of nettler, or a simple Expert Advisor based on moving average, such as if there is a deviation from the average, then wait for the return to the average. Or any other strategy you would like to show. Post the code with comments on why you decided to write it this way.

Thanks in advance to those who decide to contribute to educating and improving the quality of the code in the open source community.

 
Ivan_Invanov:

Hello, I'm studying mql5 and it's been a long time since I could get off the ground. Because everyone is writing programs differently, everyone is sure of his approach, and it's hard for beginners to understand which one is optimal.

I myself would like to understand and I think that the community would benefit from public discussion of the implementation of optimal solutions for typical EA blocks. For example, someone writes almost nothing in the initialisation, and someone fills this block very heavily. What checks an EA should or should not do. Virtual Takes and Stops or not, etc. The very ways of implementing the strategy are also interesting.

So, my suggestion is that if someone wants to share the knowledge. Then we can discuss the implementation, for example, on the example of nettler, or a simple Expert Advisor based on moving average, such as if there is a deviation from the average, then wait for the return to the average. Or any other strategy you would like to show. Post the code with comments on why you decided to write it this way.

Thanks in advance to those who choose to contribute to educating and improving the quality of code in the open source community.

you have read all the articles on EA development on this site and you didn't think it was enough? and you are a literalist)

 
Aleksey Mavrin:

you've read all the articles on EA development on this site and you don't think that's enough? and you're a literalist)

I find it difficult to form a paradigm for program execution. Yes, I've seen this article on time reduction, it's very useful. But what's the use of reducing execution time of a single piece. When, for example, the solution approach itself slows down significantly in comparison to another solution approach. Are you sure there's no better way of writing EAs than you are. Congratulations, you must be of the highest level. Maybe you can show us a code example then?
 
Ivan_Invanov:
I find it difficult to form a paradigm for running a programme. Yes, I have seen this article on time reduction, it is very useful. But what's the use of reducing execution time of a single piece. When, for example, the solution approach itself slows down significantly in comparison to another solution approach. Are you sure there's no better way of writing EAs than you are. Congratulations, you must be of the highest level. Maybe you can show me an example of code then?
You do what you do. And you will develop your own paradigm in time.
 
Ivan_Invanov:
I cannot form a paradigm of program execution. Yes, I saw this article on time reduction and it is very useful. But there's no sense in decreasing running time of a separate fragment. When, for example, the solution approach itself slows down significantly in comparison to another solution approach. Are you sure there's no better way of writing EAs than you are. Congratulations, you must be of the highest level. Maybe you can show us a code example then?

Links to articles here are inserted automatically by keywords.

And I meant a lot of articles with ready-made Expert Advisors, where the authors explain the code especially for people like you. Have you looked at them? There are enough examples there.

The optimal way is a situational notion.

Your system approach is good.

Divide the process of EA creation into two stages:

1. algorithm

2. the code.

The main thing is to learn how to formulate the algorithm. And you can code in many ways, whichever is more convenient.

Are finite automata with several feedbacks familiar? If not, study the theory and you will get a better idea of where to start.

 
Ivan_Invanov:

Hello. I'm studying mql5 and it's been a long time since I could get off the ground. Because everyone is writing programs differently, everyone is sure of his approach, and it's hard for beginners to understand which one is optimal.

I myself would like to understand and I think that the community would benefit from public discussion of the implementation of optimal solutions for typical EA blocks. For example, someone writes almost nothing in the initialisation, and someone fills this block very heavily. What checks an EA should or should not do. Virtual Takes and Stops or not, etc. The very ways of implementing the strategy are also interesting.

I do not understand the point of the topic.

It is clear that every coder has its own preferences, its own principles, its own views on the program structure. You will have yours. To develop them, you need to write the code and test it. As you identify patterns and find errors you will form an idea of which program structure suits you best.

Specific implementations - in KodoBase, lots of options. Take any of them and explore, use and modify them.

What else do you need?

 
Georgiy Merts:

I don't understand the point of the topic.

It is clear that every coder has his own preferences, his own principles, his own views on the program structure. You will have your own. To work them out - you need to write code and test it. As you find out the regularities and errors you will form an idea of which program structure suits you best.

Specific implementations - in KodoBase, lots of options. Take any of them and explore, use and modify them.

What else do you need?

I'm looking at kodobase of course. I have no doubts about code of only one author, metaquotes, it's official developer. I am learning from him. The man there writes logically and uses built-in functions to the maximum extent. But he has very few Expert Advisors. In general, there is a lot of questionable code written by different authors, and it often happens that you look at the code and cannot understand why it has been written in such a way. Well, I'm surprised at how confident people are in these implementations. Maybe I'm too worried, of course. I should probably write it just to make it work, as they said here.

 
But it just seems to me that sooner or later there will be some kind of consensus in open source. After all, people write the same thing over and over again, just with variations. So why not make ready pieces and discuss them. Like here we have an implementation of a netflow generator and now it is brought up to optimum speed and functionality. I will do it. I just don't have enough knowledge to use the optimal solutions. I will now draw a scheme, and whatever comes first to mind, that will be it. Or I will borrow it from someone else with the same level of knowledge. But if we made examples of implementation, experienced and erudite people would join in, fix something, argue with each other and reach a consensus. In the end, everyone would get quality code, or at least an example to follow.
 
Ivan_Invanov:
But it seems to me that sooner or later there will be a consensus in open source. After all, people write the same thing from time to time, just with variations. So why not make ready-made pieces and discuss them. Like here we have an implementation of a netflow generator and now it is brought up to optimum speed and functionality. I will do it. I just don't have enough knowledge to use the optimal solutions. I will draw a scheme, and whatever comes to mind first, that will be it. Or I will borrow it from someone else with the same level of knowledge. But if we made examples of implementation, experienced and erudite people would join in, fix something, argue with each other and reach a consensus. In the end, everyone would get quality code, or at least an example to follow.

The idea is a good one. Igor Kim's base was very helpful at the time, thank him very much for his work :)

 
Ivan_Invanov:

Looking at the kodobase, of course. I have no doubts about the code from only one author, metaquotes, who is the official developer. I am learning from him. The man there writes logically and uses the built-in functions to the maximum. But he has very few Expert Advisors. In general, there is a lot of questionable code written by different authors, and it often happens that you look at the code and cannot understand why it has been written in such a way. Well, I'm surprised at how confident people are in these implementations. Maybe I'm too worried, of course. I should probably write it just to make it work, as they say here.

That's another matter.

Note that I sometimes look at my own code and fail to understand why it is written in such a particular place. That's why I try to comment on such fragments in great detail trying to mention all the subtleties. But still I regularly see that I haven't considered some things.

Moreover, I use the following code (to determine the type of execution), which was written by a very authoritative forum user:

ENUM_ORDER_TYPE_FILLING CSymbolInfo::GetTypeFilling(string strSymbol,ENUM_ORDER_TYPE_FILLING otfFilingType)
{
   #ifndef __MQL5__
      return(otfFilingType);
   #else // __MQL5__
      
   const ENUM_SYMBOL_TRADE_EXECUTION steExeMode = (ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(strSymbol, SYMBOL_TRADE_EXEMODE);
   const int iFillingMode = (int)::SymbolInfoInteger(strSymbol, SYMBOL_FILLING_MODE);

   return((iFillingMode == 0 || (otfFilingType >= ORDER_FILLING_RETURN) || ((iFillingMode & (otfFilingType + 1)) != otfFilingType + 1)) ?
         (((steExeMode == SYMBOL_TRADE_EXECUTION_EXCHANGE) || (steExeMode == SYMBOL_TRADE_EXECUTION_INSTANT)) ?
           ORDER_FILLING_RETURN : ((iFillingMode == SYMBOL_FILLING_IOC) ? ORDER_FILLING_IOC : ORDER_FILLING_FOK)) :
          otfFilingType);
  
   #endif // __MQL5__
};

I DO NOT UNDERSTAND how it works. Moreover, this forumer himself when asked said that he no longer remembers, it's just that this code has already been tested many times and can be trusted.

Well, if I get a chance to replace these stupid "questions" with real if statements, I'll figure out how to do it... For now...

 
It is better to make a block diagram and write directly with these blocks, I did so in the beginning, then you start using functions, but I only use other people's OOP. In general, you have to write in such a way that you can easily make changes to a piece of code without having to rewrite everything.
Reason: