Download MetaTrader 5
To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
Björn Arnulfson
66
Björn Arnulfson 2014.01.23 17:57 

Hello,

I wrote the following simple EA:

int CSV;

int init() {
  CSV = FileOpen("new.csv", FILE_CSV|FILE_WRITE, ',');
}

int start() {
  FileWrite(CSV, TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS), Ask, Bid, 0, 0);
  FileFlush(CSV);
}

int deinit() {
  FileClose(CSV);
}

The point of this EA is to collect tick data from different brokers in order to compare them to the large tick data files you can get from Dukascopy. I do this to find out how realistic the Dukascopy data actually is.

A week ago or so, I attached this EA to the EURUSD chart. It was running several days and produced a file "new.csv" with reasonable tick data. Then a removed the EA from the EURUSD chart and attached it to the USDJPY chart. Now the new file "new.csv" didn't contain only USDJPY data, but, obviously a mixture between EURUSD data and USDJPY data. I removed and reattached the EA several times. I killed MetaTrader. I even rebooted my server. But now the situation is the following:

Whenever I start MetaTrader, the EA opens the file "new.csv" and writes EURUSD and USDJPY data into it. When I disable expert advisors, the file is opened, but nothing is written into it. I checked the EURUSD chart, the USDJPY chart and probably every other chart: No EAs are attached. When I right-click on the EURUSD or the USDJPY chart and select "Expert Advisors", "Remove" is greyed out.

Nevertheless, the EA must be running. It seems to have become some kind of zombie.

How can I stop it?

Simon Gniadkowski
Moderator
17975
Simon Gniadkowski 2014.01.23 18:12  
bjoern:

Hello,

I wrote the following simple EA:

The point of this EA is to collect tick data from different brokers in order to compare them to the large tick data files you can get from Dukascopy. I do this to find out how realistic the Dukascopy data actually is.

A week ago or so, I attached this EA to the EURUSD chart. It was running several days and produced a file "new.csv" with reasonable tick data. Then a removed the EA from the EURUSD chart and attached it to the USDJPY chart. Now the new file "new.csv" didn't contain only USDJPY data, but, obviously a mixture between EURUSD data and USDJPY data.

I don't believe this is correct, or if it is correct you are not running the code above . . .

You open the file using FILE_CSV|FILE_WRITE if there is a file existing it will be overwritten and not appended . . . from the documentation FileOpen()

If FILE_WRITE does not combine with FILE_READ, a zero-length file will be opened. If even the file containd some data, they will be deleted. If there is a need to add data to an existing file, it must be opened using combination of FILE_READ | FILE_WRITE.

. . . unless you have 2 EAs running, one on EURUSD and one on USDJPY, check the experts log file.
whroeder1
13957
whroeder1 2014.01.23 18:52  
RaptorUK: . . . unless you have 2 EAs running, one on EURUSD and one on USDJPY, check the experts log file.
Or you have two terminals running with the EA on one chart each. (open task manager and look for 2 terminal.exe)
Tjipke de Vries
6287
Tjipke de Vries 2014.01.24 08:27  
bjoern:

Hello,

I wrote the following simple EA:

The point of this EA is to collect tick data from different brokers in order to compare them to the large tick data files you can get from Dukascopy. I do this to find out how realistic the Dukascopy data actually is.

A week ago or so, I attached this EA to the EURUSD chart. It was running several days and produced a file "new.csv" with reasonable tick data. Then a removed the EA from the EURUSD chart and attached it to the USDJPY chart. Now the new file "new.csv" didn't contain only USDJPY data, but, obviously a mixture between EURUSD data and USDJPY data. I removed and reattached the EA several times. I killed MetaTrader. I even rebooted my server. But now the situation is the following:

Whenever I start MetaTrader, the EA opens the file "new.csv" and writes EURUSD and USDJPY data into it. When I disable expert advisors, the file is opened, but nothing is written into it. I checked the EURUSD chart, the USDJPY chart and probably every other chart: No EAs are attached. When I right-click on the EURUSD or the USDJPY chart and select "Expert Advisors", "Remove" is greyed out.

