Features of the mql5 language, subtleties and tricks - page 61
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have now encountered a problem when the history has more than 1000 deals and when you call the history processing function, for example, to calculate the profit of the history. + add the profit of the current trades - the information on the chart starts to slow down and the terminal hangs itself. I.e. quotes come with a delay.
I can only guess without the code.
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Alexey Navoykov, 2017.07.21 17:04
This article describes the case of the trading strategy with an example of the MetaTrader 5. However, you can get out of it by different means: templates and macros - what should I do without them?)
Here is what I have made.All source classes should be declared as templates that define the parent class.
Of course there are some subtleties, related to the fact that classes are inherited sequentially (in the order we've set), rather than in parallel (as in true multiple inheritance). In particular, they will have different priorities when an overload occurs. Besides, if the same template class participates in an inheritance chain several times, they will be completely different classes that are not related to each other in any way. So you have to be careful here. But there are no problems with interfaces, you can inherit without restrictions.
But what about without declaration in the form of templates?
For example, we have two ready-made self-sufficient libraries:
class CLib1 : public CClass1 { };and
class CLib2 : public CClass2 { };
We need to make such inheritance in the program class:
CLib1--> CLib2 --> CProgram so that both libraries are available in the CProgram class. And CLib1 library will be available in CLib2 accordingly.
And you won't be able to change the code of both libraries.
Is it possible?
With multiple inheritance it would probably be like this
class CProgram : public CLib1,CLib2 { };
And if without the announcement in the form of templates?
For example, we have two ready-made self-sufficient libraries:
class CLib1 : public CClass1 { };and
class CLib2 : public CClass2 { };
We need to make such inheritance in the program class:
CLib1--> CLib2 --> CProgram so that both libraries are available in the CProgram class. And CLib1 library will be available in CLib2 accordingly.
And you won't be able to change the code of both libraries.
Is it possible?
With multiple inheritance it would probably be like this
class CProgram : public CLib1,CLib2 { };
You won't loose anything if you do it this way
class CProgram { CLib1 lib1; CLib2 lib2; };
You won't lose anything if you do it this way:
Probably the best way to get the data from asynchronous Copy functions (CopyRates, CopyTicks, etc.) is through EventChartCustom.
It is especially important for indicators.
It is possible to know that there was a change of trade server, not just account -AccountInfoString (ACCOUNT_SERVER) in OnDeinit (EA, not indicator) will return the new trade server.
Memo
Forum on trading, automated trading systems and trading strategies testing
My dissatisfaction with strategy tester. to MQL developers
fxsaber, 2017.12.04 09:11
Result
There is a whole class of indicators, which superimpose price charts of other symbols on the price chart. They are done in the same way - through indicator buffers.
But in MT5 there is a wonderful OBJ_CHART, which allows you to realize this task much more beautifully without indicator buffers.
For example, you can put any indicator and immediately see how it looks on another symbol.
Slave scheme - several charts are displayed as the background of the main chart.
For example, you can cast any indicator and immediately see how it looks on another symbol.
Slave scheme - several charts are displayed as the background of the main chart.