Please insert all your codes correctly: it's impossible to look at this grey gloom. There is a clear plan of action: click on the button in the editor, insert the code in the resulting field. You stubbornly insert a canvas of text and then try to apply the "code" style to this canvas
It (the code) is not inserted correctly. One fragment can still be dealt with, but a bit more is already a pain...
I mean, it's not up to me - it's up to the webmasters. How, in 2019, with the abundance of funds, they have achieved this - a mystery :-)
But to make it more fun in the future, I will write more or less large posts in the wiki first, and then copy-paste them here and reduce the volume of the published code.
It (the code) is not inserted correctly there. One fragment can still be handled, but a bit more is already a pain...
I mean, it's not up to me - it's up to the webmasters. How, in 2019, with the abundance of funds, they have achieved it - it's a mystery :-)
But to have more fun in the future, more or less big posts will be written to the wiki first, and then transferred here by copy-paste and reduce the volume of the published code.
Apparently you have to copy the block of code now and paste it into Notepad
Then copy from Notepad and paste back, but before that create a new block for the "new" code
I created a basic template for the EA and made the strategy file separately.
Do you think it's easy for the user?
You still need a minimum knowledge of programming!
And no "help" instructions, videos, nothing saves you.
The user will then need you to pedal strategies for free.
And they will not read the help.
Apparently you should now copy the block of code and paste it into Notepad
Then copy from notepad and paste back, but before that create a new block for the "new" code
Took a bit of trouble, but sort of "coloured" it. :-)
A pebble (or rather a pebble) to the above webmasters: when pasting in the built-in editor, or rather obviously at the first "coloring", the editor ejects some part of the code it does not like. In particular, it arbitrarily edited "if ((ret=ea.OnInit())!=INIT_SECEED) {..}" . Apparently, the highlight algorithm believes that OnInit is the only one and it cannot be overloaded in the class.
of course, before proceeding at all, it is necessary to set "party line" and "target-communism" :
1) the user only needs 100 lines to implement the strategy. (apart from comments, input and other #property).
2) The number of new "entities" (functions/classes/methods/constants) for it should be minimized.
3) library must contain a countable number of files.
4) potentially suitable for GUI
5) expandable by plugins
3) What difference does it make how many files a library contains? 1, 10, 100, 1000? Everything should be made for the convenience of the developer. If he is comfortable placing everything in small files, feel free. If he/she is used to coding everything in one file, feel free. By and large it's not difficult to assemble a mega-file from a bunch of disparate automated means. So I wouldn't insist on this point.
4) GUI usable - it's not quite clear how it is. The library is an isolated layer of business logic in a mature way. This layer should not depend on the external GUI in any way. It's GUI should depend on this layer.
if (d_fast_ma==0) d_fast_ma=iMA(ea.Symbol,ea.Period,FAST_MA_PERIOD,0,FAST_MA_METHOD,FAST_MA_PRICE,shift); if (d_slow_ma==0) d_slow_ma=iMA(ea.Symbol,ea.Period,SLOW_MA_PERIOD,0,SLOW_MA_METHOD,SLOW_MA_PRICE,shift);
Your approach is purely procedural from the outset: what I see is what I tell. What if the average has to be calculated not on prices, but, say, on volume, or another indicator? Do we have to rewrite the user again? The calculation of the average is an algorithm. What you want to apply the algorithm to is the data. You're mixing the algorithm with the data, instead of separating it right away (like this pseudo code):
int period_ma = 12; int shift = 3; double fast_ma = SMA(Close, period, shift);
Oh, I forgot the series index. - There really shouldn't be one. You have to compute everything in a ring buffer by combining algorithms into pipelines.
As a counter-thesis and polemic to https://www.mql5.com/ru/articles/5654 and Mr Karputov's advisers
Mine has been undeservedly forgotten. And in vain, there is a lot there.
Your approach is purely procedural from the outset: what I see is what I tell. What if the average has to be calculated not on prices, but, say, on volume, or another indicator? Do we have to rewrite the user again? The calculation of the average is an algorithm. What you want to apply the algorithm to is the data. You're mixing the algorithm with the data, instead of separating it right away (like this pseudo code):
Oops, I forgot the series index. - There really shouldn't be one. You have to compute everything in a ring buffer by combining algorithms into pipelines.
A large part of everything is done for the sake of that. So that you can calculate everything and the Expert Advisor can figure out the sequences and interrelations itself. I once made a spreadsheet calculator a la micro-excel on MT4, and the organization of calculations is based on this model.
The use-case style is fundamentally procedural, as it is the most common. Potential users(novice programmers) write in this way.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I will try (or we will try, if anyone is interested) to make a framework for Expert Advisors. As suitable as possible just for simple things and that do not require any substantial knowledge from the applied programmer.
In contrast to the locally accepted practice, the design will be conducted from top to bottom. In other words, first we write the main (and the only) file of the EA for the end user, remove everything obviously unnecessary, and write a library to make this work. Then we add a new use-case and upgrade the library.
As a counter-thesis and polemic with https://www.mql5.com/ru/articles/5654 and Mr. Karputov's advisors
of course, before proceeding at all, it is necessary to set the "party line" and "target-communism" :
- 100 lines is enough for the user to implement the strategy. (apart from comments, input and other #property).
- The number of new "entities" (functions/classes/methods/constants) should be reduced to a minimum.
- The library must contain a countable number of files.
- Potentially suitable for GUI
- expandable by plugins
Goals achievable ? hard, but in principle YES. There are some ways, some ideas. But there is no ready solution yet :-)
The current step is to organize the acquisition of data by the expert. In such a way that it is easy for the user to describe them, but at the same time there are still "leads" for metadata and further extensions. (going forward - to implement the GUI part of the code, at least the debugging part)
As the initiator, I have created a simple use-case - we trade on crossing of two MA
Correspondingly, the input part looks like this
The next thing a user has to do - to describe what data he receives from input. List them at least:
and explain how it calculates/receives this data (it is long, but applies to both terminals).
and finally describe the trade signal:
THAT'S BASICALLY ALL. This is enough to implement an EA and it obviously doesn't require the user to read tons of documentation. The user only needs a basic knowledge of MQL. All the rest should be done by the library (or here, the fancy word - engine). It should be built for the user, not for the user to learn another multi-volume API.
By the way, here's OnInit :
..