%Test program to demonstrate how to write modular code

mu=0.00155;             % daily mean return
sigma=.0242;             % volatility
t=1;                     % number of periods
S0=91.7;                 % Beginning stock price
n=100;                   % Number of shares
S=[];                    % This will hold our stock price distribution
conf=0.99;               % the confidence level we are working at
iter=10000;

VAR_10000=calc_VAR(10000,mu,sigma,t,S0,n,conf)
VAR_100000=calc_VAR(100000,mu,sigma,t,S0,n,conf)

%or let's get a distribution of VARs
VARS=[];
for i=1:5000
 VARS=cat(1,VARS,calc_VAR(iter,mu,sigma,t,S0,n,conf));
end;
plot(sort(VARS));