in Search

VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

Last post 05-03-2007, 11:04 by elec. 9 replies.
Sort Posts: Previous Next
  •  04-04-2007, 21:19 23606

    VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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

  •  04-04-2007, 21:51 23607 in reply to 23606

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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 Big Smile [:D]

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  04-04-2007, 22:12 23608 in reply to 23607

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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).

  •  04-05-2007, 3:49 23611 in reply to 23608

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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 Big Smile [:D]



    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  04-05-2007, 4:32 23612 in reply to 23611

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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

  •  04-05-2007, 5:18 23616 in reply to 23612

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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 Big Smile [: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?



    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  04-05-2007, 5:24 23617 in reply to 23616

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    The source of this code: http://www.daniweb.com/techtalkforums/printthread1794.html does notrefer to MS data files, it is for generic random access files.


    wabbit Big Smile [:D]



    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  04-05-2007, 5:37 23619 in reply to 23616

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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

  •  04-05-2007, 6:01 23620 in reply to 23619

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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 Big Smile [:D]

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status : wabbit.com.au SkyPE online status
    My SkyPE account : wabbit.com.au

  •  05-03-2007, 11:04 23929 in reply to 23612

    Re: VisualBasic is useful if you want ot access the MetaStock File Library and make form based applications etc

    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

     


    elec@otenet.gr
View as RSS news feed in XML