Features of the mql5 language, subtleties and tricks - page 270
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
const ulong KEY_LG_MCS=100; // задержка
ulong keyBEnabledAfter=1; // разрешена реакция на кнопку после заданного времени, или 0 запрещена вовсе
OnChartEvent(..) {
ulong now=GetMicrosecondCount();
if ( id==CHARTEVENT_KEYDOWN && ..) {
// нажата нужная кнопка
if (keyBEnabledAfter!=0 && keyBEnabledAfter<now) {
// разрешена обработка кнопки
keyBEnabledAfter=0; // запретим дальнейшую реакцию
needsCalc=true; // запустим вычиляндр
// или прямо сразу вычиcлим Calc(); keyBEnabledAfter=GetMicrosecondCount()+KEY_LAG_MCS;
}
}
}
OnTimer() {
if (needsCalc) {
// что-то тут вычисляем
if (calcDone) {
// закончили вычислять
needsCalc=false; // отметим это
keyBEnabledAfter=GetMicrosecondCount()+KEY_LAG_MCS; // разрешим реакцию ена кнопку через KEY_LAG mcs
}
}
}
general principle in pseudocode...Wrap functions to taste, or spawn a class on the fly
What wrapping in a class is good for is the use of the RAII idiom.
The idea is as follows. When out of scope, destructors of objects with local lifetime are called in the reverse order of their declaration. Therefore, in the code:
void Foo(){ TSomeClass something; ... DoSomething(); }DoSomething will be called first, and only then the ~TSomeClass() destructor. Theoretically, we may not even have the TSomeClass source code on hand and not know what happens in the destructor.
If we do:
, it is guaranteed that the TSomeClass destructor will be called first and only then, when the TScoupe destructor is executed, will DoSomething be called.
Using global variables in general and for synchronisation, in particular, is not a good idea, considering that they can be changed from anywhere in the terminal)
And the point of the discussion is not synchronisation of threads, but, in this case, not executing OnChartEvent queued until the end of execution of certain code.
Using global variables in general and for synchronisation, in particular, is not a good idea, considering that they can be changed from anywhere in the terminal)
And the point of the discussion is not synchronisation of threads, but, in this case, not executing OnChartEvent queued until the end of execution of certain code.
DoSomething will be called first, and only then the ~TSomeClass() destructor. Theoretically, we may not even have the TSomeClass source code on hand and not know what happens in the destructor.
However, if we do this:
, it is guaranteed that the TSomeClass destructor will be called first and only then, when the TScoupe destructor is executed, will DoSomething be called.
Has anyone been able to run any optimisation using Alglib?
I would be grateful if someone could share links to examples of use.
Doesn't anyone know and hasn't seen an example of use?
Doesn't anyone know or have seen an example of use?
I have used to forecast volatility using the GARCH model. There is an article on the site
Is it exactly the optimisation methods used there in the article? Can I have a link to the article, please?
ZЫ. If I understood correctly, this article is meant?
Is it exactly the optimisation techniques used there in the article? Can I have a link to the article please.
https://www.mql5.com/ru/articles/15223
Yes, MinBLEIC was used.