// --- если обычное тестирование без оптимизации и визуализацииbool IsUsualTester = (MQLInfoInteger(MQL_TESTER) && !MQLInfoInteger(MQL_OPTIMIZATION) && !MQLInfoInteger(MQL_VISUAL_MODE));
// --- если не тестирование и не оптимизация, значит видимый графикbool IsVisibleChart = (!IsUsualTester && !MQLInfoInteger(MQL_OPTIMIZATION));
В статье рассматривается идея мультирежимного программирования торговых роботов на MQL5. Используется объектно-ориентированный подход для реализации каждого из режимов. Приводится пример иерархии режимных классов и пример классов для тестирования. Предполагается, что мультирежимное программирование торговых роботов полностью учитывает особенности каждого режима работы MQL5-советника. Для идентификации режимов создаются функции и перечисление.
It may seem to some that this is not the right branch, but it's simple:
if ChartID gives reasonable - it means that there is a place for it in GUI and it works in it you can draw, so either VISUAL_TESTER or just work in terminal.
If ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE) returns invalid handle, then we are inside the tester. (Or maybe MQ VPS - I haven't touched it, I don't know).
This may seem like the wrong thread to some, but it's simple:
if ChartID gives reasonable - it means there is a place for it in GUI and it works in it you can draw, so either VISUAL_TESTER or just work in terminal.
If ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE) returns invalid handle, then we are inside the tester. (Or maybe MQ VPS - I haven't touched it, I don't know).
The tester also has a chart, albeit a virtual one, so this is a dead end.
//true если работа на чарте или в визуальном тестировании, в остальных случаях falsebool CheckMode ()
{
if(MQLInfoInteger(MQL_DEBUG) ||
MQLInfoInteger(MQL_PROFILER) ||
(MQLInfoInteger(MQL_TESTER) && ! MQLInfoInteger(MQL_VISUAL_MODE)) ||
MQLInfoInteger(MQL_OPTIMIZATION) ||
MQLInfoInteger(MQL_FRAME_MODE)) returnfalse;
returntrue;
}
I had time to check: yes, the trick failed, ChartID()=12345 for visual and non-visual...(such a constant ChartID of the tester).
But ChartGetInteger(ChartID(),CHART_WIDTH_IN_PIXELS) gives an honest -1 if there is no screen. You can use it to determine the physics - whether there is a place to output something or not. Because there are a lot of flags, and we don't know what is there on VPS at all
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
What does that mean? Can you expand on that?
Andrew, this is the wrong thread. You need to find out in another thread.
Andrew, this is the wrong thread. You should find out such things in another thread.
Anybody have any thoughts?
Maybe try this?
Anybody have any thoughts?
Andrei, please look at the article (Section 2. Modes in MQL5), it may help )).
What does that mean? Can you expand on that?
It may seem to some that this is not the right branch, but it's simple:
if ChartID gives reasonable - it means that there is a place for it in GUI and it works in it you can draw, so either VISUAL_TESTER or just work in terminal.
If ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE) returns invalid handle, then we are inside the tester. (Or maybe MQ VPS - I haven't touched it, I don't know).
This may seem like the wrong thread to some, but it's simple:
if ChartID gives reasonable - it means there is a place for it in GUI and it works in it you can draw, so either VISUAL_TESTER or just work in terminal.
If ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE) returns invalid handle, then we are inside the tester. (Or maybe MQ VPS - I haven't touched it, I don't know).
The tester also has a chart, albeit a virtual one, so this is a dead end.
The tester also has a chart, albeit a virtual one, so it's a dead end path
I answered you in that thread (the questions are the same).
Anybody have any thoughts?
I answered you in that thread (same question).
Well, you have all the rights. Delete where it's off-topic... What's the problem?
What does that mean? Can you expand on that?
I had time to check: yes, the trick failed, ChartID()=12345 for visual and non-visual...(such a constant ChartID of the tester).
But ChartGetInteger(ChartID(),CHART_WIDTH_IN_PIXELS) gives an honest -1 if there is no screen. You can use it to determine the physics - whether there is a place to output something or not. Because there are a lot of flags, and we don't know what is there on VPS at all