小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

基金組合二八輪動策略Plus版

 耐心是金 2022-05-20 發(fā)布于廣東

作者:王洪武

二八輪動是FOF里非常簡單的一個策略,下面來簡單回測一下策略的有效性。

選擇三個品種:

(1)       二取滬深300指數(shù);

(2)       八取中證500指數(shù);

(3)       無風(fēng)險取現(xiàn)金.

策略邏輯:

初始狀態(tài)為空倉 過去N個交易日,兩個指數(shù)收益哪個高就持有哪個指數(shù)N個交易日,如兩個指數(shù)過去N個交易日收益均為負值,則投資組合持有現(xiàn)金,空倉現(xiàn)金利息為0.0%,暫不考慮手續(xù)費。

第一部分: 回測分析

載入數(shù)據(jù): 采用滬深300與中證500價格指數(shù)

clear; clc
load data.mat


輪動調(diào)倉周期

N=10; % 持倉每N個交易日輪動一次

投資組合持倉數(shù)據(jù):  1:現(xiàn)金 2:滬深300 3:中證500

PortAsset=zeros(DataLength,1);
PortAsset(1:N,1)=1;

for i=N:N:DataLength
   Return=[0,IndexData(i,:)./IndexData(i-N+1,:)-1];
    [Val,Idx]=max(Return);
   
if i+N<DataLength
         PortAsset(i+1:i+N)=Idx;
%i日尾盤調(diào)倉
   
else
        PortAsset(i+1:end)=Idx;
   
end
end


根據(jù)持倉計算組合收益率

PortReturn=zeros(DataLength,1);
for i=1:DataLength

   
switch PortAsset(i)
       
case 1
            PortReturn(i)=0;
       
case 2
            PortReturn(i)=IndexData(i,1)/IndexData(i-1,1)-1;
       
otherwise
           PortReturn(i)=IndexData(i,2)/IndexData(i-1,2)-1;
   
end
end


根據(jù)收益率計算凈值

PortNav=zeros(DataLength,1);
PortNav(1)=1.00;
for i=2:DataLength
    PortNav(i)=PortNav(i-1)*(1+PortReturn(i));
end


繪制圖形

figure;
subplot(2,1,1)
plot(Date,IndexData(:,1)/1000,'k','LineWidth',1.2);
hold
on;
plot(Date,IndexData(:,2)/1000,
'b','LineWidth',1.2);
plot(Date,PortNav,
'r','LineWidth',1.2);
dateaxis(
'x',17);
legend(
'滬深300','中證500','二八輪動','Location','NorthWest')
subplot(2,1,2)
plot(Date,PortAsset,
'k','LineWidth',1.2);
dateaxis(
'x',17);
legend(
'1:現(xiàn)金,2:滬深300,3:中證500','Location','NorthWest')

圖片



第二部分:結(jié)果評價


價格和收益率數(shù)據(jù)

prices1=[IndexData PortNav]; %價格數(shù)據(jù)
changes1=tick2ret(prices1);
%收益率數(shù)據(jù)
prices_std=ret2tick(changes1);
%標準化價格
names=[IndexName,{
'二八輪動'}];


時間跨度

time_span=Date(end)-Date(1);
time_span_year=time_span/365

time_span_year =

   12.2740

1return

總收益率

totalYield=prices_std(end,:)-1


totalYield =

    2.5175    5.5787  15.4020

復(fù)合年化收益率

公式 1+yieldYear^time_span_year-1=totalYield

yieldYear=(totalYield+1).^(1/time_span_year)-1


yieldYear =

    0.1079    0.1659   0.2560

收益率的分布

figure
subplot(3,1,1)
hist(changes1(:,1),20);
xlim([-0.1 0.1])
ylim([0 2000])
title(names{1})
xlabel('收益率');
ylabel(
'天數(shù)');
subplot(3,1,2)
hist(changes1(:,2),20);
xlim([-0.1 0.1])
ylim([0 2000])
title(names{2})
xlabel(
'收益率');
ylabel(
'天數(shù)');
subplot(3,1,3)
hist(changes1(:,3),20);
xlim([-0.1 0.1])
ylim([0 2000])
title(names{3})
xlabel(
'收益率');
ylabel(
'天數(shù)');

圖片

2risk

年化波動率

volatility=std(changes1); %波動率
volatilityYear=volatility*sqrt(250)
%按照250個交易日計算


volatilityYear =

    0.2881    0.3289   0.2404

最大回撤率向量和最大回撤

C=cummax(prices_std);
maxDrawVector = (C-prices_std)./C; %最大回撤向量
maxDrawRate=max(maxDrawVector)


maxDrawRate =

    0.7230    0.7242   0.4627

最大回撤可視化

figure
% bar(Date,maxDrawVector)
area(Date,[maxDrawVector(:,1), maxDrawVector(:,2)-maxDrawVector(:,1),maxDrawVector(:,3)-maxDrawVector(:,2)]);
legend(fliplr(names),
'Location','northwest')
ylabel(
'最大回撤率')
datetick(
'x','yyyymmdd')

圖片


計算beta

beta1=regress(changes1(:,3),changes1(:,1)) %相對于滬深300

beta2=regress(changes1(:,3),changes1(:,2))
%相對于中證500


beta1 =

    0.5874


beta2 =

    0.5199

3return to risk

收益回撤比

yieldYearDividemaxDraw=yieldYear./maxDrawRate


yieldYearDividemaxDraw =

    0.1492    0.2291   0.5532

勝率

xx=sum(changes1(:,3)>0);
yy=sum(changes1(:,3)~=0);
winRate=xx/yy


winRate =

    0.5963

夏普比率

Riskless=0;
Sharpe = (yieldYear-Riskless)./volatilityYear


Sharpe =

    0.3745    0.5043   1.0646

4return to benchmark

alpha收益

Returns=changes1(:,3);
Benchmark=changes1(:,1);
Cash=0;
alpha1=portalpha(Returns, Benchmark,Cash,'capm')

Returns=changes1(:,3);
Benchmark=changes1(:,2);
Cash=0;
alpha2=portalpha(Returns, Benchmark,Cash,
'capm')


alpha1 =

   7.1139e-04


alpha2 =

   6.1517e-04

詹森指數(shù)

Jensen1=yieldYear(3)-beta1*yieldYear(1) %相對滬深300

Jensen2=yieldYear(3)-beta2*yieldYear(2)
%相對中證500


Jensen1 =

    0.1926


Jensen2 =

    0.1697

信息比率

Returns=changes1(:,3);
Benchmark=changes1(:,1);
InfoRatio1 = inforatio(Returns, Benchmark)

Returns=changes1(:,3);
Benchmark=changes1(:,2);
InfoRatio2 = inforatio(Returns, Benchmark)


InfoRatio1 =

    0.0354

InfoRatio2 =

    0.0140

第三部分: 參數(shù)優(yōu)化


遍歷持倉周期

N=5:1:60;


定義函數(shù)句柄

h=@Wheeled28;


對持倉周期進行遍歷

[return11, maxDraw11, sharp11]=arrayfun(h,N);


繪制持倉周期與回報率的關(guān)系

figure
bar(N,return11');
title('持倉周期與回報率的關(guān)系')
% 標記最佳標的
[maxReturn, maxN]=max(return11);
hold
on
bar(N(maxN),maxReturn,
'FaceColor', [1 .25 .25], 'EdgeColor', 'none');
text(N(maxN),maxReturn ,[
'Best:',num2str(N(maxN))],'HorizontalAlignment', 'center', 'VerticalAlignment', 'Bottom');

圖片


繪制持倉周期與最大回撤的關(guān)系

figure
bar(N,maxDraw11');
title('繪制持倉周期與最大回撤的關(guān)系')
% 標記最佳標的
[minDraw, minN]=min(maxDraw11);
hold
on
bar(N(minN),minDraw,
'FaceColor', [1 .25 .25], 'EdgeColor', 'none');
text(N(minN),minDraw ,[
'Best:',num2str(N(minN))],'HorizontalAlignment', 'center', 'VerticalAlignment', 'Bottom');

繪制持倉周期與收益回撤比的關(guān)系

figure
bar(N,return11'./maxDraw11');
title('持倉周期與收益回撤比的關(guān)系')
% 標記最佳標的
[maxSharp, maxN]=max(return11'./maxDraw11');
hold
on
bar(N(maxN),maxSharp,
'FaceColor', [1 .25 .25], 'EdgeColor', 'none');
text(N(maxN),maxSharp ,[
'Best:',num2str(N(maxN))],'HorizontalAlignment', 'center', 'VerticalAlignment', 'Bottom');

圖片

繪制持倉周期與夏普比率的關(guān)系

figure
bar(N,sharp11');
title('持倉周期與夏普比率的關(guān)系')
% 標記最佳標的
[maxSharp, maxN]=max(sharp11);
hold
on
bar(N(maxN),maxSharp,
'FaceColor', [1 .25 .25], 'EdgeColor', 'none');
text(N(maxN),maxSharp ,[
'Best:',num2str(N(maxN))],'HorizontalAlignment', 'center', 'VerticalAlignment', 'Bottom');

圖片

第四部分: 總結(jié)

1)二八輪動策略邏輯是趨勢追蹤,靠輪動控制品種和倉位,和大多數(shù)趨勢策略一樣,長期能跑贏指數(shù);

2)缺點是回撤比較大,可以考慮加入動態(tài)止盈止損來控制回撤;

3)從參數(shù)尋優(yōu)的結(jié)果來看7-12穩(wěn)定性較強,莫陷入?yún)?shù)過度優(yōu)化的陷阱。

第五部分: 改進

1)計算時增加手續(xù)費和滑點

2)調(diào)倉周期改為自然周、自然月或者自然季度

3)策略中增加動態(tài)止盈止損

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多