Question: Please fix and debug this code, without changing the functionality of the code for VBA Function Rainbow_MonteCarlo_Submission(Codes, S_0, TTM, rf_rate, History, SampleCount) 'Get some of

Please fix and debug this code, without changing the functionality of the code for VBA

Function Rainbow_MonteCarlo_Submission(Codes, S_0, TTM, rf_rate, History, SampleCount) 'Get some of those basic inputs - ask Dave what these are for! Dim Num1, Num2, Num3 Num1 = Codes.Cells.Count Num2 = TTM * 30 Num3 = 1 / 252 Dim StV() As Double ReDim StV(1 To Num1) For i = 1 To Num1 'Can we also maybe get correlation from this? BIGtempograbbo = Stock_Vol_Grab_Submission(History.Columns(i)) ' Check the other function for notes on how this works I don'tr have time to explain it here. - Dave StV(i) = BIGtempograbbo 'Multiple outputs from the function maybe? Saves calling it a few dozen times per run? Next i 'Aaron says we should be able to create a generic variance/covariance function 'that can find not only the volatility of one stock but generate an entire 'set of variance/covariance relations between all of them? - Geoff 'That's grat, maybe get Aaron to build this then? - Dave 'Setup antithetic outputs please Dave, to improve speed and reduce variance? Dim CallStock_T_alpha As LongLong, CallStock_T_beta As LongLong Dim PutStock_T_alpha As LongLong, PutStock_T_beta As LongLong '***NOT USED - Don't know what you mean - From Dave 'Also, pretty sure we can just save time with Ergodicity? Dim Payoff() As LongLong, Price_T() As LongLong ReDim Payoff(1 To Counter1, 1 To SampleCount) ReDim Price_T(1 To Counter1, 1 To SampleCount) For RunNum = 1 To SampleCount For i = 1 To Num1 Price_T(i, RunNum) = GBM_Sim_Stock_Submission(S_0.Cells(i), rf_rate, StV(i), Num2, Num3, RunNum) 'Wait, Dave - why is this a subfunction? Is that necessary? Next i Next RunNum 'Dave, Why are the output prices stored as variants? - Geoff 'Just trust me - it works - Dave Dim Output() As Double 'I changed this from 'Variant' to Double - Geoff ReDim Output(1 To (2 * Num1), 1 To (Num1 - 1)) 'I have no idea how this whole output generation part works - where is the option here? For CallOn = 1 To Num1 Position = 0 For PutOn = 1 To Num1 'Grab the 2 stocks 'WHY ISN'T THIS WORKING - SOMEBODY HELP ME DEBUG!! >.

Please fix and debug this code, without changing the functionality of thecode for VBA Function Rainbow_MonteCarlo_Submission(Codes, S_0, TTM, rf_rate, History, SampleCount) 'Get someof those basic inputs - ask Dave what these are for! DimNum1, Num2, Num3 Num1 = Codes.Cells.Count Num2 = TTM * 30 Num3= 1 / 252 Dim StV() As Double ReDim StV(1 To Num1)

Function Rainbow_MonteCarlo_Submission(Codes, S_0, TTM, rf_rate, History, SampleCount) 'Get some of those basic inputs ask Dave what these are for! Dim Numi, Num2, Num3 Num1 = Codes.Cells.Count Num2 = TTM * 30 Num3 1/ 252 Dim StV() As Double ReDim StV(1 To Num 1) For i = 1 To Num1 'Can we also maybe get correlation from this? BIGtempograbbo = Stock_Vol_Grab_Submission(History.Columns(i)) 'Check the other function for notes on how this works I don'tr have time to explain it here. Dave StV(i) = BIGtempograbbo 'Multiple outputs from the function maybe? Saves calling it a few dozen times per run? Next i = = 'Aaron says we should be able to create a generic variance/covariance function 'that can find not only the volatility of one stock but generate an entire 'set of variance/covariance relations between all of them? - Geoff 'That's grat, maybe get Aaron to build this then? Dave 'Setup antithetic outputs please Dave, to improve speed and reduce variance? Dim CallStock_T_alpha As LongLong, CallStock_T_beta As LongLong Dim PutStock_T_alpha As LongLong, PutStock_T_beta As LongLong ****NOT USED - Don't know what you mean - From Dave 'Also, pretty sure we can just save time with Ergodicity? Dim Payoff() As LongLong, Price_T() As LongLong = = Dim Payoff() As LongLong, Price_T() As LongLong ReDim Payoff(1 To Counter1, 1 To SampleCount) ReDim Price_T(1 To Counter1, 1 To SampleCount) For RunNum 1 To SampleCount For i = 1 To Num1 Price_T(i, RunNum) = GBM_Sim_Stock_Submission(S_0.Cells(i), rf_rate, StV(i), Num2, Num3, RunNum) 'Wait, Dave - why is this a subfunction? Is that necessary? Next i Next RunNum 'Dave, Why are the output prices stored as variants? - Geoff 'Just trust me it works - Dave Dim Output() As Double 'I changed this from 'Variant' to Double - Geoff ReDim Output(1 To (2 * Num1), 1 To (Num1 - 1)) 'I have no idea how this whole output generation part works - where is the option here? For Callon 1 To Num1 Position 0 = For Put On = 1 To Num1 'Grab the 2 stocks 'WHY ISN'T THIS WORKING SOMEBODY HELP ME DEBUG!! >..

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!