Adviser's project - page 7

 
George Merts:

What do you mean by "ATR does not count as an indicator" ???

And how is it "not suitable as an entry signal??? I am a fool who uses "volatility breakthrough" using only this indicator...?

I think you have your own understanding of indicators. To me, an indicator is an object that can produce some variable value, depending on time. In fact, even an ordinary candlestick chart of price is also an indicator. But for you it is something else... Consequently, our understanding is different.

Essentially
indicator = a tool (tool) that shows any changes in something.
In this sense, ATP is an indicator.
When you look at the chart, you'll notice that the indicator is the most accurate (i.e., the indicator is not a standalone indicator - it's a position indicator) and you need to keep it in the market.

my respect.

 

Я не вижу особой разницы - как я понимаю, WS (WareStore, вероятно ?) - это все тот же мой дата-провайдер.

This is an abbreviation for WorkSymbol. The short abbreviation is chosen on purpose, because of the frequent reference to this object.

I suspect that there must be some preliminary steps in initialization for WS object.

WS is an instance of CSymbol object whose constructor by default uses the current Symbol() symbol. Therefore, WS doesn't require initialization from outside. It is simply created together with the strategy class.

There may be many different containers of different symbols and different timeframes in an EA. The data provider ideology allows not to duplicate them. Since in reality - all timeseries are stored in it, and containers - just point to the necessary ones.

The result is one mega-class kernel, which is accessed by expert classes. How does it differ from the basic MQL, when there is MetaTrader kernel and hundreds of its functions, that access it?

If we consider MT4-5 itself as the data provider, and our class is used only for providing access - then it turns out that according to your reference to Open price we must call the CopyOpen() function for one value - it seems unreasonable to me.

Exactly. Only such an appeal guarantees the unity of data representation and complete synchronization of states. No need to do any updates of quotes (which can be forgotten), no need to use a bunch of additional toggle switches, which inevitably occur when creating a data storage intermediary. No need to search the database for data matching the requested data. If my EA does:

Trade.SellLimit(WS.High[1]);

Then it is guaranteed to know that WS.High[1] will return its previous extremum, no matter how the trading environment is updated. Yes, it is too expensive to call CopyHigh at every call and copy one single value of double, but it is 100% reliable. Since cover classes do not store data, but only pass the call to system functions, then we can't have a situation where the stored data does not correspond to the current environment.

I also think it is very unreasonable to give full global access to all variables at any place in the program; on the contrary, I try to have access only to those structures and data that are needed for a given action in each place in the program. Everything else must be inaccessible. The ideology of the data provider just allows to control this access.

Georg, in fact, you have already created this global access. You have one big superclass provider that everyone is accessing. This is one big global pool of objects (indicators, timeseries, etc.), which is collected under the wrapper of OOP. In other words, in the example with data provider, OOP has turned into a fiction. It exists formally, but it does not exist in reality.

 
Vasiliy Sokolov:

Georg, in fact you have already created this global access. You have one big super-class provider, which is accessed by everyone. This is one big global pool of objects (indicators, timeseries, etc.) which is assembled under the wrapper of OOP. In other words, in the example with data provider, OOP has turned into a fiction. It's there formally, but it's not there in reality.

No, I was comparing running speeds when I place a buffer in data provider or get data each time via CopyXXX - I got times faster access to my buffer. That's why I settled on my buffers, and Data Provider is just a centralized storage for these buffers.

Indeed, the presence of "layer" - this very data provider brings a risk of data unsynchronization. But so far I have never encountered such a problem, but data provider saves speed quite clearly. Actually, I think this test was already conducted by many people - all turned out that when processing a tick it is more profitable to copy the data once and use them, rather than each time to the terminal for data.

Now it is different ? And the speed of a number of calls via CopyXXX for each double value is the same as the speed of one call at once for the whole range, and then - call to the buffer for values?

 
George Merts:

No, I was comparing speeds when I place buffer in Data Provider, or get data each time by CopyXXX - I got times faster access to my buffer. That's why I settled on my buffers, and Data Provider is just a centralized storage for these buffers.

Indeed, the presence of "layer" - this very data provider brings a risk of data unsynchronization. But so far I have never encountered such a problem, but data provider saves speed quite clearly. Actually, I think that many have already conducted this test - everyone received that when processing tick it is more profitable to copy data once and use them, instead of going to the terminal every time for data.

