Results 1 to 1 of 1

standard deviation

Threaded View

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    7

    standard deviation

    Hey,
    I have got an Excel worksheet with a lot of stock prices.
    I have to calculate the return, the expected return and the standard deviation.
    For the expected return and the standard deviation i need to cover 60 days out of 1200 days and have to move on the window - so i start from day 1 to day 60, my next value is 2 to day 61 etc.
    My expected return code works, but my standard deviation does not work properly...do you have any ideas for an improvement?
    For n = 1 To UBound(St) - 1
         return(n) = (St(n, 1) / St(n + 1, 1)) - 1
        Next n
    'Berechnung des E-Werts'
    
      For i = 1 To 1141
        Sum = 0
        For n = 1 To 60
         Sum = Sum + return(i + n - 1)
    
        Next
       WinAve(i, 1) = Sum / 60
     
     Next i
     
      For i = 1 To 1141
        SumSq = 0
        For n = 1 To 60
              SumSq = SumSq + (return(n) - WinAve(i, 1)) ^ 2
               StdDev = Sqr(SumSq / (60 - 1))
              Next n
     
       WinStd(i, 1) = StdDev
     Next i
    Last edited by Leith Ross; 05-21-2014 at 09:54 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Standard Deviation
    By mar_bun in forum Excel General
    Replies: 1
    Last Post: 06-29-2010, 03:19 AM
  2. Standard Deviation
    By King_Junior in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-16-2009, 03:53 PM
  3. [SOLVED] standard deviation
    By Arne Hegefors in forum Excel General
    Replies: 7
    Last Post: 08-06-2006, 08:15 AM
  4. standard deviation
    By freddie mac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2006, 12:20 PM
  5. Standard Deviation help
    By paddyb270 in forum Excel General
    Replies: 1
    Last Post: 10-30-2005, 07:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1