Errors, bugs, questions - page 2201

 

Tonight decided to translate a page from English -

"The site uses cookies. Learn more about our cookie policy."

I typed the link into Yandex Translator and read the translation. When I accessed the MQL5 website I got the following:

What is the correct way to translate pages from other languages here, so as not to get this kind of thing?
 
Vladimir M.:

Tonight decided to translate a page from English -

"The site uses cookies. Learn more about our cookie policy."

I typed the link into Yandex Translator and read the translation. When I accessed the MQL5 website I got the following:

What is the correct way to translate pages from other languages to avoid this?

Somehow I doubt that the text contains invisible special characters in unique combination to identify users using copypaste.
But it could be....

 

Friends, I'm appealing to your experience and asking for your guidance in finding the right solution.

I have an EA that at certain intervals (every few minutes) unloads data into a file, runs an external program and reads data from the file. The whole cycle takes ~600 milliseconds.

How to make when testing a strategy, so that the program waits until the external program finishes (i.e., during this time, the price stream should be paused, or ideally, skip ticks for 600 milliseconds)?

Otherwise now during the execution of an external program several days of ticks fly by when testing a strategy :-(. In the visual tester the EA works. But to test a strategy on several years of history would take an incredible amount of time.

 
fxsaber:

I don't understand it at all. Here is the code

It somehow complains about passing a pointer by reference. At the same time, the f function calmly receives the pointer by reference.


The result is

The int operator was called without any problems, while the pointer operator was not.

Yes, there is such a problem. An error occurs when passing a pointer by reference into an overloaded operator. This appeared in the latest builds, everything was ok before. I've sent an application to help-desk for some months already, but there is no answer or hello as usual.

This is especially critical for pointer array, since there's no other way to send them, except by reference:

class A
{
 public: 
  A* operator+(const A*const& array[]) { return NULL; }
};

So I'm still sitting on the 1554 build.

 
romachandr:

Well as a hatchet job (doesn't mean it's bad):

Expert:

1. a shell script file is invoked

2. a file signalling the completion of external actions is expected

3. signal file is deleted


Command shell script:

1. running an external program

2. signal file creation

Hence: the link was inserted automatically, it's not about that at all.

By the way, how do you run an external program? If via some ProcessCreate() or ShelExecute(), then you can give the resulting handle to WaitForSingleObject(), but that's dancing with winapi type declaration.

 
pavlick_:

Well as a hatchet job (doesn't mean it's bad):

Expert:

1. command shell script file is called

2. a file signalling the completion of external actions is expected

3. deletion of the signal file


Command shell script:

1. running an external program

2. signal file creation

Hence: the link was inserted automatically, it's not about that at all.

By the way, how do you run an external program? If through some processCreate() or ShelExecute(), then you can give the resulting handle to WaitForSingleObject(), but this is a dance with type declaration winapi.

The external program is started with ShellExecuteW().

At the output of the program execution a file is generated. In fact, it can be a signal file.

But I don't understand how to suspend the tester at this time?

I am not practically familiar with winapi. If it really helps, I'm ready to go deeper.

 
romachandr:

The external programme is started with ShellExecuteW().

A file is generated at the output of the program execution. In essence, it can be a signal file.

But I don't understand how to suspend the tester at this time?

I'm not really familiar with winapi. If it really helps, I'm willing to go deeper.

The winapi has the following mechanism:

The objects that are described by the HANDLE returned when created (threads, processes, mutexes, ...) have a signal flag. In the case of a process, it will set it when it terminates. WaitForSingleObject() stops execution of the current thread (your EA) until the flag is set, i.e. the EA will exit WaitForSingleObject() after the external program finishes.

ShellExecuteW() returns HINSTANCE instead of HANDLE, I'm not sure that it will work for WaitForSingleObject() function, but it's worth trying. If it fails, you should use ShellExecuteEx, for example (but non-trivial arguments are passed inside it).

http://fkn.ktu10.com/?q=node/633

https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx

 
pavlick_:

Winapi has the following mechanism:

objects that are described by the HANDLE returned when created (threads, processes, mutexes, ...) have a signal flag. In the case of a process, it will set it when it terminates. WaitForSingleObject() stops execution of the current thread (your EA) until the flag is set, i.e. the EA will exit WaitForSingleObject() after the external program finishes.

ShellExecuteW() returns HINSTANCE instead of HANDLE, I'm not sure that it will work for WaitForSingleObject() function, but it's worth trying. If it fails, you should use ShellExecuteEx, for example (but non-trivial arguments are passed inside it).

http://fkn.ktu10.com/?q=node/633

https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx

Thanks for the tip!

I'm going to look into it.

 
romachandr:

But I don't understand how to pause the tester at this time?

#import "Kernel32.dll"
 void Sleep(int milliseconds);
#import


void OnTick()
{
  while(! Condition()) Kernel32::Sleep(10);
}
 
What's so hard? Keep an eye on the result file + native Sleep solves the problem.
Reason: