Discussions
»
Special Interest Groups
»
MetaStock Developer's Kit (MDK) Assistance
»
VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/4/2007(UTC) Posts: 4
|
VisualBasic 6 is useful if you want ot access the MetaStock File Library and make form based applications etc
Please tell me how to use MFL from Visual basic
If any body know how and have a sample code to start getting data from a .DAT securtiy file and save it in Access Dbase
Thanks for all in advance
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Star,
Before we get into data conversion systems and routines, may I ask a simple question first: Why do you want to import existing MS data into a database? If you could explain a little about what you want to achieve, we might be able to give some pointers on how to best achieve your aim.
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/4/2007(UTC) Posts: 4
|
Hi wabbit,
Thanks for your quick response , I would like to have it in a dbase to do alot of analysis and queries and reports on this data ( both Historical and Interday).
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
The MDK manual has examples of how to access the MS data files. You just need to use the MSFL to open the data file, read the data file and use an SQL query to insert the data into your database.
This of course sounds like a lot of hard work, when the tools you need to analyse and report on company data are contained, or can be added to MetaStock. I mean, that's what MetaStock is, an analysis tool!
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/4/2007(UTC) Posts: 4
|
Actualy i got the attached Code from earlier disccusion
and its retriving security information from a .DAT file but the problem is the information data is not correct . i donno may be the the problem is (BINARY data and ASCII data type format) (how can i declare the deferent between tow types).
so please if you have better sample code (Visual Basic or VBA for Access) to retrive the correct data from (Interaday) .DAT files for your information the .DAT files it's not produced by MetaStock it's produced by another trading software but the same type of metastock because metastock can read it.
Anothe Solution if you can help ':-( how I can link to .DAT interaday) by VBA for Access Dbase.
Private Type myrec ' USER DATA TYPE strName As String * 10 intNumbr As Integer End Type
Private intPosition As Integer
Private Sub add_Click() Dim rec As myrec rec.strName = tname.Text ' Retrieves value from Textbox rec.intNumbr = tnumber.Text Open "c:\f2.dat" For Random As #1 Len = Len(rec) MsgBox intPosition Put #1, intPosition + 1, rec Close #1 intPosition = intPosition + 1 tname.Text = "" tnumber.Text = "" End Sub Private Sub Command1_Click() Dim rec As myrec Dim recnumber As Integer recnumber = txtfindrecno If (recnumber > 0) And (recnumber <= intPosition) Then Open "c:\f2.dat" For Random As #1 Len = Len(rec) Get #1, recnumber, rec tname = rec.strName tnumber = rec.intNumbr Close #1 Else MsgBox "invalid record number" End If End Sub Private Sub Command2_Click() Dim rec As myrec Dim strRecname As String ' This is for what? Dim fFound As Boolean Dim intRecordnumber As Integer intRecordnumber = 0 fFound = False MsgBox txtfindrecname.Text Open "c:\f1.dat" For Random As #1 Len = Len(rec) Do While (Not EOF(1)) And (fFound = False) intRecordnumber = intRecordnumber + 1 Get #1, intRecordnumber, rec MsgBox rec.strName MsgBox rec.intNumbr MsgBox rec.strName If CStr(rec.strName) = CStr(txtfindrecname.Text) Then fFound = True tnumber = rec.intNumbr tname = rec.strName End If Loop Close #1 If Not found Then MsgBox "name " & txtfindrecname & " is not in file" End If
End Sub Private Sub Form_Load() Dim rec As myrec Open "c:\f1.dat" For Random As #1 Len = Len(rec) intPosition = LOF(1) / Len(rec) Close #1 End Sub Private Sub recame_Change() End Sub Private Sub retrieve_Click() Dim rec As myrec Dim fFound As Boolean ' What is this for? Dim strDatatodisplay As String Dim intIndex As Integer Open "c:\f1.dat" For Random As #1 Len = Len(rec) For intIndex = 1 To intPosition Get #1, , rec tname.Text = rec.strName tnumber.Text = rec.intNumbr strDatatodisplay = rec.Name & " " & rec.intNumbr List1.AddItem strDatatodisplay Next intIndex Close #1 End Sub
Private Sub n_Click()
End Sub
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
This code will not do what you want. I cold not find any reference to it in any previous discussions here on the Forum (could you please provide a link so we can read any comments about the code and why it does/doesnt do what it is supposed to do)
Your code does not initialise the MS File Library to access the data contained in the .DAT files. Amongst other things, this is why the code is failing to achieve your aim.
I suspect you have not purchased the MetaStock Developers Kit and therefore do not have the Users Manual and the sample files that show exactly all what needs to be done? There are some people who can manipulate the MS data files without
using the MSFL and the MDK, I have never tried because I have the MDK. I am reasonably certain the majority of the people you find here on the Equis Forum will also have the genuine Equis products. If I am wrong, then please have a look in the C:\Program Files\Equis\MDK\MSFL\Samples\VB folder for the sample code.
Also, MetaStock does not write dat files, it only reads from them. Just because MS can read from a .dat file does not mean that the data is properly formatted in the 'proper' MetaStock format. MS may have some redundancy features in-built to be able to read slightly-differently formatted data to produce a reasonable result. I have never tested this ability; I have never needed to.
wabbit [:D]
P.S. I still don't think you have adequately explained why you need to export the data from one format to another? MS has all the tools you need to conduct analysis; if you have the MDK then you can always add your own tools too. If you explain what yuo are trying to do then we might be able to provide a better solution?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 4/4/2007(UTC) Posts: 4
|
yes I don't have MDK kit and i tried to query about the price it transfere me to fill a long form (I dont like to fill forms) and i want to know the range price of the MDK.
this will be my first choise solution.
but also I want to know the other solution without MDK.
any way thanks for your great help
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Star,
What are the analysis and reports you want to generate from Access on the data? Like all things computing, there is more than one way to achieve your aim. As I do not know what your aim is, I cannot suggest other methods to you.
If you do not want to publicize your methods in the open forum, PM me and tell me there.
wabbit [:D]
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 7/6/2005(UTC) Posts: 8
|
Dear,
I have Program for read/write .dat MSfile (EOD or RT) in VB 6.0.. (direct from VB) w/out MDK Metastock..
I trying to design a AOET (Auto Order Executing Trading System)…
Elec
Christos Papathanasiou
elec@otenet.gr
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Special Interest Groups
»
MetaStock Developer's Kit (MDK) Assistance
»
VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.