1. Trang chủ
  2. » Luận Văn - Báo Cáo

(LUẬN văn THẠC sĩ) nghiên cứu phương pháp tiếp cận mờ trong lựa chọn danh mục dự án đầu tư tối ưu

227 5 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC KINH TẾ TP.HỒ CHÍ MINH  CÁI PHÚC THIÊN KHOA NGHIÊN CỨU PHƯƠNG PHÁP TIẾP CẬN MỜ TRONG LỰA CHỌN DANH MỤC ĐẦU TƯ TỐI ƯU LUẬN VĂN THẠC SĨ KINH TẾ THÀNH PHỐ HỒ CHÍ MINH - NĂM 2013 TIEU LUAN MOI download : skknchat@gmail.com BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC KINH TẾ TP.HỒ CHÍ MINH  CÁI PHÚC THIÊN KHOA NGHIÊN CỨU PHƯƠNG PHÁP TIẾP CẬN MỜ TRONG LỰA CHỌN DANH MỤC ĐẦU TƯ TỐI ƯU Chuyên ngành : TÀI CHÍNH – NGÂN HÀNG Mã số : 60340201 LUẬN VĂN THẠC SĨ KINH TẾ NGƯỜI HƯỚNG DẪN KHOA HỌC PGS.TS NGUYỄN THỊ LIÊN HOA THÀNH PHỐ HỒ CHÍ MINH - NĂM 2013 TIEU LUAN MOI download : skknchat@gmail.com CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc Lập – Tự Do – Hạnh Phúc LỜI CAM ĐOAN Tôi xin cam đoan Luận văn Thạc sĩ Kinh tế “Nghiên cứu phương pháp tiếp cận mờ lựa chọn danh mục đầu tư tối ưu” cơng trình nghiên cứu riêng Các kết nghiên cứu luận văn trung thực chưa cơng bố cơng trình khác Học viên cao học Cái Phúc Thiên Khoa TIEU LUAN MOI download : skknchat@gmail.com MỤC LỤC TRANG PHỤ BÌA LỜI CAM ĐOAN MỤC LỤC DANH MỤC CÁC KÝ HIỆU VÀ CHỮ VIẾT TẮT DANH MỤC CÁC BẢNG DANH MỤC CÁC BIỂU ĐỒ DANH MỤC CÁC HÌNH VẼ TĨM TẮT CHƯƠNG 1: GIỚI THIỆU CHƯƠNG 2: TỔNG QUAN CÁC NGHIÊN CỨU TRƯỚC ĐÂY 2.1 Lý thuyết tập mờ số mờ (Fuzzy set theory and Fuzzy number) 2.1.1 Logic mờ (Fuzzy Logic) 10 2.1.1.1 Logic truyền thống cổ điển .10 2.1.1.2 Logic đa trị (multi-valued logic) .10 2.1.2 Tập mờ (Fuzzy Set) 11 2.1.3 Số mờ (Fuzzy Number) 13 2.1.3.1 Số mờ hình tam giác (triangular fuzzy number) .14 2.1.3.2 Số mờ hình thang (trapezoid fuzzy number) 16 2.1.3.3 Số mờ LR (LR Fuzzy Number) (Basim & Imad, 2003) 18 2.2 Rủi ro giảm giá mờ (Fuzzy Downside Risk) 19 CHƯƠNG 3: PHƯƠNG PHÁP NGHIÊN CỨU 21 3.1 Mơ hình nghiên cứu 21 3.2 Lấy mẫu xử lý liệu 32 3.3 Tính toán danh mục tối ưu mờ (fuzzy portfolio) 33 3.4 Tính tốn danh mục tối ưu theo phương pháp giản đơn (naïve portfolio selection) 34 CHƯƠNG 4: NỘI DUNG VÀ CÁC KẾT QUẢ NGHIÊN CỨU 35 4.1 Những điểm chung mơ hình 35 4.1.1 Sự hội tụ số lượng chứng khoán danh mục tối ưu 35 TIEU LUAN MOI download : skknchat@gmail.com 4.1.2 Tính đa dạng hóa danh mục tối ưu: 45 4.1.3 Hiệu danh mục mờ tối ưu so với danh mục mờ 1/N: 45 4.1.4 Vị trí đường biên hiệu λ thay đổi 47 4.2 Mô hình (Zulkifli Mohamed cộng sự, 2009) 48 4.3 Điều chỉnh mơ hình P1 & P2 (Vercher cộng sự, 2007) 49 4.4 Điều chỉnh mơ hình (Zulkifli Mohamed cộng sự, 2009) 51 CHƯƠNG 5: KẾT LUẬN & THẢO LUẬN .53 5.1 Kết luận 53 5.2 Thảo luận 54 TÀI LIỆU THAM KHẢO PHỤ LỤC A CÁC NGHIÊN CỨU VÀ ỨNG DỤNG CỦA LÝ THUYẾT TẬP MỜ VÀ LOGIC MỜ TRONG CÁC LĨNH VỰC KINH TẾ - TÀI CHÍNH……… B CÁC PHÉP TOÁN CƠ BẢN TRÊN TẬP MỜ…….……………………………………7 C CÁC PHÉP TOÁN CƠ BẢN TRÊN SỐ MỜ………………………………………… D BIẾN NGƠN NGỮ VÀ TIẾN TRÌNH MỜ HĨA & GIẢI MỜ 12 E MÔ TẢ CÁC MẪU DỮ LIỆU…………………………………………………………16 F CẤU TRÚC CÁC FILE EXCEL TÍNH TỐN……………………………………… 24 G ĐỘ NHẠY CỦA HỆ SỐ CZV KHI NHẬN ĐỊNH ĐÁNH GIÁ CỦA NHÀ ĐẦU TƯ THAY ĐỔI……………………………………… ………………………………… 35 H SO SÁNH HIỆU QUẢ CỦA DANH MỤC TỐI ƯU MỜ VỚI DANH MỤC NAÏVE BẰNG TỶ SỐ SORTINO …………………………………………………………… 47 I SỰ HỘI TỤ SỐ LƯỢNG CHỨNG KHOÁN TRONG DANH MỤC TỐI ƯU MỜ VÀ SO SÁNH HIỆU QUẢ CỦA DANH MỤC TỐI ƯU MỜ VỚI DANH MỤC NẠVE BẰNG TỶ SỐ SORTINO KHI SỐ CHỨNG KHỐN TRONG DANH MỤC THAY ĐỔI…… …………………………………………………………………………… 83 J ĐỒ THỊ ĐƯỜNG BIÊN HIỆU QUẢ & SỐ CHỨNG KHOÁN TRONG DANH MỤC TỐI ƯU KHI CỐ ĐỊNH RỦI RO GIẢM GIÁ VÀ TỐI ĐA HÓA TỶ SUẤT SINH LỢI……………………………….………………………………………………… 119 K ĐỒ THỊ ĐƯỜNG BIÊN HIỆU QUẢ & SỐ CHỨNG KHOÁN TRONG DANH MỤC TỐI ƯU KHI CỐ ĐỊNH TỶ SUẤT SINH LỢI VÀ TỐI THIỂU HÓA RỦI RO GIẢM GIÁ………………………………………….………………….…………………… 131 L MÃ NGUỒN VBA CỦA CÁC MACRO CHO QUÁ TRÌNH TÍNH TỐN TỐI ƯU VÀ VẼ ĐỒ THỊ ĐƯỜNG BIÊN HIỆU QUẢ TỰ ĐỘNG… ……………………… 143 TIEU LUAN MOI download : skknchat@gmail.com DANH MỤC CÁC KÝ HIỆU VÀ CHỮ VIẾT TẮT CV Coefficient Variation ĐTBTL Điểm Trung Bình Tích Lũy FMPM Financial Markets and Portfolio Management HNX Ha Noi Stock Exchange HOSE Ho Chi Minh Security Exchange LPM Lower Partial Moment MAR Minimum Accepted Return MPT Modern Portfolio Theory MV Mean – Variance RFR Risk Free Rate TSSL Tỷ Suất Sinh Lợi TTCK Thị Trường Chứng Khoán λ Investor’s judgment (Nhận định đánh giá nhà đầu tư) TIEU LUAN MOI download : skknchat@gmail.com DANH MỤC CÁC BẢNG Bảng 4.1: Sự hội tụ số lượng chứng khoán danh mục tối ưu mờ λ thay đổi 36 Bảng 4.2: Sự hội tụ số lượng chứng khoán danh mục tối ưu mờ thay đổi hệ số CV λ uj thay đổi 41 Bảng 4.3: Sự hội tụ số lượng chứng khoán hiệu danh mục tối ưu mờ so với danh mục mờ 1/N thay số lượng chứng khoán danh mục mờ 1/N 43 TIEU LUAN MOI download : skknchat@gmail.com DANH MỤC CÁC BIỂU ĐỒ Biểu đồ 4.1: Sự hội tụ số lượng chứng khoán danh mục tối ưu mờ cố định rủi ro giảm giá tối đa hóa TSSL mục tiêu 38 Biểu đồ 4.2: Sự hội tụ số lượng chứng khoán danh mục tối ưu mờ cố định TSSL tối hiểu hóa rủi ro giảm giá 40 Biểu đồ 4.3: Quan hệ đường biên hiệu mơ hình (Zulkifli Mohamed cộng sự, 2009) uj = 30% tối đa hóa TSSL 48 Biểu đồ 4.4: Quan hệ đường biên hiệu mơ hình (Zulkifli Mohamed cộng sự, 2009) uj = 15% tối thiểu hóa rủi ro giảm giá 48 Biểu đồ 4.5: Quan hệ đường biên hiệu dẫn xuất mơ hình P1 (Vercher cộng sự, 2007) uj = 15% tối đa hóa TSSL 49 Biểu đồ 4.6: Quan hệ đường biên hiệu dẫn xuất mơ hình P1 (Vercher cộng sự, 2007) uj = 20% tối thiểu hóa rủi ro giảm giá 50 Biểu đồ 4.7: Quan hệ đường biên hiệu dẫn xuất mơ hình P2 (Vercher cộng sự, 2007) uj = 20% tối đa hóa TSSL 50 Biểu đồ 4.8: Quan hệ đường biên hiệu dẫn xuất mơ hình P2 (Vercher cộng sự, 2007) uj = 20% tối thiểu hóa rủi ro giảm giá 51 Biểu đồ 4.9: Quan hệ đường biên hiệu dẫn xuất mơ hình (Zulkifli Mohamed cộng sự, 2009) uj = 20% tối đa hóa TSSL 52 Biểu đồ 4.10: Quan hệ đường biên hiệu dẫn xuất mô hình (Zulkifli Mohamed cộng sự, 2009) uj = 20% tối thiểu hóa rủi ro giảm giá 52 TIEU LUAN MOI download : skknchat@gmail.com DANH MỤC CÁC HÌNH VẼ Hình 2.1: Logic cổ điển logic mờ 11 Hình 2.2: Hàm thành viên tập hợp cổ điển 11 Hình 2.3: Lý thuyết tập hợp cổ điển lý thuyết tập mờ 12 Hình 2.4: Các dạng tập mờ .13 Hình 2.5: Các dạng số mờ 14 Hình 2.6: Số mờ tam giác .15 Hình 2.7: Số mờ tam giác có AL = AR .16 Hình 2.8: Số mờ tam giác trung tâm đối xứng qua trục μ 16 Hình 2.9: Số mờ hình thang .17 Hình 2.10: Số mờ hình thang dạng trung tâm (central form) 17 Hình 2.11: Số hình thang phải 18 Hình 2.12: Số hình thang trái 18 Hình 2.13: Số mờ L-R 18 Hình 3.1: Hàm thành viên suất sinh lợi tài sản, (Zulkifli Mohamed cộng sự, 2009) 23 Hình 3.2: Đường biên hiệu λ - phương sai trung bình đường biên hiểu MV (danh mục I), (Li & Xu, 2007) 27 Hình 3.3: Đường biên hiệu λ - phương sai trung bình đường biên hiểu MV (danh mục II), (Li & Xu, 2007) 27 Hình 3.4: Đường biên hiệu λ - phương sai trung bình đường biên hiểu MV (danh mục III), (Li & Xu, 2007) 28 Hình 3.5: Đường biên hiệu λ - phương sai trung bình Lạc quan, Trung dung Bi quan, (Li & Xu, 2007) 28 PHỤ LỤC: Hình PL.1: Mặt phẳng định nghĩa mơ hình tự hồi quy (AR) .4 Hình PL.2: Đồ thị biểu diễn luật mờ sử dụng mơ hình tự hồi quy (FAR) Hình PL.3: Bù tâp mờ Hình PL.4: Hợp hai tập mờ Hình PL.5: Giao hai tập mờ .8 Hình PL.6: Cộng hai số mờ tam giác .9 Hình PL.7: Nhân & chia số mờ tam giác với số thực Hình PL.8: Biểu diễn giá trị mờ cho biến ngôn ngữ 12 TIEU LUAN MOI download : skknchat@gmail.com TÓM TẮT Mục tiêu nghiên cứu: Đầu tư thị trường chứng khoán vấn đề đầy thử thách Nhà đầu tư phải đối mặt với vấn đề: ngẫu nhiên, mơ hồ nhập nhằng biến động giá chứng khốn Việc phân tích danh mục đầu tư tối ưu không đơn sử dụng liệu lịch sử thị trường thể khứ không hẳn lặp lại tương lai Nhất quốc gia có thị trường chứng khoán Việt Nam mà liệu lịch sử chưa có đủ nhiều Ngồi ra, thay đổi thơng tin xác, nhận định kinh nghiệm nhà đầu tư, đặc biệt với chuyên gia chứng khoán, người vốn sở hữu lượng đủ thông tin kinh nghiệm thị trường cần xem xét trình phân tích định đầu tư Vì vậy, Nhà đầu tư cần mơ hình diễn tả tình thực tế để giải vấn đề khơng chắn mà mơ hình truyền thống bỏ qua Phương pháp tiếp cận mờ kết hợp với số cải biến mơ hình truyền thống để dẫn xuất mơ hình lựa chọn danh mục đầu tư tối ưu có khả xử lý vấn đề Cho đến nay, chưa có nghiên cứu thực nghiệm Việt Nam vấn đề tiếp cận mờ lựa chọn danh mục đầu tư TTCK, vậy, nghiên cứu phương pháp tiếp cận mờ mở huớng cho nghiên cứu kinh tế Việt Nam Thiết kế/phương pháp nghiên cứu/phương pháp tiếp cận: Các mơ hình lựa chọn danh mục mờ (Zulkifli Mohamed cộng sự, 2009), (Vercher cộng sự, 2007) (Li & Xu, 2007) sử dụng, điều chỉnh, dẫn xuất kiểm nghiệm dựa sở liệu giá chứng khoán theo tháng điều chỉnh tất công ty niêm yết TTCK Việt Nam (trên sàn HOSE HNX) Các mã chứng khốn cịn lại sau sàng lọc liệu mẫu ban đầu chia thành nhóm theo khung thời gian số lượng chứng khoán khác Các danh mục tối ưu mờ xác định tốn tối ưu hóa với ràng buộc mục tiêu Sau đó, hiệu danh mục tối ưu mờ so sánh với danh mục mờ 1/N tương ứng tỷ số Sortino Mối quan hệ hình dạng đường biên hiệu mơ hình phát thảo phân tích TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 142 – Phụ Lục K ĐỒ THỊ ĐƯỜNG BIÊN HIỆU QUẢ & SỐ TÀI SẢN TRONG DANH MỤC TỐI ƯU KHI CỐ ĐỊNH TỶ SUẤT SINH LỢI VÀ TỐI THIỂU HÓA RỦI RO GIẢM GIÁ Time Frame: years (Vercher et al, 2007) P2 Model Revised Sample: 92 assets Max allocation: Optimized Lamda: 30% 0.3 1.20% 5.5 1.00% 4.5 0.80% 0.60% 3.5 0.40% 0.20% 0.00% 0.00% Number of Selected Assets Fuzzy Return Efficient Frontier - Vercher P2 Model Revised [ max allocation = 30% ; lamda = 0.3] 2.5 5.00% 10.00% 15.00% 20.00% 25.00% 30.00% Fuzzy Downside Risk Efficient Frontier - EF Time Frame: years Number of Selected Assets (Vercher et al, 2007) P2 Model Revised Sample: 92 assets Max allocation: Optimized Lamda: 30% 0.7 1.40% 5.5 1.20% 1.00% 4.5 0.80% 0.60% 3.5 0.40% 0.20% 2.5 0.00% 12.50% 13.00% 13.50% 14.00% 14.50% 15.00% Number of Selected Assets Fuzzy Return Efficient Frontier - Vercher P2 Model Revised [ max allocation = 30% ; lamda = 0.7] 15.50% Fuzzy Downside Risk Efficient Frontier - EF Time Frame: years Number of Selected Assets (Vercher et al, 2007) P2 Model Revised Sample: 92 assets Max allocation: Optimized Lamda: 30% 1.0 Efficient Frontier - Vercher P2 Model Revised [ max allocation = 30% ; lamda = 1.0] 1.80% 5.5 1.60% Fuzzy Return 4.5 1.20% 1.00% 0.80% 3.5 0.60% 0.40% 2.5 0.20% Number of Selected Assets 1.40% 0.00% 12.60% 12.80% 13.00% 13.20% 13.40% 13.60% 13.80% 14.00% 14.20% 14.40% 14.60% Fuzzy Downside Risk Efficient Frontier - EF Number of Selected Assets (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu TIEU LUAN MOI download : skknchat@gmail.com (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 143 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.1 MÃ NGUỒN VBA CỦA MACRO TÍNH TỐN, CẬP NHẬT SỐ LIỆU DANH MỤC TỐI ƯU MỜ VÀ DANH MỤC MỜ 1/N L MÃ NGUỒN VBA CỦA CÁC MACRO CHO Q TRÌNH TÍNH TỐN TỐI ƯU VÀ VẼ ĐỒ THỊ ĐƯỜNG BIÊN HIỆU QUẢ TỰ ĐỘNG L.1 Tính tốn, cập nhật số liệu danh mục tối ưu mờ danh mục mờ 1/N Option Explicit Sub updatePortfolio6Years92Assets() Dim tmpStr As String With Application ScreenUpdating = False DisplayAlerts = False EnableEvents = False AlertBeforeOverwriting = False End With Range("B30:CO31").Select Selection.Copy Range("B32").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Selection.Copy Range("CQ2").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Application.CutCopyMode = False If Range("B34").Value = "agf" Then tmpStr = _ "=[FZPortfolio_6years_dataSource.xls]excel_" & Range("B34").Value & ".xls!RC[-78]*R34C3" _ & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B35").Value & "!RC[-78]*R35C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B36").Value & "!RC[-78]*R36C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B37").Value & "!RC[-78]*R37C3" Else tmpStr = _ "=[FZPortfolio_6years_dataSource.xls]excel_" & Range("B34").Value & "!RC[-78]*R34C3" _ & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B35").Value & "!RC[-78]*R35C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B36").Value & "!RC[-78]*R36C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B37").Value & "!RC[-78]*R37C3" End If If Range("B38").Value "" Then (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu _ _ _ _ (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 144 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.1 MÃ NGUỒN VBA CỦA MACRO TÍNH TỐN, CẬP NHẬT SỐ LIỆU DANH MỤC TỐI ƯU MỜ VÀ DANH MỤC MỜ 1/N tmpStr = tmpStr & End If If Range("B39").Value tmpStr = tmpStr & End If If Range("B40").Value tmpStr = tmpStr & End If If Range("B41").Value tmpStr = tmpStr & End If "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B38").Value & "!RC[-78]*R38C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B39").Value & "!RC[-78]*R39C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B40").Value & "!RC[-78]*R40C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B41").Value & "!RC[-78]*R41C3" Range("CT2").Select Range("CT2").Activate ActiveCell.FormulaR1C1 = tmpStr Range("CT2").Select Selection.AutoFill Destination:=Range("CT2:CT73"), Type:=xlFillDefault Application.SendKeys ("{Enter}") Application.Run "ATPVBAEN.XLA!Descr", ActiveSheet.Range("$CT$2:$CT$73"), ActiveSheet.Range("$CW$42"), "C", False, True, , , 95 Application.SendKeys ("{Enter}") Application.Run "ATPVBAEN.XLA!Descr", ActiveSheet.Range("$CU$2:$CU$73"), ActiveSheet.Range("$CW$59"), "C", False, True, , , 95 Application.SendKeys ("{Enter}") Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range("$CT$2:$CT$73"), ActiveSheet.Range("$CS$2:$CS$73"), False, False, 95, ActiveSheet.Range("$CS$75"), False, False, False, False, , False Application.SendKeys ("{Enter}") Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range("$CU$2:$CU$73"), ActiveSheet.Range("$CS$2:$CS$73"), False, False, 95, ActiveSheet.Range("$CS$94"), False, False, False, False, , False Range("A2").Select End Sub Sub updateNaivePortfolio6Years92Assets() Dim tmpStr As String With Application ScreenUpdating = False DisplayAlerts = False EnableEvents = False AlertBeforeOverwriting = False End With Range("B30:CO31").Select (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 145 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.1 MÃ NGUỒN VBA CỦA MACRO TÍNH TỐN, CẬP NHẬT SỐ LIỆU DANH MỤC TỐI ƯU MỜ VÀ DANH MỤC MỜ 1/N Selection.Copy Range("B32").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Selection.Copy Range("CQ2").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True Application.CutCopyMode = False If Range("B34").Value = "agf" Then tmpStr = _ "=[FZPortfolio_6years_dataSource.xls]excel_" & Range("B34").Value & ".xls!RC[-78]*R34C3" _ & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B35").Value & "!RC[-78]*R35C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B36").Value & "!RC[-78]*R36C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B37").Value & "!RC[-78]*R37C3" Else tmpStr = _ "=[FZPortfolio_6years_dataSource.xls]excel_" & Range("B34").Value & "!RC[-78]*R34C3" _ & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B35").Value & "!RC[-78]*R35C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B36").Value & "!RC[-78]*R36C3" & "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B37").Value & "!RC[-78]*R37C3" End If If Range("B38").Value tmpStr = tmpStr & End If If Range("B39").Value tmpStr = tmpStr & End If If Range("B40").Value tmpStr = tmpStr & End If If Range("B41").Value tmpStr = tmpStr & End If _ _ _ _ "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B38").Value & "!RC[-78]*R38C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B39").Value & "!RC[-78]*R39C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B40").Value & "!RC[-78]*R40C3" "" Then "+[FZPortfolio_6years_dataSource.xls]excel_" & Range("B41").Value & "!RC[-78]*R41C3" Range("CT2").Select Range("CT2").Activate ActiveCell.FormulaR1C1 = tmpStr Range("CT2").Select Selection.AutoFill Destination:=Range("CT2:CT73"), Type:=xlFillDefault Range("A2").Select End Sub (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 146 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.2 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU ĐƯỜNG BIÊN HIỆU QUẢ VỚI MỤC TIÊU TỐI ĐA HĨA TỶ SUẤT SINH LỢI SỬ DỤNG CƠNG CỤ SOLVER L.2 Tạo tự động liệu đường biên hiệu với mục tiêu tối đa hóa TSSL sử dụng công cụ Solver Option Explicit Sub SolveMin(ByRef fuzzyDownsideRiskMin As Double, ByRef fuzzyReturnMin As Double, ByRef solverResult As Long) ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad (ActiveSheet.Range("A50:A54")) SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) fuzzyDownsideRiskMin = Range("B25").Value fuzzyReturnMin = Range("B28").Value End Sub Sub SolveMaxReturn(ByVal downsideRiskTarget As Double, ByRef solverResult As Long) Dim strTmp As String ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A57:A62") strTmp = CStr(downsideRiskTarget) SolverChange CellRef:="$B$25", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub Sub SolveMinRisk(ByVal returnTarget As Double, ByRef solverResult As Long) Dim strTmp As String (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 147 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.2 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU ĐƯỜNG BIÊN HIỆU QUẢ VỚI MỤC TIÊU TỐI ĐA HÓA TỶ SUẤT SINH LỢI SỬ DỤNG CÔNG CỤ SOLVER ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A65:A70") strTmp = CStr(returnTarget) SolverChange CellRef:="$B$28", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub Sub TaoDuLieuDuongEF() Dim fuzzyDownsideRiskTarget As Double Dim fuzzyDownsideRiskMin As Double Dim fuzzyReturnMin As Double Dim counter As Long Dim assetColIndx As Long Dim solvingResult As Long fuzzyDownsideRiskTarget = fuzzyDownsideRiskMin = fuzzyReturnMin = counter = assetColIndx = solvingResult = 100 With Application ScreenUpdating = False End With Call SolveMin(fuzzyDownsideRiskMin, fuzzyReturnMin, solvingResult) If solvingResult > Then ' Result = 0, Solution found, optimality and constraints satisfied ' Result = 1, Converged, constraints satisfied ' Result = 2, Cannot improve, constraints satisfied ' Result = 3, Stopped at maximum iterations ' Result = 4, Solver did not converge ' Result = 5, No feasible solution Beep MsgBox "Solver was unable to find a solution.", vbExclamation, "SOLUTION NOT FOUND" Exit Sub End If ActiveSheet.Range("DL3:HA32").ClearContents (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 148 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.2 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU ĐƯỜNG BIÊN HIỆU QUẢ VỚI MỤC TIÊU TỐI ĐA HÓA TỶ SUẤT SINH LỢI SỬ DỤNG CÔNG CỤ SOLVER ActiveSheet.Range("DL3:HA32").Cells(1, 1).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("DL3:HA32").Cells(1, 2).Value = ActiveSheet.Range("B28").Value For assetColIndx = To 92 If Not ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value = "" Then If Round(ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value * 100, 0) > Then ActiveSheet.Range("DN3:HA32").Cells(1, assetColIndx).Value = ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value End If End If Next assetColIndx For counter = To 28 fuzzyDownsideRiskTarget = Round(fuzzyDownsideRiskMin + (counter - 1) * 0.01, 4) solvingResult = 100 Call SolveMaxReturn(fuzzyDownsideRiskTarget, solvingResult) If solvingResult > Then Beep GoTo ContinueLoop End If Application.SendKeys ("{Enter}") ActiveSheet.Range("DL3:HA32").Cells(counter, 1).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("DL3:HA32").Cells(counter, 2).Value = ActiveSheet.Range("B28").Value For assetColIndx = To 92 If Not ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value = "" Then If Round(ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value * 100, 0) > Then ActiveSheet.Range("DN3:HA32").Cells(counter, assetColIndx).Value = ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value End If End If Next assetColIndx ContinueLoop: Next counter End Sub Sub backup() ActiveSheet.Range("B112:CO112").Value = ActiveSheet.Range("weightArr").Value End Sub Sub restore() Application.ScreenUpdating = False SolverLoad (ActiveSheet.Range("A65:A70")) ActiveSheet.Range("weightArr").Value = ActiveSheet.Range("B112:CO112").Value ActiveSheet.Range("B112:CO112").Value = "" End Sub (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 149 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.3 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI L.3 Tạo tự động liệu đường biên hiệu với mục tiêu tối thiểu hóa rủi ro giảm giá sử dụng công cụ Solver Option Explicit Sub SolveMin(ByRef fuzzyDownsideRiskMin As Double, ByRef fuzzyReturnMin As Double, ByRef solverResult As Long) ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad (ActiveSheet.Range("A50:A54")) SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) fuzzyDownsideRiskMin = Range("B25").Value fuzzyReturnMin = Range("B28").Value End Sub Sub SolveMaxReturn(ByVal downsideRiskTarget As Double, ByRef solverResult As Long) Dim strTmp As String ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A57:A62") strTmp = CStr(downsideRiskTarget) SolverChange CellRef:="$B$25", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub Sub SolveMinRisk(ByVal returnTarget As Double, ByRef solverResult As Long) Dim strTmp As String (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 150 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.3 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI ActiveSheet.Range("B23:CO23").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A65:A70") strTmp = CStr(returnTarget) SolverChange CellRef:="$B$28", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub Sub TaoDuLieuDuongEF() Dim fuzzyReturnTarget As Double Dim fuzzyDownsideRiskMin As Double Dim fuzzyReturnMin As Double Dim counter As Long Dim assetColIndx As Long Dim solvingResult As Long Dim numOfRoundedDigit As Long Dim plusMinus As Integer Dim fuzzyReturnStep As Double Dim dataRow As Long fuzzyReturnTarget = fuzzyDownsideRiskMin = fuzzyReturnMin = counter = assetColIndx = solvingResult = 100 numOfRoundedDigit = plusMinus = With Application ScreenUpdating = False End With Call SolveMin(fuzzyDownsideRiskMin, fuzzyReturnMin, solvingResult) If solvingResult > Then ' Result = 0, Solution found, optimality and constraints satisfied ' Result = 1, Converged, constraints satisfied ' Result = 2, Cannot improve, constraints satisfied (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 151 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.3 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI ' Result = 3, Stopped at maximum iterations ' Result = 4, Solver did not converge ' Result = 5, No feasible solution MsgBox "Solver was unable to find a solution.", vbExclamation, "SOLUTION NOT FOUND" Exit Sub End If ActiveSheet.Range("DL3:HA32").ClearContents ActiveSheet.Range("DL3:HA32").Cells(1, 1).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("DL3:HA32").Cells(1, 2).Value = ActiveSheet.Range("B28").Value For assetColIndx = To 92 If Not ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value = "" Then If Round(ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value * 100, 0) > Then ActiveSheet.Range("DN3:HA32").Cells(1, assetColIndx).Value = ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value End If End If Next assetColIndx If InStr(ActiveSheet.Name, "org") > Then numOfRoundedDigit = plusMinus = -1 fuzzyReturnStep = 0.01 ElseIf InStr(ActiveSheet.Name, "revised") > Then numOfRoundedDigit = plusMinus = fuzzyReturnStep = 0.01 ElseIf InStr(ActiveSheet.Name, "Vercher1") > Then numOfRoundedDigit = plusMinus = fuzzyReturnStep = 0.0025 ElseIf InStr(ActiveSheet.Name, "Vercher2") > Then numOfRoundedDigit = plusMinus = fuzzyReturnStep = 0.0025 End If dataRow = For counter = To 28 fuzzyReturnTarget = Round(fuzzyReturnMin + plusMinus * (counter - 1) * fuzzyReturnStep, numOfRoundedDigit) solvingResult = 100 Call SolveMinRisk(fuzzyReturnTarget, solvingResult) (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 152 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com L.3 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI If solvingResult > Then Beep GoTo ContinueLoop End If dataRow = dataRow + Application.SendKeys ("{Enter}") ActiveSheet.Range("DL3:HA32").Cells(dataRow, 1).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("DL3:HA32").Cells(dataRow, 2).Value = ActiveSheet.Range("B28").Value For assetColIndx = To 92 If Not ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value = "" Then If Round(ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value * 100, 0) > Then ActiveSheet.Range("DN3:HA32").Cells(dataRow, assetColIndx).Value = ActiveSheet.Range("B31:CO31").Cells(1, assetColIndx).Value End If End If Next assetColIndx ContinueLoop: Next counter End Sub (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 153 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com J.4 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI L.4 Tạo liệu so sánh danh mục mờ tối ưu với danh mục mờ 1/N số lượng chứng khoán danh mục mờ 1/N thay đổi Option Explicit Sub SolveNaiveMinRisk(ByVal numberAssets As Long, ByRef solverResult As Long) Dim strTmp As String ActiveSheet.Range("weightNaiveArr").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A50:A53") strTmp = CStr(numberAssets) SolverChange CellRef:="$CP$23", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub Sub SolveNaiveMaxReturn(ByVal numberAssets As Long, ByRef solverResult As Long) Dim strTmp As String ActiveSheet.Range("weightNaiveArr").Value = Application.ScreenUpdating = False SolverLoad loadArea:=Range("A56:A59") strTmp = CStr(numberAssets) SolverChange CellRef:="$CP$23", Relation:=2, FormulaText:=strTmp SolverOptions MaxTime:=1000, Iterations:=1000 solverResult = Application.Run("Solver.xla!SolverSolve", True) End Sub (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 154 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com J.4 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI Sub TaoDuLieuDuongEFNaive() Dim counter As Long Dim numberAssets As Long Dim solvingResult As Long Dim tmpReturn As Double Dim tmpRisk As Double Dim indexOfNaiveSheet As Long counter = numberAssets = solvingResult = 100 tmpReturn = tmpRisk = With Application ScreenUpdating = False End With backup 'ActiveSheet.Range("naiveEfficientFrontierDataSet").ClearContents indexOfNaiveSheet = ActiveSheet.Index For counter = To 32 If ActiveSheet.Range("CV" & CStr(counter)).Value > Then ActiveSheet.Range("C29").Value = ActiveSheet.Range("CV" & CStr(counter)).Value solvingResult = 100 Call SolveNaiveMinRisk(ActiveSheet.Range("CV" & CStr(counter)).Value, solvingResult) If solvingResult > Then ' Result = 0, Solution found, optimality and constraints satisfied ' Result = 1, Converged, constraints satisfied ' Result = 2, Cannot improve, constraints satisfied ' Result = 3, Stopped at maximum iterations ' Result = 4, Solver did not converge ' Result = 5, No feasible solution Application.SendKeys ("{Enter}") ActiveSheet.Range("CW" & CStr(counter)).Value = "" ActiveSheet.Range("CX" & CStr(counter)).Value = "" Beep Else Application.SendKeys ("{Enter}") ActiveSheet.Range("CW" & CStr(counter)).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("CX" & CStr(counter)).Value = ActiveSheet.Range("B28").Value (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu 155 – Phụ Lục TIEU LUAN MOI download : skknchat@gmail.com J.4 MÃ NGUỒN VBA CỦA MACRO TẠO TỰ ĐỘNG BỘ DỮ LIỆU SO SÁNH DANH MỤC MỜ TỐI ƯU VỚI DANH MỤC MỜ 1/N KHI SỐ TÀI SẢN TRONG DANH MỤC MỜ 1/N THAY ĐỔI tmpReturn = ActiveSheet.Range("CX" & CStr(counter)).Value Sheets(indexOfNaiveSheet - 1).Activate Module1.backup Call Module1.SolveMinRisk(tmpReturn, solvingResult) If solvingResult > Then Sheets(indexOfNaiveSheet).Activate Beep Else numberAssets = ActiveSheet.Range("B29").Value tmpRisk = ActiveSheet.Range("B25").Value Module1.restore Sheets(indexOfNaiveSheet).Activate If numberAssets Then ActiveSheet.Range("CZ" & CStr(counter)).Value = numberAssets If tmpRisk Then ActiveSheet.Range("DA" & CStr(counter)).Value = tmpRisk If tmpReturn Then ActiveSheet.Range("DB" & CStr(counter)).Value = tmpReturn End If End If Call SolveNaiveMaxReturn(ActiveSheet.Range("CV" & CStr(counter)).Value, solvingResult) If solvingResult > Then ' Result = 0, Solution found, optimality and constraints satisfied ' Result = 1, Converged, constraints satisfied ' Result = 2, Cannot improve, constraints satisfied ' Result = 3, Stopped at maximum iterations ' Result = 4, Solver did not converge ' Result = 5, No feasible solution Application.SendKeys ("{Enter}") ActiveSheet.Range("DE" & CStr(counter)).Value = "" ActiveSheet.Range("DF" & CStr(counter)).Value = "" Beep GoTo ContinueLoop Else Application.SendKeys ("{Enter}") ActiveSheet.Range("DE" & CStr(counter)).Value = ActiveSheet.Range("B25").Value ActiveSheet.Range("DF" & CStr(counter)).Value = ActiveSheet.Range("B28").Value tmpRisk = ActiveSheet.Range("DE" & CStr(counter)).Value Sheets(indexOfNaiveSheet - 1).Activate Module1.backup Call Module1.SolveMaxReturn(tmpRisk, solvingResult) If solvingResult > Then Sheets(indexOfNaiveSheet).Activate Beep Else numberAssets = ActiveSheet.Range("B29").Value tmpReturn = ActiveSheet.Range("B28").Value (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu (LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu(LUAN.van.THAC.si).nghien.cuu.phuong.phap.tiep.can.mo.trong.lua.chon.danh.muc.du.an.dau.tu.toi.uu

Ngày đăng: 21/12/2023, 07:41

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN