Click here to Skip to main content
15,849,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to capture the results of Financial Formulas in my VB.Net 2012 program.

I have just learned (self taught) VB.net using Visual studio 2012 Express. Almost all of the examples I have found are older C# which do not convert into 2012. I am having trouble manually translating especially when so much is hidden in the chart parameters. I would like VB.Net info is possible.

I am using a Downloaded CSV file with 255 rows of Stock quote data; Formated like this
Date,Open,High,Low,Close,Volume,Adj Close
2012-06-15,8.73,8.82,8.65,8.82,16952400,8.82

I would like to calculate the value each day using several chart formulas and compare the results to the Adj Close for that day to determine if I should look at the stock further.

so here are the questions:
1. How can I get access to the results of the MSChart formulas so I can process them within my program.

2. Are there examples or hints somewhere that shows how to take my 250 rows of CSV data and process through formulas. All the examples I have found only have a couple of rows fo program generated data. When I try to adapt to my file i get a message "Invalid Period specified for the ACCUMULATEDDISTRIBUTION formula.Increase the number of data points, or decrease the Period" , I do not know how to do either.

this is what I have tryed so far adapter from C# examples:
If File.Exists(TempDir + "\" + TempFile) = False Then
           strMessage = "File does not exist"
           MessageBox.Show(strMessage)
       End If
       ' Create a connection string.
       Dim ConStr As String = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & TempDir & ";" & "Extended Properties=""Text;HDR=no;FMT=Delimited;""")
       Dim myConnection As New OleDbConnection(ConStr)

       ' Create a database command on the connection using query
       Dim mySelectQuery As String = "Select * from " + TempFile
       Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
       Try
           ' Open the connection and create the reader
           myCommand.Connection.Open()
           Dim myReader As OleDbDataReader = myCommand.ExecuteReader '(CommandBehavior.CloseConnection)

            Chart1.DataManipulator.FinancialFormula(FinancialFormula.AccumulationDistribution, "Input:Y,Input:Y2,Input:Y4,Volume", "Indicators")
           ' Close connection and data reader
           myReader.Close()
           myConnection.Close()
       Catch ex As Exception
           strMessage = ex.Message
           MessageBox.Show(strMessage)
       End Try
Posted
Updated 9-May-13 6:08am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900