GoldenBear
asked on
How do I read Metastock data using C#?
Hi,
I'm trying to read Metastock data using C# so I can try my own trading indicators.
However, I have no idea how to even start.
I have some good links, but I still don't know what to do:
http://www.koders.com/csharp/fid748E689DE09394F31358BE028BD425BA859995EE.aspx?s=file#L22
http://www.purebytes.com/archives/metastock/2001/msg04890.html
http://themech.net/2008/08/reading-metastock-files/
http://forum.equis.com/forums/thread/19078.aspx
http://forum.equis.com/forums/thread/24635.aspx
http://www.wotsit.org/list.asp?search=metastock&button=GO!
https://www.experts-exchange.com/questions/10011038/Reading-metastock-data-files.html?sfQueryTermInfo=1+metastock
Thanks.
I'm trying to read Metastock data using C# so I can try my own trading indicators.
However, I have no idea how to even start.
I have some good links, but I still don't know what to do:
http://www.koders.com/csharp/fid748E689DE09394F31358BE028BD425BA859995EE.aspx?s=file#L22
http://www.purebytes.com/archives/metastock/2001/msg04890.html
http://themech.net/2008/08/reading-metastock-files/
http://forum.equis.com/forums/thread/19078.aspx
http://forum.equis.com/forums/thread/24635.aspx
http://www.wotsit.org/list.asp?search=metastock&button=GO!
https://www.experts-exchange.com/questions/10011038/Reading-metastock-data-files.html?sfQueryTermInfo=1+metastock
Thanks.
ASKER
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.ArgumentOutOfRangeE xception: 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?
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.ArgumentOutOfRangeE
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
ASKER
Thanks, right intention. I just found another way to approach the problem.
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.