We help IT Professionals succeed at work.
Comment
Watch Question

Most Valuable Expert 2012
Top Expert 2008

Commented:
I see:

1) Description of file format

2) Link to code library

    http://www.koders.com/csharp/fid748E689DE09394F31358BE028BD425BA859995EE.aspx?s=file#L22

    This appears to need an external library (MSFL91.dll)

3) Metastock is an old-school format, with MBF (Microsoft Binary Format) instead of IEEE floating point numbers

4) There appears to be a MetaStock Developers Kit "

5) Mention of CSharpMetaStock.dll, without source code

I can understand why you don't know where to start, because the way doesn't seem clear.

Author

Commented:
I might be getting closer.

I'm using this open source library:
http://meta-all.sourceforge.net/

It's close to working although I keep getting the error message:
System.ArgumentOutOfRangeException: Year, Month, and Day parameters describe an un-representable DateTime.

I suspect the Metastock data format may have changed since the time this OSS was last updated since it appears when calling the function:
Friend Function SingleToDate(ByRef f As Single) As Date

Does anyone have any other ideas?

Friend Function SingleToDate(ByRef f As Single) As Date
        Dim day1, date1, month1 As Long
        Dim year1 As Short
        date1 = f
        If (date1 > 0) Then
            day1 = date1 Mod 100
            date1 = date1 / 100
            month1 = date1 Mod 100
            date1 = date1 / 100
            year1 = 1900 + date1
        Else
            date1 = 1000000 + date1
            day1 = date1 Mod 100
            date1 = date1 / 100
            month1 = date1 Mod 100
            date1 = f
            date1 = date1 / 100
            date1 = date1 / 100
            year1 = 1900 + date1

        End If

        'SingleToDate = CStr(day1) + "/" + CStr(month1) + "/" + CStr(year1)
        SingleToDate = New Date(year1, month1, day1)
    End Function

Open in new window

Most Valuable Expert 2012
Top Expert 2008
Commented:
What is the input, what is the expected output, and what are the values for year1, month1, and day1?

Author

Commented:
Dunno. I don't know how to read the binary file.

Do you know have any links? I've opened up the binary file using VS and see this line, for example:

00000000000014EE  00 00 42 41 4E 50 55 48  31 30 20 20 20 20 20 20  ..BANPUH10

Do you know what this means? The actual info I need is "BANPUH10"  but I have absolutely no idea what the other #s are.

Author

Commented:
Thanks, right intention. I just found another way to approach the problem.