This project constructs an optimal portfolio using the Black-Litterman model based on LQ45 and IHSG monthly returns (2021–2025), where risk and performance are evaluated through Monte Carlo simulation, Value at Risk (VaR), and Tail Value at Risk (TVaR), followed by a comparison with alternative investment strategies.
Monthly returns of selected LQ45 stocks were imported and prepared for the Black-Litterman portfolio optimization.
# 1. Import dataset return saham
Return <- read.csv(
"ReturnSaham.csv",
sep = ";",
header = TRUE
)
# 2. Define all stock tickers and the benchmark (IHSG)
kode_saham <- c(
"ADRO","ANTM","ASII","BBCA","BBNI","BBTN","BBRI",
"BMRI","CPIN","EXCL","ICBP","INCO","INDF","INKP",
"ITMG","KLBF","MDKA","MEDC","PGAS","PTBA","SMGR",
"TLKM","TOWR","UNTR","UNVR","IHSG"
)
# 3. Extract columns dynamically using the kode_saham vector
data_return <- Return[,1:26]
# 4. Assign and verify column names
colnames(data_return) <- kode_saham
Following the initial screening process based on expected return and normality criteria, 9 stocks were selected as eligible candidates for portfolio formation.
# Store the list of stocks that passed the screening criteria
Kode_Saham_Lolos <- c("ASII","BBCA","BBNI","BBRI","EXCL",
"INDF","MDKA","TLKM","UNTR")
# Display the screening results
Kode_Saham_Lolos
## [1] "ASII" "BBCA" "BBNI" "BBRI" "EXCL" "INDF" "MDKA" "TLKM" "UNTR"
The Black-Litterman model combines market equilibrium returns with investor views to derive posterior expected returns for portfolio optimization.
# Black-Litterman Formula Computation
rBL_3 <- ER_CAPM_matrix_3 +
tau * mtr_cov_3 %*%
t(P3) %*%
solve(OMEGA_3 + tau * t(P3) %*% mtr_cov_3 %*% P3) %*%
(Q3 - P3 %*% ER_CAPM_matrix_3)
The distribution of optimal portfolio weights for the three selected stocks derived from the Black-Litterman model is visualized below:
The optimization results select BBCA, INDF, and MDKA as the optimal portfolio assets from 9 selected stocks.
Monte Carlo simulation is used to evaluate the optimal Black-Litterman portfolio, generating 1,000 investment paths over a 12-month horizon based on expected return and volatility.
# Core mathematical loop for generating investment paths
for(i in 1:n_simulation){
value <- numeric(n_month)
value[1] <- initial_investment
for(j in 2:n_month){
r <- rnorm(1, mean = expected_return, sd = volatility)
value[j] <- value[j-1] * exp(r)
}
}
The simulation presents 1,000 paths, where light-blue lines indicate individual scenarios and the red line represents the average portfolio performance, showing an overall upward trend with stable fluctuations.
The downside risk of the optimized portfolio is measured using Value at Risk (VaR) and Tail Value at Risk (TVaR) based on the simulated portfolio values at the end of the investment horizon.
ggplot(risk_long, aes(Confidence, Value / 1e6, fill = Measure)) +
geom_col(position = "dodge", width = 0.65) +
geom_text(
aes(label = round(Value / 1e6, 2)),
position = position_dodge(0.65),
vjust = -0.4,
size = 4
) +
scale_fill_manual(values = c("#87CEEB", "#B69D82")) +
labs(
title = "Value at Risk vs Tail Value at Risk",
x = "Confidence Level",
y = "Potential Loss (Million IDR)"
) +
theme_minimal(base_size = 13) +
theme(
legend.title = element_blank(),
plot.title = element_text(face = "bold", hjust = 0.5)
)
The VaR and TVaR values increase with higher confidence levels, indicating larger potential losses under more conservative risk settings. TVaR is consistently higher than VaR because it measures the average loss beyond the VaR threshold, providing a more complete view of tail risk.
Model validation is executed to ensure the reliability and statistical accuracy of the risk estimations. The Value at Risk (VaR) model is evaluated using the Kupiec Proportion of Failures (POF) Test, while the Tail Value at Risk (TVaR) model is assessed via the Expected Shortfall (ES) Backtest.
| Validation Test | Value | Threshold / Critical Value |
|---|---|---|
| Kupiec LR (POF Test) | 1.0316 | 3.841 |
| ES Test (Exceedance Backtest) | 0.5080 | 0.050 |
VaR Validation: The Kupiec LR statistic (1.0316) is lower than the critical value (3.841), confirming that the Value at Risk model is statistically acceptable.
TVaR Validation: The Expected Shortfall test yielded a p-value of 0.5080. Since it exceeds the 5% significance level (\(\alpha = 0.05\)), the Tail Value at Risk model is verified as reliable.
To evaluate the effectiveness of the Black-Litterman approach, the optimized portfolio is compared against alternative investment strategies (individual stock allocations and an Equal Weight strategy) based on expected return and downside risk (TVaR 95%).
The Black-Litterman portfolio outperforms naive strategies by achieving the highest expected return (8.71 Million IDR) while successfully minimizing downside risk to the lowest TVaR (15.21 Million IDR). This proves that incorporating investor views through this framework delivers a highly efficient and optimal risk-return trade-off.
In conclusion, backtesting statistically validates the high reliability of both the VaR and TVaR risk models. Furthermore, the Black-Litterman optimization proves highly superior, delivering the highest expected return (8.71M IDR) alongside the lowest downside risk (15.21M IDR). Ultimately, the 1,000 Monte Carlo simulation paths confirm that this framework ensures a remarkably stable and efficient long-term growth trajectory for the portfolio.