Here is an expert to provide bid-ask prices as the ticks arrive.
It is a modification of the work done by Andrey Khatimlyanskyy on www.mql4.com
where he explained data storage.
There are 4 files:
log2.mq4 & log2.ex4
log ticks.mq4 & log ticks.ex4
Place the log2 files in the \experts\include folder.
Place the log ticks files in the \experts folder.
Add the log ticks expert to the chart with the symbol you want to collect bid-ask data.
There is an option for local time or broker time in the expert. TimeisLocal = true gives local time, =false gives broker time. (In IBFX broker time is GMT).
The expert will generate one file per calendar day. You will have to combine files for multiple days, but it offers some protection from creating a HUGE file. If you want, you can modify the log2.mq4 to adjust this for a single file or multiple days.
The resulting text file is located in the \experts\files folder.
The file is a text file with the name in the format
"Acct No Tick-Bid-Ask--date.txt"
Example: 1261643 Tick-Bid-Ask--2006.11.07.txt
The data is csv in the format shown below:
This is a copy & paste from a single text file where I changed from local time to broker time after the expert started.
Note that each time the expert restarts, i.e. changing inputs, changing time frames, opening & closing metatrader, and probably other activities, the expert is restarted and the header line is put in the text file (Time,Bid,Ask).
If you want to collect data, the best choice is to set this and let it run continuosly for the desired time. Or, you will need to ensure you clean out these headers before using the data. I suspect, but haven't confirmed, that you could miss data points when you restarted the expert.
Hope this helps, and thanks to Andrey for the initial concept and code.
P.S. to Gert... Cap'n Jack works, but eagles is faster to type.