I’ve written a code in Visual basic (excel macro), to do Monte Carlo repetitions to find the value at risk. for this reason, I’ve used Cornish-fisher expansion.
The formula for Value at risk, uses volatility, skewness and excess kurtosis and the number of trading periods in the recommended holding period to find the value at risk.
Then the code uses the formula of moments to find 4 moments and then calculating the value of volatility, skewness and excess kurtosis. according to the formula’s presented below:
and then the code will use the recommended holding period T to find VaR equivalence volatility:
After finding the annualized volatility the code does the Monte Carlo repetition and calculates the annualized volatility for all existing periods.
Then the code sorts the data in ascending order and will gets the 97.5% percentile value at risk. after that the code will checks the following conditional statements to find the MRM class of the data.
the code also checks the PRIIP category 2 value at 10% percentile, 50% percentile and 90% percentile to categorize the stock value at risk as, unfavorable, moderate and favorable respectively.
below, we could see a screenshot taken from the code: