Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 02-01-07   #1 (permalink)
Audiophile
 
Jimmy2Shoe's Avatar
 
intel nvidia

Join Date: Jun 2006
Posts: 1,063

Rep: 59 Jimmy2Shoe is acknowledged by some
Unique Rep: 48
FAQs Submitted: 1
Trader Rating: 0
Default Visual Basic + Excel Programming Help!

Hello all,

Seing as it's my last term at business school, I decided to take a class in Financial Modelling. Now I didn't know much of VB getting in, and well... I need some help from a pro.

I want to create a function that will allow you select a series of prices of a stock, and return the variance of the returns/losses.

1st trick: The input, a series in Excel (array in VB speak?) will be prices, and not daily losses returns. So one would have to take the n-th price and devide by previous price n-1. Then you must subtract 1 to the result of that division to get the % variation from one day to the next. I presume that you would have to store these results somewhere.

This is what I have, but it's mostly garbage. Don't worry about the 2nd variable, lambda... that is a "side" function that I must write up, easy enough to do.... I'm not sure that the VAR function in excel lets you use a range as an input.

Code:
Option Explicit
Function volatilite(donnees As Range, lambda)
Dim lambda As Integer
Dim numRow As Integer
numRow = donnees.Rows.Count
dim matrice as double

For i = 1 To numRows
    matrice(i - 1) = Application.WorksheetFunction.Var(donnees)
    Next i


End Function

Would it be best if I gave you the mathimatical formula? It's a little tricky to type out unfortunately... but maybe I can scan a page and put it in JPG.

It's basically the sum (from 1 to i prices) of the cubed prices divided by the number of prices i.

Wait:
Attached Files
File Type: doc Help.doc (18.5 KB, 15 views)

System: My System
CPU
Core 2 Duo E6300
Motherboard
Gigabyte GA-965P-S3
Memory
2x1GB G.Skill HK series
Graphics Card
eVGA GeForce 6200TC
Hard Drive
320GB Seagate 7200.10
Sound Card
Firestone Audio Fubar DAC
Power Supply
Antec NeoPower 500W
Case
Thermaltake Soprano
OS
Vista XP Pro
Monitor
Samsung Syncmaster 940BW
Jimmy2Shoe is offline Jimmy2Shoe's Gallery   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 10:27 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.22143 seconds with 9 queries