Page 1 of 1

Tick saver to CSV

Posted: Thu Nov 07, 2013 8:23 pm
by jarl
I want to collect tick-by-tick from my broker in a CSV file.

The generic tick file format is:

Code: Select all

Timestamp,Bid price,Ask price,Bid volume,Ask volume
20130101 22:00:39:069,1.32019,1.32072,0.75,0.75
20130101 22:03:14:262,1.32046,1.32056,0.100000001490116,1.58000004291534
...
MQL4 allows me to access to time, bid, ask and volume.
What means "Bid volume" and "Ask volume"? How I can get with MQL4?

In this URL http://codebase.mql4.com/7849 you can see a tick data saver EA, but it use a different file format:

Code: Select all

datatime,open,high,low,close,volume
1317642960,1.54739,1.54739,1.54697,1.54697,20
1317642960,1.54739,1.54739,1.54697,1.54701,21
1317643020,1.54705,1.54705,1.54705,1.54705,1
1317643020,1.54705,1.54709,1.54705,1.54709,2
1317643020,1.54705,1.54716,1.54705,1.54716,4
1317643020,1.54705,1.5472,1.54705,1.5472,5
1317643020,1.54705,1.54723,1.54705,1.54723,6
1317643020,1.54705,1.54731,1.54705,1.54731,8
1317643020,1.54705,1.54731,1.54705,1.54723,10
1317643020,1.54705,1.54731,1.54705,1.5472,11
1317643020,1.54705,1.54731,1.54705,1.54716,12
1317643020,1.54705,1.54731,1.54705,1.5472,13
1317643020,1.54705,1.54731,1.54705,1.54723,14
1317643020,1.54705,1.54731,1.54705,1.54727,15
Thanks

Re: Tick saver to CSV

Posted: Thu Nov 07, 2013 11:22 pm
by tickstory
Hi Jarl,

The script you are referring to doesn't give you "complete" tick data - it is effectively giving you the closing price of a 1-minute bar on every tick. The data that the Tickstory "tick export" provides includes more granular information such as the bid and ask price at that particular time (and therefore the spread). It also includes the volume on the bid and offer at the time of that tick.

If you wish to approximate the format that is represented in the script, you can use the following output format to construct the Open, High, Low & Close of a tick "bar":

{Timestamp:yyyyMMdd} {Timestamp:HH:mm:ss},{BidPrice},{BidPrice},{BidPrice},{BidPrice},{BidVolume}

All the bars will be flat OHLC candles.

Hope this helps.

Re: Tick saver to CSV

Posted: Fri Nov 08, 2013 8:29 am
by jarl
Thanks,
My problem would be solved by knowing how to obtain {AskVolume} and {BidVolume} in MQL4.

In MQL4:
{Timestamp:yyyyMMdd HH:mm:ss} is TimeToStr(TimeCurrent() - GMToffset *3600,TIME_DATE|TIME_SECONDS)
{BidPrice} is Bid
{AskPrice} is Ask
{BidVolume} is ?
{AskVolume} is ?

Re: Tick saver to CSV

Posted: Fri Nov 08, 2013 9:28 am
by tickstory
Hi Jarl,

There is no such information that is provided by MT4. The "volume" in MT4 is actually the number of ticks that occurred in the bar. More discussion on this topic can be found here:

http://www.tickstory.com/forum/viewtopic.php?f=2&t=222

Hope this helps.