Nevertheless, the EA must be running. It seems to have become some kind of zombie.

How can I stop it?


Tip Avoid to have one file for all Symbols if you wanna collect data

you have

CSV = FileOpen("new.csv", FILE_CSV|FILE_WRITE, ',');

all files named "new.csv"

if you had named it like

string newfile = Symbol()+"_new.csv"

CSV = FileOpen(newfile, FILE_CSV|FILE_WRITE, ',');

then you will create for each symbol() separate file

Björn Arnulfson
66
Björn Arnulfson 2014.01.27 16:51  

How would you explain the phenomenon that you can observe in the following video?

>
Alain Verleyen
Moderator
29613
Alain Verleyen 2014.01.27 16:57  
bjoern:

How would you explain the phenomenon that you can observe in the following video?

...

Your EA is running on 1 of your numerous charts.
Björn Arnulfson
66
Björn Arnulfson 2014.01.27 17:11  

This is what the log file looks like:

$ tail 20140127.log

17:43:52 get_tick_data USDJPY,H1: uninit reason 4
17:43:52 get_tick_data USDJPY,H1: removed
18:01:43 get_tick_data EURUSD,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data EURUSD,H1: initialized

I repeated this experiment many times. I rebooted my server several times. There is no (visible) EA attached to either EURUSD.H1 or USDJPY.H1 or to any other chart.

Yet, every time I start MetaTrader, the file new.csv is created. During trading times, EURUSD and USDJPY tick data will be written to it. Outside trading times, such as yesterday afternoon, nothing is written to it.


Simon Gniadkowski
Moderator
17975
Simon Gniadkowski 2014.01.27 17:19  
bjoern:

This is what the log file looks like:

$ tail 20140127.log

17:43:52 get_tick_data USDJPY,H1: uninit reason 4
17:43:52 get_tick_data USDJPY,H1: removed
18:01:43 get_tick_data EURUSD,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data EURUSD,H1: initialized

So you have 4 instances of get_tick_data running . . . is that your EA ?
Alain Verleyen
Moderator
29613
Alain Verleyen 2014.01.27 17:30  
bjoern:

This is what the log file looks like:

$ tail 20140127.log

17:43:52 get_tick_data USDJPY,H1: uninit reason 4
17:43:52 get_tick_data USDJPY,H1: removed
18:01:43 get_tick_data EURUSD,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:43 get_tick_data USDJPY,H1: loaded successfully
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data USDJPY,H1: initialized
18:01:48 get_tick_data EURUSD,H1: initialized

I repeated this experiment many times. I rebooted my server several times. There is no (visible) EA attached to either EURUSD.H1 or USDJPY.H1 or to any other chart.

Yet, every time I start MetaTrader, the file new.csv is created. During trading times, EURUSD and USDJPY tick data will be written to it. Outside trading times, such as yesterday afternoon, nothing is written to it.


If you don't see where is the EA close your charts 1 by 1. It'seems you have at least 3 USDJPY charts with the get_tick_data EA. And 1 with EURUSD.
Ovo Cz
2987
Ovo Cz 2014.01.27 17:38  
He can see immediately which windows run EAs - by pressing Alt+W.
Björn Arnulfson
66
Björn Arnulfson 2014.01.27 17:48  
Ovo:
He can see immediately which windows run EAs - by pressing Alt+W.


Thanks. That was the tip I needed.

But there are still a few things I don't understand or that I don't like:

(1) Why does MetaTrader open several chart windows of the same type (e.g. EURUSD.H1). Shouldn't there be exactly one chart for each combination of currency pair and period?

(2) If there is a good reason to open several chart windows per instrument-period pair (which I doubt), why does MetaTrader hide these windows in such a way that they can only be found with an insider key combination?

(3) My EA opens the file new.csv for writing, not for appending. How did several instances of it manage to write to this file?

/ /12
To add comments, please log in or register