Questions about MQL4. - page 8

 
Figure 6
Files:
zigtester.jpg  16 kb
 
ANK:
Who knows if this is correct?
one file cannot be included more than once in the code.
so it has to be:
- or make several files with different names of global variables and functions (this is a lamer version =)
- or design logic so that there is no overlap when calling from different functions (this may require some work, but it's a good solution ;)

And you can not say something more exact without examples, error descriptions or complete code (best of all) =)
 
The Expert Advisor and the looped script are running in the window at the same time.
Is it correct to assume that while the Expert Advisor is waiting for the server to respond to a trade operation
the script continues to work as usual without any stops and delays, perform its calculations (not trading operations)?
 
SKif:
The Expert Advisor and the looped script are running in the window at the same time.
Is it correct to assume that while the Expert Advisor is waiting for the server to respond to a trade operation
the script continues to run its course without any stops and delays, perform its calculations (not trade operations)?
Yes.
both the Expert Advisor and the script work in their own threads.
 
OK, thank you.
Should we consider it normal when the start time of the indicator and EA does not match when the EA button is switched on?
Maybe I am misunderstanding something or am doing something wrong, but it turns out that the time difference may be more than 250ms.

Also. Does the status of the EA button have any effect on the operation of the indicator?
Is it possible to track the state of this button from the indicator?
 
I did a little research...

Placed an indicator in the window:
int start() { GlobalVariableSet(GV_Tick, 1); return; }

Put an EA in the window:
int start() { GlobalVariableSet(GV_Knopka, 1); return; }

And a script with a snippet like this:
... T_Tick=0; T_Knopka=0; while (Tick==0 || Knopka==0 ) // Ждём тика и разреш. кнопки советн. { Tick = 0; Knopka = 0; Tick = GlobalVariableGet(GV_Tick ); Knopka = GlobalVariableGet(GV_Knopka ); if (Tick>0 && T_Tick==0)T_Tick=GetTickCount(); if (Knopka>0) { T_Knopka=GetTickCount(); Alert("T_Tick=",T_Tick, " T_Knopka=",T_Knopka, " Запазд= ",T_Knopka-T_Tick); } } ... GlobalVariableSet(GV_Knopka, 0 ); // Обнуляем прошлые события GlobalVariableSet(GV_Tick, 0 ); // Обнуляем прошлые события


And here are the results:
During the period highlighted in red, the mouse simply moved in a circle of 50mm diameter at 3 revolutions per second.
There was no impact on the terminal.

It turns out that during a "normal" quiet period the lag is approx. 20-60 ms, and even more during the period when the user is in contact with the terminal.
Besides, I found out that indicator's start() is started in period of window's resizing and when switching between windows.
---------------
I'm mainly interested in legality of this delay, "normal" and "unusual".
And I'd like some comments from the developers - how appropriate it is to the intent.
Files:
1.png  21 kb
 
I will run the tests myself and report back with the results.
 
OK.
In the absence of any other option, I was guided by the option of measuring the lag time of EA and indicator signals, in order to judge whether the EA button was off. This time was supposed to be very short. But it varies too much.

It's very interesting, what you will find out.
(In general, I need this whole kitchen to answer one simple question: EA button status )
 
Experts work in their own threads independently of other tasks.
It turns out that CPU load is caused by mouse movement, when hundreds of mouse move commands are sent en masse. Among these "mouse" commands are also commands to refresh EAs, which leads to delays.
 
So, we should assume that the non-simultaneous operation of the script, the indicator and the Expert Advisor is a common phenomenon?
So... how does one live in the world?
Reason: