Path: blob/master/demo/demo_JPM2024MinDownsideRiskCVXR.R
1433 views
## This R script reproduces the graphs in Exhibits 6, 8, 10,1## 12, 14, 16, 18 of the paper "Minimum Downside Risk Portfolios"2## published in the Journal of Portfolio Management, Oct. 2024.3##4## Copy/past this script into your own computer R file. Then5## run code lines 11 to 262 to create functions that will be6## needed, and run lines 267 to 271 to load packages needed.7## Then we recommend to run code that follows in convenient8## chunks to replicate each of the above Exhits910rm(list = ls())1112# MV: Using CVXR13optimize_portfolio_MV_rebalance <- function(returns, training_period=NULL, rolling_window=NULL,14rebalance_on) {15# Start time16t1 <- Sys.time()1718# Get the number of assets and name of the assets19num_assets <- ncol(returns)20asset_names <- colnames(returns)2122# Set the training period for portfolio optimization with rebalancing23if(is.null(training_period) & !is.null(rolling_window)) {24training_period <- rolling_window25}2627# Determine the dates when rebalancing takes place28epoints <- endpoints(returns, on = rebalance_on)[which(endpoints(returns, on = rebalance_on) >= training_period)]2930# Get the rebalancing dates31rebal_date_indx <- index(returns)[epoints]3233# Matrix to hold the weights34mv_portfolio_wts <- matrix(NA, nrow = length(epoints), ncol = num_assets)35colnames(mv_portfolio_wts) <- asset_names3637# Optimize portfolio at each date38for (j in 1:length(epoints)) {39ep <- epoints[j]40returns_est_window <- returns[(ifelse(ep - rolling_window >= 1, ep - rolling_window, 1)):ep, ]4142# Calculate the mean returns and volatility of returns43mu <- apply(returns_est_window, 2, mean)44mu <- matrix(mu, nrow = num_assets)45Sigma <- cov(returns_est_window)4647# Formulate the optimization problem48wts_mv <- Variable(num_assets)49ret <- t(mu) %*% wts_mv5051# Constraints (long-only and full-investment) for MV portfolio optimization52constraints_mv <- list(wts_mv >= 0,53sum_entries(wts_mv) == 1)5455# Objective function for MV portfolio optimization56objective_mv <- quad_form(wts_mv, Sigma)5758# Solve the MV portfolio optimization problem59prob_mv <- Problem(Minimize(objective_mv), constraints_mv)60result_mv <- solve(prob_mv, solver = 'OSQP')61# cat("\nMV Status of the solution: ", result_mv$status)62# cat("\nMV Solver used: ", result_mv$solver)6364# Evaluate risk and return for current solution65optimal_risk <- sqrt(result_mv$value)66optimal_ret <- result_mv$getValue(ret)6768# Get the optimal weights69wts <- as.vector(result_mv$getValue(wts_mv))70names(wts) <- asset_names71mv_portfolio_wts[j, ] <- t(wts)72}7374# Convert the weights to xts75rebal_mv_wts <- xts(mv_portfolio_wts, order.by = rebal_date_indx)7677# Save the portfolio weights in a list78result <- list(wts = rebal_mv_wts)7980t2 <- Sys.time()81cat("\nTime taken to run the portfolio optimization: ", t2-t1)8283return(result)84}85868788# MES: Using CVXR89optimize_portfolio_MES_rebalance <- function(returns, alpha, training_period=NULL, rolling_window=NULL,90rebalance_on) {9192# Start time93t1 <- Sys.time()9495# Get the number of assets and name of the assets96num_assets <- ncol(returns)97asset_names <- colnames(returns)9899# Set the training period for portfolio optimization with rebalancing100if(is.null(training_period) & !is.null(rolling_window)) {101training_period <- rolling_window102}103104# Determine the dates when rebalancing takes place105epoints <- endpoints(returns, on = rebalance_on)[which(endpoints(returns, on = rebalance_on) >= training_period)]106107# Get the rebalancing dates108rebal_date_indx <- index(returns)[epoints]109110# Matrix to hold the weights111mes_portfolio_wts <- matrix(NA, nrow = length(epoints), ncol = num_assets)112colnames(mes_portfolio_wts) <- asset_names113114# Optimize portfolio at each date115for (j in 1:length(epoints)) {116ep <- epoints[j]117returns_est_window <- returns[(ifelse(ep - rolling_window >= 1, ep - rolling_window, 1)):ep, ]118119# Formulate the optimization problem120# Calculate values of parameters and define variables121J <- nrow(returns_est_window)122X <- as.matrix(returns_est_window)123mu <- colMeans(returns_est_window)124125# Variables126wts_mes <- Variable(num_assets)127z <- Variable(J)128eta <- Variable(1)129130# Constraints (long-only and full-investment) for MES portfolio optimization131constraints_mes <- list(wts_mes >= 0,132sum(wts_mes) == 1,133z >= 0,134z >= -X %*% wts_mes - eta135)136137# Objective function for MES portfolio optimization138# Problem formulation for MES139objective_mes <- eta + (1/(J*alpha)) * sum(z)140141# Solve the MES portfolio optimization problem142prob_mes <- Problem(Minimize(objective_mes), constraints = constraints_mes)143result_mes <- solve(prob_mes, solver = 'SCS')144# cat("\nMES Status of the solution: ", result_mes$status)145# cat("\nMES Solver used: ", result_mes$solver)146147# Get the optimal weights148wts <- as.vector(result_mes$getValue(wts_mes))149names(wts) <- asset_names150mes_portfolio_wts[j, ] <- t(wts)151}152153# Convert the weights to xts154rebal_mes_wts <- xts(mes_portfolio_wts, order.by = rebal_date_indx)155156# Save the portfolio weights in a list157result <- list(wts = rebal_mes_wts)158159t2 <- Sys.time()160cat("\nTime taken to run the portfolio optimization: ", t2-t1)161162return(result)163}164165166167# MCSM: Using CVXR168optimize_portfolio_MCSM_rebalance <- function(returns, alpha, training_period=NULL, rolling_window=NULL,169rebalance_on) {170171# Start time172t1 <- Sys.time()173174# Get the number of assets and name of the assets175num_assets <- ncol(returns)176asset_names <- colnames(returns)177178# Set the training period for portfolio optimization with rebalancing179if(is.null(training_period) & !is.null(rolling_window)) {180training_period <- rolling_window181}182183# Determine the dates when rebalancing takes place184epoints <- endpoints(returns, on = rebalance_on)[which(endpoints(returns, on = rebalance_on) >= training_period)]185186# Get the rebalancing dates187rebal_date_indx <- index(returns)[epoints]188189# Matrix to hold the weights190mcsm_portfolio_wts <- matrix(NA, nrow = length(epoints), ncol = num_assets)191colnames(mcsm_portfolio_wts) <- asset_names192193# Optimize portfolio at each date194for (j in 1:length(epoints)) {195ep <- epoints[j]196returns_est_window <- returns[(ifelse(ep - rolling_window >= 1, ep - rolling_window, 1)):ep, ]197198# Formulate the optimization problem199# Calculate values of parameters and define variables200J <- nrow(returns_est_window)201X <- as.matrix(returns_est_window)202mu <- colMeans(returns_est_window)203204# Variables205wts_mcsm <- Variable(num_assets)206z <- Variable(J)207eta <- Variable(1)208f <- Variable(1)209210# Constraints (long-only and full-investment) for MCSM portfolio optimization211constraints_mcsm <- list(wts_mcsm >= 0,212sum_entries(wts_mcsm) == 1,213z >= 0,214z >= -X %*% wts_mcsm - eta,215f >= p_norm(z, p=2)216)217218# Objective function for MCSM portfolio optimization219# Problem formulation for MCSM (following Krokhmal's algorithm)220objective_mcsm <- eta + (1/(alpha*sqrt(J)))*f221222# Solve the MCSM portfolio optimization problem223prob_mcsm <- Problem(Minimize(objective_mcsm), constraints = constraints_mcsm)224result_mcsm <- solve(prob_mcsm, solver = 'SCS')225# cat("\nMCSM Status of the solution: ", result_mcsm$status)226# cat("\nMCSM solver used: ", result_mcsm$solver)227228# Get the optimal weights229wts <- as.vector(result_mcsm$getValue(wts_mcsm))230names(wts) <- asset_names231mcsm_portfolio_wts[j, ] <- t(wts)232}233234# Convert the weights to xts235rebal_mcsm_wts <- xts(mcsm_portfolio_wts, order.by = rebal_date_indx)236237# Save the portfolio weights in a list238result <- list(wts = rebal_mcsm_wts)239240t2 <- Sys.time()241cat("\nTime taken to run the portfolio optimization: ", t2-t1)242243return(result)244}245246247248# Turnover Control249TOcontrol <- function(wts, delta){250idx <- index(wts)251out <- copy(wts)252TO <- rep(NA, length(idx))253for(i in 2:length(idx)){254currentTO <- sum(abs(coredata(wts[idx[i], ]) - coredata(wts[idx[i-1], ])))255TO[i] <- currentTO256if(currentTO <= delta){257out[idx[i], ] <- out[idx[i-1], ]258}259}260return(wts = out)261}262263###264265# Load packages266library(PortfolioAnalytics)267library(CVXR)268library(data.table)269library(xts)270library(PCRA)271272273# Use CRSP daily data set274stocksCRSPdaily <- getPCRAData(dataset = "stocksCRSPdaily")275dateRange <- c("1993-01-01","2015-12-31")276smallcapTS <- selectCRSPandSPGMI(277periodicity = "daily",278dateRange = dateRange,279stockItems = c("Date", "TickerLast", "CapGroupLast", "Return",280"MktIndexCRSP", "Ret13WkBill"),281factorItems = NULL,282subsetType = "CapGroupLast",283subsetValues = "SmallCap",284outputType = "xts")285286# Extract Market and RF from smallcapTS287Market <- smallcapTS[ , 107]288names(Market) <- "Market"289RF <- smallcapTS[ , 108]290names(RF) <- "RF"291292# Remove "MktIndexCRSP", "Ret13WkBill" from smallcapTS293smallcapTS <- smallcapTS[ , -c(107,108)]294dim(smallcapTS)295296## Exhibit 6 (1 minute 30 seconds)297298returns <- smallcapTS[ , 1:30]299dim(returns)300301# Optimize Portfolio at Monthly Rebalancing and 260-Day Training302rolling_window <- 260303304## MV305opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,306rolling_window = rolling_window,307rebalance_on = "months")308309# Extract portfolio weights from the result310mv_wts <- opt_mv_result$wts311mv_wts <- mv_wts[complete.cases(mv_wts), ]312313## MES05 (for tail probability 5%)314opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,315rolling_window = rolling_window,316rebalance_on = "months")317318# Extract portfolio weights from the result319mes_wts <- opt_mes_result$wts320mes_wts <- mes_wts[complete.cases(mes_wts), ]321322## MES05-TOC323mes_wts_toc <- TOcontrol(mes_wts, 0.9) # Optimal for 1-30324325# Compute returns of the portfolios326MV <- Return.rebalancing(returns, mv_wts)327MES05 <- Return.rebalancing(returns, mes_wts)328MES05TOC <- Return.rebalancing(returns, mes_wts_toc)329330# Combine MV, MES05, MES05_TOC returns331portf_ret_comb <- na.omit(merge(MV, MES05, MES05TOC, Market, all=F))332names(portf_ret_comb) <- c("MV", "MES05", "MES05-TOC", "Market")333334backtest.plot(portf_ret_comb, plotType = "cumRet",335main = "MV, MES05, MES05-TOC(0.9), Stocks 1-30",336colorSet = c("red","darkgreen","darkblue","black"),337ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))338339340## Exhibit 8 (1 minute 28 seconds)341342returns <- smallcapTS[ , 31:60]343dim(returns)344345# Optimize Portfolio at Monthly Rebalancing and 260-Day Training346rolling_window <- 260347348## MV349opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,350rolling_window = rolling_window,351rebalance_on = "months")352353# Extract portfolio weights from the result354mv_wts <- opt_mv_result$wts355mv_wts <- mv_wts[complete.cases(mv_wts), ]356357## MES05 (for tail probability 5%)358opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,359rolling_window = rolling_window,360rebalance_on = "months")361362# Extract portfolio weights from the result363mes_wts <- opt_mes_result$wts364mes_wts <- mes_wts[complete.cases(mes_wts), ]365366## MES05-TOC367mes_wts_toc <- TOcontrol(mes_wts, 0.5) # Optimal for 31-60368369# Compute returns of the portfolios370MV <- Return.rebalancing(returns, mv_wts)371MES05 <- Return.rebalancing(returns, mes_wts)372MES05TOC <- Return.rebalancing(returns, mes_wts_toc)373374# Combine MV, MES05, MES05_TOC returns375portf_ret_comb <- na.omit(merge(MV, MES05, MES05TOC, Market, all=F))376names(portf_ret_comb) <- c("MV", "MES05", "MES05-TOC", "Market")377378backtest.plot(portf_ret_comb, plotType = "cumRet",379main = "MV, MES05, MES05-TOC(0.5), Stocks 31-60",380colorSet = c("red","darkgreen","darkblue","black"),381ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))382383384## Exhibit 10 (1 minute 26 seconds)385386returns <- smallcapTS[ , 61:90]387dim(returns)388389# Optimize Portfolio at Monthly Rebalancing and 260-Day Training390rolling_window <- 260391392## MV393opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,394rolling_window = rolling_window,395rebalance_on = "months")396397# Extract portfolio weights from the result398mv_wts <- opt_mv_result$wts399mv_wts <- mv_wts[complete.cases(mv_wts), ]400401## MES05 (for tail probability 5%)402opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,403rolling_window = rolling_window,404rebalance_on = "months")405406# Extract portfolio weights from the result407mes_wts <- opt_mes_result$wts408mes_wts <- mes_wts[complete.cases(mes_wts), ]409410## MES05-TOC411mes_wts_toc <- TOcontrol(mes_wts, 0.5) # Optimal for 61-90412413# Compute returns of the portfolios414MV <- Return.rebalancing(returns, mv_wts)415MES05 <- Return.rebalancing(returns, mes_wts)416MES05TOC <- Return.rebalancing(returns, mes_wts_toc)417418# Combine MV, MES05, MES05_TOC returns419portf_ret_comb <- na.omit(merge(MV, MES05, MES05TOC, Market, all=F))420names(portf_ret_comb) <- c("MV", "MES05", "MES05-TOC", "Market")421422backtest.plot(portf_ret_comb, plotType = "cumRet",423main = "MV, MES05, MES05-TOC(0.5), Stocks 61-90",424colorSet = c("red","darkgreen","darkblue","black"),425ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))426427428## Get Exhibit 12 microcaps data set429430#' use CRSP daily microcaps data set431stocksCRSPdaily <- getPCRAData(dataset = "stocksCRSPdaily")432dateRange <- c("1993-01-01","2015-12-31")433microcapTS <- selectCRSPandSPGMI(434periodicity = "daily",435dateRange = dateRange,436stockItems = c("Date", "TickerLast", "CapGroupLast", "Return",437"MktIndexCRSP", "Ret13WkBill"),438factorItems = NULL,439subsetType = "CapGroupLast",440subsetValues = "MicroCap",441outputType = "xts")442443# Extract Market and RF from microcapTS444Market <- microcapTS[ , 35]445names(Market) <- "Market"446RF <- microcapTS[ , 36]447names(RF) <- "RF"448449# Remove "MktIndexCRSP", "Ret13WkBill"450microcapTS <- microcapTS[ , -c(35, 36)]451returns <- microcapTS452453454## Exhibit 12 (1 minute 33 seconds)455456# Optimize Portfolio at Monthly Rebalancing and 260-Day Training457rolling_window <- 260458459## MV460opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,461rolling_window = rolling_window,462rebalance_on = "months")463464# Extract portfolio weights from the result465mv_wts <- opt_mv_result$wts466mv_wts <- mv_wts[complete.cases(mv_wts), ]467468## MES05 (for tail probability 5%)469opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,470rolling_window = rolling_window,471rebalance_on = "months")472473# Extract portfolio weights from the result474mes_wts <- opt_mes_result$wts475mes_wts <- mes_wts[complete.cases(mes_wts), ]476477## MES05-TOC478mes_wts_toc <- TOcontrol(mes_wts, 0.5)479480# Compute returns of the portfolios481MV <- Return.rebalancing(returns, mv_wts)482MES05 <- Return.rebalancing(returns, mes_wts)483MES05TOC <- Return.rebalancing(returns, mes_wts_toc)484485# Combine MV, MES05, MES05_TOC returns486portf_ret_comb <- na.omit(merge(MV, MES05, MES05TOC, Market, all=F))487names(portf_ret_comb) <- c("MV", "MES05", "MES05-TOC", "Market")488489backtest.plot(portf_ret_comb, plotType = "cumRet",490main = "MV, MES05, MES05-TOC(0.5), Microcaps 34",491colorSet = c("red","darkgreen","darkblue","black"),492ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))493494495## Exhibit 14 (2 minutes 34 seconds)496497returns <- smallcapTS[ , 1:30]498499# Optimize Portfolio at Monthly Rebalancing and 260-Day Training500rolling_window <- 260501502## MV503opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,504rolling_window = rolling_window,505rebalance_on = "months")506507# Extract portfolio weights from the result508mv_wts <- opt_mv_result$wts509mv_wts <- mv_wts[complete.cases(mv_wts), ]510511## MES05 (for tail probability 5%)512opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,513rolling_window = rolling_window,514rebalance_on = "months")515516# Extract portfolio weights from the result517mes_wts <- opt_mes_result$wts518mes_wts <- mes_wts[complete.cases(mes_wts), ]519520## MES05-TOC521mes_wts_toc <- TOcontrol(mes_wts, 0.9) # Optimal for 1-30522523## MCSM15 (for tail probability 15%)524opt_mcsm_result <- optimize_portfolio_MCSM_rebalance(returns = returns, alpha = 0.15,525rolling_window = rolling_window,526rebalance_on = "months")527528# Extract portfolio weights from the result529mcsm_wts <- opt_mcsm_result$wts530mcsm_wts <- mcsm_wts[complete.cases(mcsm_wts), ]531532## MCSM15-TOC533mcsm_wts_toc <- TOcontrol(mcsm_wts, 0.8) # Optimal for 1-30534535# Compute cumulative returns of the portfolios536MV <- Return.rebalancing(returns, mv_wts)537MES05TOC <- Return.rebalancing(returns, mes_wts_toc)538MCSM15TOC <- Return.rebalancing(returns, mcsm_wts_toc)539540# Combine MV, MES05TOC, MCSM05TOC gross cumulative returns541portf_ret_comb <- na.omit(merge(MV, MES05TOC, MCSM15TOC, Market, all=F))542names(portf_ret_comb) <- c("MV", "MES05-TOC", "MCSM15-TOC", "Market")543544backtest.plot(portf_ret_comb, plotType = "cumRet",545main = "MV, MES05-TOC(0.9), MCSM15-TOC(0.8), Stocks 1-30",546colorSet = c("red","darkgreen","darkblue","black"),547ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))548549550## Exhibit 16 (2 minutes 35 seconds)551552returns <- smallcapTS[ , 31:60]553554# Optimize Portfolio at Monthly Rebalancing and 260-Day Training555rolling_window <- 260556557## MV558opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,559rolling_window = rolling_window,560rebalance_on = "months")561562# Extract portfolio weights from the result563mv_wts <- opt_mv_result$wts564mv_wts <- mv_wts[complete.cases(mv_wts), ]565566## MES05 (for tail probability 5%)567opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,568rolling_window = rolling_window,569rebalance_on = "months")570571# Extract portfolio weights from the result572mes_wts <- opt_mes_result$wts573mes_wts <- mes_wts[complete.cases(mes_wts), ]574575## MES05-TOC576mes_wts_toc <- TOcontrol(mes_wts, 0.5) # Optimal for 31-60577578## MCSM15 (for tail probability 15%)579opt_mcsm_result <- optimize_portfolio_MCSM_rebalance(returns = returns, alpha = 0.15,580rolling_window = rolling_window,581rebalance_on = "months")582583# Extract portfolio weights from the result584mcsm_wts <- opt_mcsm_result$wts585mcsm_wts <- mcsm_wts[complete.cases(mcsm_wts), ]586587## MCSM15-TOC588mcsm_wts_toc <- TOcontrol(mcsm_wts, 0.6) # Optimal for 31-60589590# Compute cumulative returns of the portfolios591MV <- Return.rebalancing(returns, mv_wts)592MES05TOC <- Return.rebalancing(returns, mes_wts_toc)593MCSM15TOC <- Return.rebalancing(returns, mcsm_wts_toc)594595# Combine MV, MES05TOC, MCSM05TOC gross cumulative returns596portf_ret_comb <- na.omit(merge(MV, MES05TOC, MCSM15TOC, Market, all=F))597names(portf_ret_comb) <- c("MV", "MES05-TOC", "MCSM15-TOC", "Market")598599backtest.plot(portf_ret_comb, plotType = "cumRet",600main = "MV, MES05-TOC(0.5), MCSM15-TOC(0.6), Stocks 31-60",601colorSet = c("red","darkgreen","darkblue","black"),602ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))603604605## Exhibit 18 (2 minutes 36 seconds)606607returns <- smallcapTS[ , 61:90]608609# Optimize Portfolio at Monthly Rebalancing and 260-Day Training610rolling_window <- 260611612## MV613opt_mv_result <- optimize_portfolio_MV_rebalance(returns = returns,614rolling_window = rolling_window,615rebalance_on = "months")616617# Extract portfolio weights from the result618mv_wts <- opt_mv_result$wts619mv_wts <- mv_wts[complete.cases(mv_wts), ]620621## MES05 (for tail probability 5%)622opt_mes_result <- optimize_portfolio_MES_rebalance(returns = returns, alpha = 0.05,623rolling_window = rolling_window,624rebalance_on = "months")625626# Extract portfolio weights from the result627mes_wts <- opt_mes_result$wts628mes_wts <- mes_wts[complete.cases(mes_wts), ]629630## MES05-TOC631mes_wts_toc <- TOcontrol(mes_wts, 0.6) # Optimal for 61-90632633## MCSM15 (for tail probability 15%)634opt_mcsm_result <- optimize_portfolio_MCSM_rebalance(returns = returns, alpha = 0.15,635rolling_window = rolling_window,636rebalance_on = "months")637638# Extract portfolio weights from the result639mcsm_wts <- opt_mcsm_result$wts640mcsm_wts <- mcsm_wts[complete.cases(mcsm_wts), ]641642## MCSM15-TOC643mcsm_wts_toc <- TOcontrol(mcsm_wts, 0.8) # Optimal for 61-90644645# Compute cumulative returns of the portfolios646MV <- Return.rebalancing(returns, mv_wts)647MES05TOC <- Return.rebalancing(returns, mes_wts_toc)648MCSM15TOC <- Return.rebalancing(returns, mcsm_wts_toc)649650# Combine MV, MES05TOC, MCSM15TOC gross cumulative returns651portf_ret_comb <- na.omit(merge(MV, MES05TOC, MCSM15TOC, Market, all=F))652names(portf_ret_comb) <- c("MV", "MES05-TOC", "MCSM15-TOC", "Market")653654backtest.plot(portf_ret_comb, plotType = "cumRet",655main = "MV, MES05-TOC(0.6), MCSM15-TOC(0.8), Stocks 61-90",656colorSet = c("red","darkgreen","darkblue","black"),657ltySet = c(3, 1, 1, 1), lwdSet = c(0.7, 0.7, 0.7, 0.7))658659660661