Libraries: Expert - page 9

 
vek_y4icb:
Cool library! I wouldn't have thought of implementing the Expert Advisor opening in such a way. Could you tell me how to define an active chart using mql without using dll. I have done some work on winapi, but it turned out to be too cumbersome:

Maybe you know how to implement this case on mql or at least with dll, but simpler?

If a child window in the terminal is maximised, it is one (the others are not considered maximised). Due to this you can check ChartGetInteger(id, CHART_IS_MAXIMIZED, 0, value) in the ChartFirst/ChartNext loop, and where value will be 1 - this is the active window.

 
Stanislav Korotky:

If a child window in the terminal is maximised, it is one (the others are not considered maximised). Due to this it is possible to check ChartGetInteger(id, CHART_IS_MAXIMIZED, 0, value) in the ChartFirst/ChartNext loop, and where the value is 1 - this is the active window.

That's a little bit different than what I need. But thanks anyway!!!

 
fxsaber:

A small flyhack is to run EAs/scripts on OBJ_CHART objects.

So launched Expert Advisors hang dead - they are not executed in any way. But scripts work perfectly well. So it opens some possibilities.

For example, you can use Order-functions from indicators on charts where there is already a running Expert Advisor. And no new auxiliary charts need to be opened.


Compiling the script Scripts\OrderSend.mq5


And run the indicator that "can trade"

Good afternoon. I have encountered the following problem. When launching an Expert Advisor on OBJ_CHART, it refuses to work with OnTick. Do you know if there is a solution to make OnTick work?

 
vek_y4icb:

Good afternoon. I have encountered the following problem. When launching the Expert Advisor on OBJ_CHART, it refuses to work with OnTick. Do you know if there is any solution to make OnTick work?

You yourself quoted the message about dead Expert Advisors on OBJ_CHART. This is a limitation of MT5.

 
fxsaber:

You yourself quoted the message about dead EAs on OBJ_CHART. This is a limitation of MT5.

OnTimer works on them.

 
vek_y4icb:

OnTimer works on them.

It would be quicker for you to check, I don't remember.

 
fxsaber:

It's quicker for you to check, I can't remember.

No, it was not a question) OnTimer works on such experts, that's the point. But OnTick absolutely refuses to do so.

 
In general, as I understand, OnTick is fundamentally impossible to enable on such an Expert Advisor and there are no workarounds for it?
 
vek_y4icb:
In general, as I understand, OnTick is fundamentally impossible to enable on such an Expert Advisor and there are no workarounds for it?

There are no workarounds for enabling On-functions. You can emulate it by calling OnTick in a high-frequency OnTimer and getting (if necessary) missing ticks through CopyTicks.

 
fxsaber:

There are no workarounds for including On-functions. It can be emulated by calling OnTick in a high-frequency OnTimer and fetching (if necessary) missing ticks via CopyTicks.

That's how I do it. Thanks for responding!