question

David Harper CFA FRM

David Harper CFA FRM
Subscriber
Hi faisie,

Thanks for liking the MCS spreadsheet. That would be fun to code. I don't have time but one approach would be to populate an array with the same procedure, a loop as follows (this is just off the cuff, i haven't thought it thru):

Dim MCS(180,1000)
For i = 1 to 1000
Price [0,i] = $20
For j = 1 to 180
Price [j,i] = Price[j-1,i] + the algorithm here
Next j
Next i

That will populate the array, such that Price [180,i] is the vector of final prices...
of course, you don't need to store the interim prices could just recursively solve with:

Dim MCS(1000)
For j = 1 to 1000
Price [j] = $20
For i = 1 to 180
Price [j] = Price[j] + the algorithm here
Next i
Next j


...but i don't know if that's faster? I hope that helps, if you code it, please do share!

David
 
Top