Saving Quotes

 

Hi,

I want to save the actual tick data into a csv-file. Every week or month I want to save one csv-file.

So in my init-function I will open a new file and every tick I do a

FileWrite(handle_tick,TimeToStr(CurTime(),TIME_DATE|TIME_MINUTES|TIME_SECONDS),Bid,Ask);


Now I have a few problems / questions:

1.

When there is a problem with writing into the file the ea stopped for the hole (week/month) and can't open it again.

-Do I have to write FileOpen(...) every tick?? Or should I use FileFlush(..)?

2.

There also was a problem with the saved time. If I compared it with the chart-time, or the time from the history center, there was a big difference (not statical, sometimes e.g. 39minutes, or 87minutes).

Do I have to save the CurTime or what time??

3.

There are some breaks in my internet connection (e.g. 2-5 minutes, about 3 times a day).

How can I check my saved quotes automatically, so that the ea fetches the missing mintues-data from the history?

And how can I get my tick data if the internet connection was lost? Is there also a history center or a buffer for the last hours?

4.

Does anybody know a easy way to combine the single csv-quote files automatically?

5.

I also want to save tick and minute-data from cfd's like Ger30! If i save the .csv File monthly, but the new contract, which comes every 3 months does change during the month. Then the EA can't find the data because the actual underlying (contract "Juli" is not valid anymore, but now e.g its the september contract) doesn't work anymore.


Maybe there is already a reliable EA for that problem?

 

I also have another question:

6.

Is it useful to save the bid, ask and the volumen in my tick-file?

7.

Does anybody have a tutorial how to backtest tickdata with metatrader 4 or/and 5?


Is there a expert out there who could help my?! You can also answer per private message...

Thank you!
julia

 
sunshineh:

Hi,


Now I have a few problems / questions:

3.

And how can I get my tick data if the internet connection was lost? Is there also a history center or a buffer for the last hours?


The history centre (press F2) will give you, at best, M1 data not tick data . . . to get tick data you need a live connection, it it breaks you will lose data . .
 

...

yes, that's clear.


Does anybody know an answer to my other questions.

Especially what is about CFDs? They change the contract every three month! So how can I programm this in my tick-saver.mq4, that the change of the underlying happens automatically and I don't lose any ticks??

 
sunshineh:

Hi,

I want to save the actual tick data into a csv-file. Every week or month I want to save one csv-file.

So in my init-function I will open a new file and every tick I do a

FileWrite(handle_tick,TimeToStr(CurTime(),TIME_DATE|TIME_MINUTES|TIME_SECONDS),Bid,Ask);


Now I have a few problems / questions:

1.

When there is a problem with writing into the file the ea stopped for the hole (week/month) and can't open it again.

-Do I have to write FileOpen(...) every tick?? Or should I use FileFlush(..)?

(1) is usually caused by file descriptor leak. You need to close every file that you open before. EA has limited set of file descriptors and if you use them all then you cannot open another file anymore. You can check experts tab in MT4 for this error.

Regards, Luke

 

Hi,

I wrote my Tick- and Minute Ouote Saver on the ground of this code: https://www.mql5.com/en/code/7777

But I want that the ea fetches the minute data's automatically from the history center, if the internet was loss.

I have the txt-File with the saved qoutes and there I would check, if the last minute quotes are saved if not, I want to fetch it from the history center with iOpen(..,minutelost), iHigh(..,minutelost) ..


I think the history center fetches the data atuomatically, if the connection was broken.

Can I do this that way or does anybody see an error in reasoning??

Does a project like this already exist?


My qoute saver was running for about two weeks and the the windows 7 hung up and stopped everything. How can I get the information why windows wasn't working anymore and if the reason was my qoute saver?


Thank you very much!!

Reason: