Hello guys,
I struggle to code a function in Excel/VBA (Excel 2007). The intention of the function is to compute a price for an option (based on the simulated prices of 20 underlying stocks).
The simulation of the pricepaths for the stocks is based on a geometric Brownian motion.

Some other explanations:
  • chofactor is a 20x20 matrix, S0 is 1x20 matrix, weights is 1x20 Matrix
  • The complete loop has to be computed "numruns" times
  • each pricepath has "N" steps
  • UNRV is an array of 20 random numbers
  • CNRV is an array of 20 correlated random numbers (by multiplication of UNRV and the Matrix chofactor)
  • Pricepath is simulated price over "N" periods of each stock


The code:

Please Login or Register  to view this content.
Thank you in advance