I don't see how you get an answer from the following - it looks incomplete, at the very least because "n" is not defined; I assume it's a loop counter though it must begin at least at 2 since you're dividing by "n-1".
Do you know where the magic value "0.34" comes from? I assume you mean "sigma" where you write "rho". In any case, what answer do you get for the volatility of your made-up data? Even better, if you go to http://finance.yahoo.com/q/hp?s=%5EOEX , you can download historical high, low, open and close data for the S&P 100 index (OEX) and run the calculation on real numbers. You can then do a sanity check on the results of your calculation by comparing them to the values of the VIX - the volatility index on the OEX. You can get VIX data at http://finance.yahoo.com/q/hp?s=%5EVIX . I'd be interested in the results. Devon On 6/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: NB. I just thought somebody would like to see the results of your help. NB. First I create wildly stock open/close/hi/low data. openData =: 1 2 3 4 5 6 7 8 9 closeData =: 10 20 30 40 50 60 70 80 90 highData =: 15 25 35 45 55 65 75 85 95 lowData =: 1 2 3 4 5 6 7 8 9 NB. Now I create the vectors so they represent the correct data. Oi =: }. openData Ci =: }. closeData Ci_1 =: }: closeData Hi =: }. highData Li =: }. lowData ln =: ^. NB. produce natural log of a number k =: 0.34 % ( 1 + ( ( n + 1 ) % ( n - 1 ))) NB. OK rho2_rs =: ( Z % n ) * ( +/ ((ln( Hi % Ci)) * (ln( Hi % Oi))) + ( ln (Li % Ci)) * ( ln ( Li % Oi))) u_close =: ( 1 % n) * ( +/ ln ( Ci % Oi)) rho2_close =: (Z %( n-1)) * ( +/ *: ( ln ( Ci % Oi) - u_close )) u_open =: (1 % n ) * ( +/ (ln Oi % Ci_1)) rho2_open_square =: (Z % ( n - 1 )) * ( +/ *: ( ln (( Oi ) % ( Ci_1 )))) rho_squared =: rho2_open_square + ( k * rho2_close ) + (( 1 - k) * rho2_rs) NB. Thanks... See Http://www.sitmo.com/eq/417 for the equations. ----- Original Message Follows ----- ... -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
