Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
This is reverse engineered NTD file format specification. This file format is used to store NinjaTrader 7 (possibly v6 too) tick data.
I do not have any official file specification from Ninja guys so information contained
in this document may not be perfect. If you find any errors in this document please
post comments.
My primary language is not english so watch out for grammar errors .
--- START ---
LE - little endian BE - big endian
Address : Description
0x00 : Price multiplier stored as IEEE754 double precision 64-bit. For some reason is stored as negative number.
0x0C : Record count [4B UINT LE] including first record.
0x10 : Price of the first record in the NTD file [8b IEEE754 LE].
0x18,0x20,0x28 : same data as 0x10 (don't know why)
0x30 : Serialized .NET DateTime structure of the first record [8b MS-TICK].
0x38 : Volume of the first record [8B UINT LE].
0x40 : Beginning of the body part (starts with the 2nd record).
Body structure
MASK [1B] DELTA TIME [1B-3B UINT BE]
DELTA PRICE [1B,2B,4B UINT BE]
VOLUME [1B,2B,4B,8B UINT BE]
Size can vary depending on the mask settings. Order of the fields do not change.
MASK
Defines size of the remaining three parts of the record.
MASK bits are ordered as 01234567.
b: 0 - do not know
b: 1,2,3 - VOLUME size
001 - 1B
110 - 2B
111 - 4B
010 - 8B
b: 4,5 - DELTA PRICE
00 - 0B (price field left out)
01 - 1B
10 - 2B
11 - 4B
b: 6,7 - DELTA TIME
00 - 0B (time field left out)
01 - 1B
10 - 2B
11 - 3B
Working with DELTA values:
Delta values are added to previous record value.
Consider following time values:
20081208 001609
20081208 001619
20081208 001629
20081208 001639
20081208 001639
You can clearly see 10 second delta (excluding last line). Binary value at offset 0x30 is then
0x80eac54de126cb08 for first record. Other record will have following delta time values 0x0a, 0x0a, 0x0a.
Last record will have delta value excluded.
Same applies for price changes. But there is one trick involved in computing price value. Price can move
to higher or lower values. So we need positive and negative values for price delta. This is accomplished by
splitting value interval into two parts. First part is for the negative delta and second part is for the
positive delta.
Example:
First record price is 1557.25, for the second is 1557.50 and for the third is 1557.00
At offset 0x10 will be value 0x0000000000559840
record 2 delta is: 0x81 (1557.25 + ((+1) * 0.25) = 1557.50)
record 3 delta is: 0x78 (1557.50 + ((-2) * 0.25) = 1557.00)
List of delta "zero" values: size : delta
1B : 0x80
2B : 0x4000
4B : 0x40000000
Thanks for this. Been a while since I used NT, remind me -- is this the replay data that contains L1 and L2 (bid/ask/DOM) when 'record historical data' is ticked? Or is it just L1 data?
Unfortunately this is not market replay data. It is not possible to reconstruct the level 2 data from ntd files. You can get ask/bid/last data, but they are stored in 3 separate files which are not synchronized together.
NTM adn NT2 files are too complex and hard do visually "debug" in NinjaTrader because I cannot directly see data changes when I make a modification in the file.
I tried do decompile NinjaTrader bytecode but I think it is packed by Remotesoft .NET Obfuscator for which I do not have unpacker.
I found another funky value : 011, in which case the next value is a 1B, but you need to multiply it by 100 to get the correct volume.
Clever way to store multiples of 100 with less bytes.
Here's an new version that should overcome the problem.
You have to set WriteData to true : the indicator will create data files in the Gom folder on incoming ticks, so the indicator can find data not in yet in the Ninja files when you hit F5.
These …