缠首 发表于 2014-6-12 17:08

:#DAXIAO%% 详细盈亏
lg=length(close_pre);
windata=zeros(1,lg);
windata(1,1)=0;
winnum=0;
for i=2:lg
    win=0; %盈亏钱数
    if(result(1,i)>=close_pre(1,i-1))
      win=p_test(1,i)-close_pre(1,i-1);
    else
      win=close_pre(1,i-1)-p_test(1,i);
    end
   
    if(win>=0)
      winnum=winnum+1;
    end
    windata(1,i)=win+windata(1,i-1);
end

%c 成功率
win_rate=winnum/lg

%% 计算回撤
backratio=zeros(1,lg);
for m=1:lg
    c=max(windata(1:m));
    backratio(1,m)=(windata(1,m)-c)/c;
end

%% 作图
figure;
subplot(3,1,1);
plot(p_test);
hold on;
grid on;
plot(result,'g');
subplot(3,1,2);
plot(windata);
grid on;
title('资金盈利');
subplot(3,1,3);
plot(backratio);
grid on;
title('最大回撤');
页: 1 2 3 [4]
查看完整版本: 中长线交易系统利润大幅回撤的问题