Now it is different ? And the speed of number of calls via CopyXXX for each double value is the same as the speed of one call at once for the entire range, and then - call to the buffer for values?

No doubt, it's much faster to copy all quotes at once in internal EA's memory (date provider) and then call the values from it, than to constantly call the CopyBuffer. But that's the price of a state-based system. Basically, our entire domain - writing EAs, scripts, etc. - is programming of systems based on states: we have an order - process the rules of its handling. There is no order - we process the conditions of its opening.

As for CopyBuffer, copying large chunks of quotes and measuring the performance gain is only possible in synthetic tests. In practice, in 90% of cases, the Expert Advisor works with the last bar on every tick or at the moment of opening a new bar. Therefore, the data of the last bar is always requested, and there is a constant call of the CopyBuffer function which copies the last bar into the cache.

The only real increase in productivity is when the Expert Advisor requires the last N bars, where N number is much greater than 1. But what is request of the last N bars? It is work in the sliding window (99% of all work of the Expert Advisor). And the sliding window, is a circular buffer in its essence. Therefore, when requesting the last N bars, in reality, you need to update or add only one, last bar. I.e. all this stuff with copying of block of data is a very nice story, but it doesn't work in the subject area which it was created for, while it's ring buffers that work, and quite successfully.

Now my CSymbol simply works by passing the right index. But I can upgrade it so that it will cache N last bars and N will be chosen by CSymbol itself, depending on maximal requested index. And then, without any external changes, CSymbol on some tasks, will work many times faster than the permanent call of CopyBuffer. This is the power of OOP. After a certain overhead associated with usage of additional wrappers, a qualitative leap comes, when you can dramatically reduce the use of memory or CPU time due to the adaptive algorithms.

 
Gregory Kovalenko:
Hello.
As the amount of code grows, it sometimes gets difficult and confusing.
I have seen EA code with a huge number of lines of code, I wonder how complex EAs are designed, are there any tools or techniques for working with such complex algorithms?

I write huge blocks of code taking up hundreds of lines. Almost no comments. Without OOP. The code is in Russian. Everything works very efficiently. I don't have any problems with orientation in the program, although there are about 100 files connected to it. Probably because I've got used to it and remembered everything a long time ago. The main thing is to know and understand your program, all the rest is secondary. Imho.

 
Реter Konow:

Writing huge blocks of code taking up hundreds of lines. Almost no comments. No OOP. Code in Russian. Everything works very efficiently. I don't have any troubles with orienting in the program, although there are about 100 files connected to it. Probably because I've got used to it and remembered everything a long time ago. The main thing is to know and understand your program, all the rest is secondary. My feeling is that the most important thing is to know one's own program, and the rest is secondary.

Did you go from 1C to MQL?
 
Vasiliy Sokolov:
Did you go from 1C to MQL?

I am self-taught. The first programming language I learned was MQL4. After that, I practiced a little in C# and C++.


Never heard of 1C. What is it?

 
Vasiliy Sokolov:

As for CopyBuffer, copying large chunks of quotes and measuring the performance gain is possible only in synthetic tests. In practice, in 90% of cases, the Expert Advisor works with the last bar on every tick, or at the moment of opening a new bar. Therefore, the data of the last bar is always requested and there is a constant call of the CopyBuffer, which copies the last bar into the cache.

So, we need the speed in "synthetic test" - the speed becomes critical when searching variants in the strategy tester. It is the strategy tester for me is a "bottle neck" where we need speed.

Just really in the real work - the speed of direct access to data via CopyXXX each time is enough. But, for the prog in the tester - speed difference is very important.

 
Comments not relevant to this topic have been moved to "OOP vs procedural programming".
 
George Merts:

But it is in the "synthetic test" that we need speed - speed becomes critical when trying options in the strategy tester. It is the strategy tester for me is a "bottle neck" where speed is required.

Just really in the real work - the speed of direct access to data via CopyXXX each time is enough. But, for prog. in tester - difference in speed is very important.

To explain in simpler words: at the base of your dataprovider there is CopyXXX function, which copies the last character. At the base of my CSymbol is also CopyXXX, copying the same last character. Both functions are slow. Therefore both your code and my code are slow, since the CopyXXX call cannot be bypassed. But my code is simpler and smaller. So why all this multi-storey build over CopyXXXXX, if it doesn't solve the CopyXXX problem itself?

Reason: