一个可实盘交易的系统

Discussion in 'Philosophy and Strategy' started by maharaj, Jan 10, 2009.

  1. Code:
    
    % function test()
    clear all
    close
    
    data = xlsread ('continuous.xls','铜','B3:E3878');
    [Report Record] = dualstation (data);
    
    Code:
     
    function [Report Record] = dualstation (data)
    % 
    % function dualstation (data)
    % 
    % purpose:
    % dual station for single object
    % 
    % input: 
    % data: open ,high ,low ,close
    %
    % output:
    % statistical report of trading station
    
    % reference:
    %{
    1. 在今天的收盘,计算两个值: 最高价-收盘价, 和 收盘价-最低价。然后取这两个值较大的那个,乘以k值0.7。把结果称为 触发值。
    
    2. 在明天的开盘,记录开盘价,然后在价格超过(开盘+触发值)时马上买入,或者价格低于(开盘-触发值)时马上卖空。
    
    3. 没有明确止损。这个系统是反转系统,也就是说,如果在价格超过(开盘+触发值)时手头有一口空单,则买入两口。同理,如果在价格低于(开盘-触发值)时手上有一口多单,则卖出两口。
    %}
    
    % controls:
    K = input('敏感参数:——') ;             % singular  
    DeltaP = input('价格最小变动单位:——'); % singular 
    fee = input('交易费用:——');            %  singular 
    Siz = input('合约规模:——');           %  singular 
    StopLossOrNot = input('是否需要止损?1 或者 0:——'); %  singular
    StopLoss = input('止损为合约价格的百分比:——'); %  singular
    ReOpen = input('止损后是否重新开仓?1或者0:——'); %  singular
    
    out=fopen('Dual Station','at');
    fprintf(out,'**************************************************\n');
    fprintf(out,'----------策略参数--------------------------------\n');
    fprintf(out,'敏感参数:             %6.3f\n',K);
    fprintf(out,'价格最小变动单位:     %6.0f\n',DeltaP);
    fprintf(out,'交易费用/每手:        %6.0f\n',fee);
    fprintf(out,'合约规模/手:          %6.0f\n',Siz);
    fprintf(out,'是否止损:             %6.0f\n',StopLossOrNot);
    fprintf(out,'止损规模:             %6.3f\n',StopLoss);
    fprintf(out,'是否重新开仓:         %6.0f\n',ReOpen);
    fprintf(out,'\n');
    fclose(out);
    
    fprintf('----------策略参数--------------------------------\n');
    fprintf('敏感参数:             %6.3f\n',K);
    fprintf('价格最小变动单位:     %6.0f\n',DeltaP);
    fprintf('交易费用/每手:        %6.0f\n',fee);
    fprintf('合约规模/手:          %6.0f\n',Siz);
    fprintf('是否止损:             %6.0f\n',StopLossOrNot);
    fprintf('止损规模:             %6.3f\n',StopLoss);
    fprintf('是否重新开仓:         %6.0f\n',ReOpen);
    
    Parameters = [fee;Siz];
    % procedure begin:
    [T, N] = size(data);
    if N~=4
        error('input data must be a T*4 matrix')
    end
    
    Position = zeros(1,3); % direction ,hold price,point start
    Record = [] ;          % direction ,start price , clear price, time beg, time end
    N = 1;                 % count num
    D = 0;                 % did this period take clear action happened?
    for i=2:T
        Art = max([data(i-1,2)- data(i-1,3);data(i-1,4)- data(i-1,3)]) ; % high -low diff
        CriticalValueUp = ceil(K*Art/DeltaP)*DeltaP + data(i,1);          % open buy position and close sell position critical value 
        CriticalValueDown = -ceil(K*Art/DeltaP)*DeltaP + data(i,1);       % open sell potition and close but position critical value
        
        High = data(i,2);
        Low = data(i,3);
        Close = data(i,4);
        % start position 
        if Position (1,1)== 0
            if High >= CriticalValueUp
                Position(1,1) = 1;
                Position(1,2) = CriticalValueUp;
                Position(1,3) = i;
            end
            if Low <= CriticalValueDown
                Position(1,1) = -1;
                Position(1,2) = CriticalValueDown;
                Position(1,3) = i;
            end
        end
        
        % step ahead
        switch StopLossOrNot
            case  1
                if Position (1,1)~= 0
                    if Position(1,1) == -1;
                        StopCritical = Position(1,2)*(1-Position(1,1)*StopLoss);
                        if High >= StopCritical && D==0
                            Record(N,1) = Position(1,1);
                            Record(N,2) = Position(1,2);
                            Record(N,3) = High;
                            Record(N,4) = Position(1,3);
                            Record(N,5) = i;
                            N = N+1;
                            D=1;
                            switch ReOpen
                                case 1
                                    Position(1,1) = 1;
                                    Position(1,2) = High;
                                    Position(1,3) = i;
                                case 0
                                    Position(1,1) = 0;
                                    Position(1,2) = 0;
                                    Position(1,3) = 0;
                            end
                        else
                            D=0;
                        end
                    end
                    
                    if Position(1,1) == 1;
                        StopCritical = Position(1,2)*(1-Position(1,1)*StopLoss);
                        if Low <= StopCritical && D==0
                            Record(N,1) = Position(1,1);
                            Record(N,2) = Position(1,2);
                            Record(N,3) = Low;
                            Record(N,4) = Position(1,3);
                            Record(N,5) = i;
                            N = N+1;
                            D=1;
                            switch ReOpen
                                case 1
                                    Position(1,1) = -1;
                                    Position(1,2) = Low;
                                    Position(1,3) = i;
                                case 0
                                    Position(1,1) = 0;
                                    Position(1,2) = 0;
                                    Position(1,3) = 0;
                            end
                        else
                            D=0;
                        end
                    end
                end
        end
        
        if Position (1,1)~= 0
            if Position(1,1) == -1;
                if High >= CriticalValueUp && D==0
                    Record(N,1) = Position(1,1);
                    Record(N,2) = Position(1,2);
                    Record(N,3) = CriticalValueUp;
                    Record(N,4) = Position(1,3);
                    Record(N,5) = i;
                    N = N+1;
                    Position(1,1) = 1;
                    Position(1,2) = CriticalValueUp;
                    Position(1,3) = i;
                    D=1;
                else
                    D=0;
                end
            end
            
            if Position(1,1) == 1;
                if Low <= CriticalValueDown && D==0
                    Record(N,1) = Position(1,1);
                    Record(N,2) = Position(1,2);
                    Record(N,3) = CriticalValueDown;
                    Record(N,4) = Position(1,3);
                    Record(N,5) = i;
                    N = N+1;
                    Position(1,1) = -1;
                    Position(1,2) = CriticalValueDown;
                    Position(1,3) = i;
                    D=1;
                else
                    D=0;
                end
                
            end
        end
    end
    
    Report = statereport(data,Position,Record,Parameters);
    
    Code:
     
    
    function [Report] = statereport(data,Position,Record,Parameters)
    % 统计报告
    % 输入:
    % data
    % Position = direction ,hold price,point start
    % Record =   direction ,start price , clear price, time beg, time end
    % please be attention :
    % the procedure is designed for future trading ,so all the PL
    % calculate is based on the price diff,not the returns series.
    %% 统计部分
    fee = Parameters(1,1); 
    Siz = Parameters(2,1);
    close = data(:,4) ; % close price 
    if size(Record,1)<1
        disp('no trade happened')
        Report=[];
        return
    end
    Profit =Siz* Record(:,1).*(Record(:,3)-Record(:,2)); % profit record
    winnums = size(find(Profit>0),1);
    winprofit = sum(Profit(Profit>0));
    lossnums = size(find(Profit<0),1);
    lossprofit =  sum(Profit(Profit<0));
    if Position(1,1)~=0
        floatprofit = Siz*Position(:,1).*(close(end,1)- Position(1,2));
    end
    output = [Record(:,1),Profit] ;
    
    Report.tilt={'盈利点数结算报表,现有持仓未计入核算'};
    
    Report.winnums=winnums;
    Report.winprofit=winprofit;
    Report.lossnums=lossnums;
    Report.lossprofit=lossprofit;
    Report.totalnums=winnums+lossnums;
    Report.totalprofit=(winprofit+lossprofit);
    Report.fees=fee*Report.totalnums;
    Report.netprofit=Report.totalprofit-Report.fees;
    Report.BuyandHold=Siz*(close(end)-close(1));
    
    Report.maxprofit=max(output(:,2));
    Report.maxloss=min(output(:,2));
    cumsumprofit=cumsum(output(:,2));
    if size(output,1)>=2
        output(1,3)=cumsumprofit(1,1);
        for l=2:size(output,1)
            output(l,3)=cumsumprofit(l,1)-max(cumsumprofit(1:l-1,1));
        end
    else
        output=zeros(1,3);
    end
    Report.maxdrawback=min(output(:,3));
    
    Report.meanprofit=mean(output(:,2));
    Report.winmeanprofit=mean(output(output(:,2)>0,2));
    Report.lossmeanprofit=mean(output(output(:,2)<0,2));
    
    Report.stdprofit=std(output(:,2));
    Report.Sharpe=mean(output(:,2))/std(output(:,2));
    Report.winprob=Report.winnums/Report.totalnums;
    Report.floatprofit=floatprofit;
    
    % 持有周期:
    Report.timelength=size(close,1);
    durce = Record(:,5)-Record(:,4);
    B = durce(Record(:,1)==1);  %买入持有时间
    S = durce(Record(:,1)==-1); % 卖出持有时间
    Report.buyholdingdurcemean=mean(B);
    Report.buyholdingdurcestd=std(B);
    Report.buyholdingdurce=sum(B);
    
    Report.sellholdingdurcemean=mean(S);
    Report.sellholdingdurcestd=std(S);
    Report.sellholdingdurce=sum(S);
    Report.timeholdingratio=sum(durce)/size(close,1);
    %% 增长
    creasesign=cumsumprofit;
    for i=2:length(cumsumprofit)
        if cumsumprofit(i,1)<max(cumsumprofit(1:i,1))
            creasesign(i,1)=NaN;
        else
        end
    end
    recoverdurce = max(diff(Record(~isnan(creasesign),5))); % 盈利回复时间
    Report.recoverdurce = recoverdurce; 
    %%
    out=fopen('Dual Station','at');
    fprintf(out,'**************************************************\n');
    fprintf(out,'\n');
    fprintf(out,'----------统计报表--------------------------------\n');
    fprintf(out,'盈利次数:         %6.0f\n',Report.winnums );
    fprintf(out,'获胜盈利所得 :    %6.0f\n',Report.winprofit );
    fprintf(out,'亏损次数:         %6.0f\n', Report.lossnums);
    fprintf(out,'亏损总额 :        %6.0f\n', Report.lossprofit);
    fprintf(out,'总交易次数 :      %6.0f\n', Report.totalnums);
    fprintf(out,'\n');
    fprintf(out,'总获利:         %6.0f\n', Report.totalprofit);
    fprintf(out,'交易费用:       %6.0f\n', Report.fees);
    fprintf(out,'净利润:         %6.0f\n', Report.netprofit);
    fprintf(out,'对象买入持有收益:%6.0f\n', Report.BuyandHold);
    fprintf(out,'\n');
    fprintf(out,'最大资金回撤:    %6.0f\n', Report.maxdrawback);
    fprintf(out,'最长不盈利时长:  %6.0f\n', Report.recoverdurce);
    fprintf(out,'单次最大获利 :   %6.0f\n', Report.maxprofit);
    fprintf(out,'单次最大亏损:    %6.0f\n', Report.maxloss);
    fprintf(out,'\n');
    fprintf(out,'平均每笔利润:    %6.1f\n', Report.meanprofit);
    fprintf(out,'获胜每笔利润:    %6.1f\n', Report.winmeanprofit);
    fprintf(out,'亏损每笔利润:    %6.1f\n', Report.lossmeanprofit);
    fprintf(out,'每笔交易波动:    %6.1f\n', Report.stdprofit);
    
    fprintf(out,'\n');
    fprintf(out,'总样本时间长度:   %6.0f\n',Report.timelength);
    fprintf(out,'买入持有时间均值: %6.1f\n',Report.buyholdingdurcemean);
    fprintf(out,'买入持有时间方差: %6.1f\n',Report.buyholdingdurcestd);
    fprintf(out,'买入持有总长度:   %6.0f\n',Report.buyholdingdurce);
    fprintf(out,'\n');
    fprintf(out,'卖出持有时间均值: %6.1f\n',Report.sellholdingdurcemean);
    fprintf(out,'卖出持有时间方差: %6.1f\n',Report.sellholdingdurcestd);
    fprintf(out,'卖出时间总长度:   %6.0f\n',Report.sellholdingdurce);
    fprintf(out,'交易占总时长比例: %6.1f\n',Report.timeholdingratio);
    fprintf(out,'\n');
    fprintf(out,'Sharper比值:      %6.1f\n', Report.Sharpe);
    fprintf(out,'获胜比例:         %6.2f\n', Report.winprob);
    fprintf(out,'现有持仓浮动收益: %6.0f\n', Report.floatprofit);
    fprintf(out,'\n');
    fclose(out);
    
    %% print  
    fprintf('**************************************************\n');
    fprintf('\n');
    fprintf('----------统计报表--------------------------------\n');
    fprintf('盈利次数:         %6.0f\n',Report.winnums );
    fprintf('获胜盈利所得 :    %6.0f\n',Report.winprofit );
    fprintf('亏损次数:         %6.0f\n', Report.lossnums);
    fprintf('亏损总额 :        %6.0f\n', Report.lossprofit);
    fprintf('总交易次数 :      %6.0f\n', Report.totalnums);
    fprintf('\n');
    fprintf('总获利:         %6.0f\n', Report.totalprofit);
    fprintf('交易费用:       %6.0f\n', Report.fees);
    fprintf('净利润:         %6.0f\n', Report.netprofit);
    fprintf('对象买入持有应该能得收益:%6.0f\n', Report.BuyandHold);
    fprintf('\n');
    fprintf('最大资金回撤:    %6.0f\n', Report.maxdrawback);
    fprintf('最长不盈利时长:  %6.0f\n', Report.recoverdurce);
    fprintf('单次最大获利 :   %6.0f\n', Report.maxprofit);
    fprintf('单次最大亏损:    %6.0f\n', Report.maxloss);
    fprintf('\n');
    fprintf('平均每笔利润:    %6.1f\n', Report.meanprofit);
    fprintf('获胜每笔利润:%6.1f\n', Report.winmeanprofit);
    fprintf('亏损每笔利润:%6.1f\n', Report.lossmeanprofit);
    fprintf('每笔交易波动:     %6.1f\n', Report.stdprofit);
    
    fprintf('\n');
    fprintf('总样本时间长度:   %6.0f\n',Report.timelength);
    fprintf('买入持有时间均值: %6.1f\n',Report.buyholdingdurcemean);
    fprintf('买入持有时间方差: %6.1f\n',Report.buyholdingdurcestd);
    fprintf('买入持有总长度:   %6.0f\n',Report.buyholdingdurce);
    fprintf('\n');
    fprintf('卖出持有时间均值: %6.1f\n',Report.sellholdingdurcemean);
    fprintf('卖出持有时间方差: %6.1f\n',Report.sellholdingdurcestd);
    fprintf('卖出时间总长度:   %6.0f\n',Report.sellholdingdurce);
    fprintf('交易占总时长比例: %6.1f\n',Report.timeholdingratio);
    fprintf('\n');
    fprintf('Sharper比值:      %6.2f\n', Report.Sharpe);
    fprintf('获胜比例:         %6.2f\n', Report.winprob);
    fprintf('现有持仓浮动收益: %6.0f\n', Report.floatprofit);
    fprintf('\n');
    %%
    figure(1)
    subplot(211)
    plot(cumsumprofit);
    hold on
    
    plot(creasesign,'ro','LineWidth',1,...
        'MarkerEdgeColor','k',...
        'MarkerFaceColor','r',...
        'MarkerSize',4);
    title('收益走势')
    grid on
    
    subplot(212)
    bar(output(:,2));
    title('分笔收益')
    grid on
    
     
  2. ----------策略参数--------------------------------
    敏感参数: 0.700
    价格最小变动单位: 10
    交易费用/每手: 60
    合约规模/手: 5
    是否止损: 1
    止损规模: 0.060
    是否重新开仓: 1
    **************************************************

    ----------统计报表--------------------------------
    盈利次数: 598
    获胜盈利所得 : 2463225
    亏损次数: 572
    亏损总额 : -1585975
    总交易次数 : 1170

    总获利: 877250
    交易费用: 70200
    净利润: 807050
    对象买入持有应该能得收益:186700

    最大资金回撤: -161100
    最长不盈利时长: 278
    单次最大获利 : 62700
    单次最大亏损: -38900

    平均每笔利润: 740.9
    获胜每笔利润:4119.1
    亏损每笔利润:-2772.7
    每笔交易波动: 6763.1

    总样本时间长度: 3876
    买入持有时间均值: 3.2
    买入持有时间方差: 2.4
    买入持有总长度: 1882

    卖出持有时间均值: 3.4
    卖出持有时间方差: 2.4
    卖出时间总长度: 1992
    交易占总时长比例: 1.0

    Sharper比值: 0.11
    获胜比例: 0.51
    现有持仓浮动收益: -2150
     
  3. 只测试了铜,图贴不上来。以上为matlab程序。
     
  4. Art = max([data(i-1,2)- data(i-1,3);data(i-1,4)- data(i-1,3)]) ; % high -low diff
    应该为:
    Art = max([data(i-1,2)- data(i-1,4);data(i-1,4)- data(i-1,3)]) ; % high-close,close-low



    ----------策略参数--------------------------------
    敏感参数: 0.700
    价格最小变动单位: 10
    交易费用/每手: 60
    合约规模/手: 5
    是否止损: 1
    止损规模: 0.060
    是否重新开仓: 1
    **************************************************

    ----------统计报表--------------------------------
    盈利次数: 759
    获胜盈利所得 : 2595775
    亏损次数: 690
    亏损总额 : -1805125
    总交易次数 : 1449

    总获利: 790650
    交易费用: 86940
    净利润: 703710
    对象买入持有应该能得收益:186700

    最大资金回撤: -132000
    最长不盈利时长: 404
    单次最大获利 : 62700
    单次最大亏损: -38900

    平均每笔利润: 536.4
    获胜每笔利润: 3420.0
    亏损每笔利润: -2616.1
    每笔交易波动: 6008.2

    总样本时间长度: 3876
    买入持有时间均值: 2.6
    买入持有时间方差: 1.8
    买入持有总长度: 1888

    卖出持有时间均值: 2.7
    卖出持有时间方差: 1.9
    卖出时间总长度: 1986
    交易占总时长比例: 1.0

    Sharper比值: 0.09
    获胜比例: 0.52
    现有持仓浮动收益: -1150

    从原策略结果来看,好像还不如用H-L大波动区间来的好。
     
  5. 但是如何处理价格反复触发买卖数值呢?你说的这个系统我知道。我用白糖,螺纹都测试过,效果都不错。但是满足条件的真正理想的交易日其实很少。只有大波动的单边市最理想。
     
  6. 经过优化,参数数值如下:
    K DeltaP C Stop V Re Siz
    1.05 10 60 1 0.1 1 5
    1.05 10 60 1 0.1 1 5
    1.05 10 60 1 0.09 1 5
    1.05 10 60 1 0.09 1 5
    1 10 60 1 0.1 1 5
    1 10 60 1 0.1 1 5
    1.05 10 60 1 0.08 1 5
    1.05 10 60 1 0.08 1 5
    1 10 60 1 0.09 1 5
    1 10 60 1 0.09 1 5
    1.1 10 60 1 0.1 1 5
    1.1 10 60 1 0.1 1 5
    1.05 10 60 1 0.07 1 5
    1.05 10 60 1 0.07 1 5
    0.95 10 60 1 0.1 1 5
    0.95 10 60 1 0.1 1 5
    1.1 10 60 1 0.09 1 5
    1.1 10 60 1 0.09 1 5
    0.95 10 60 1 0.09 1 5
    0.95 10 60 1 0.09 1 5
    1.15 10 60 1 0.1 1 5
    1.15 10 60 1 0.1 1 5
    0.85 10 60 1 0.1 1 5
    0.85 10 60 1 0.1 1 5
    1.3 10 60 1 0.1 1 5
    1.3 10 60 1 0.1 1 5
    1 10 60 1 0.08 1 5
    1 10 60 1 0.08 1 5
    0.8 10 60 1 0.1 1 5
    0.8 10 60 1 0.1 1 5
    1.3 10 60 0 0.01 0 5
    意味着,保留止损和重新开仓,效果更好。
    优化程序如下 :
    Code:
    clear all
    close
    clc
    data = xlsread ('continuous.xls','铜','B3:E3878');
    P(1,1) = 0 ;    % K
    P(2,1) =  10;   % DeltaP = P(2,1);
    P(3,1) = 60;    % fee = P(3,1) ;
    StopLossOrNot = [0;1]; % 
    P(5,1) = 0   ;   % StopLoss   ;
    ReOpen = [0;1];  % 
    P(7,1) = 5;
    OUT =[];
    for i=1:2
        for j=1:2
            for StopLoss = 0.01:0.01:0.1
                for K= 0.5:0.05:1.5
                    P(1,1) = K;
                    P(5,1) = StopLoss ;
                    P(4,1) = StopLossOrNot(i,1);
                    P(6,1) = ReOpen(j,1);
                    [Report Record] = dualstation (data,P);
                    a = struct2cell(Report);
                    b = cell2mat(a(2:end));
                    OUT = [OUT, [P;b]];
                end
            end
        end
    end
    
    OUT = OUT'; 
    
     
  7. 功夫好深!能否用外汇测试一下,比如欧元美元。
     
  8. 拿数据来 ,可以代劳 :)
     
  9. 在A股上简单试了一下, 非常奇怪, 在指数上效果出奇的好, 但个股上几乎全部亏损。
     
  10. 受于假期取数据限制,针对可得美元指数做了一个简单优化测试:报告如下:
    是否需要优化?0,1——0
    ----------策略参数--------------------------------
    敏感参数: 0.300
    价格最小变动单位: 0
    交易费用/每手: 0
    合约规模/手: 1
    是否止损: 0
    止损规模: 0.000
    是否重新开仓: 0
    **************************************************

    ----------统计报表--------------------------------
    盈利次数: 1733
    获胜盈利所得 : 1016.53
    亏损次数: 1465
    亏损总额 : -694.84
    总交易次数 : 3198

    总获利: 321.69
    交易费用: 959
    净利润: -637.71
    对象买入持有应该能得收益:-65.01

    最大资金回撤: -15.80
    最大资金回撤比例:-0.088
    最长不盈利时长: 1010
    单次最大获利 : 6.15
    单次最大亏损: -4.87

    平均每笔利润: 0.10
    获胜每笔利润: 0.59
    亏损每笔利润: -0.47
    每笔交易波动: 0.77

    总样本时间长度: 6401
    买入持有时间均值: 1.5
    买入持有时间方差: 0.9
    买入持有总长度: 2415

    卖出持有时间均值: 2.5
    卖出持有时间方差: 0.8
    卖出时间总长度: 3983
    交易占总时长比例: 1.0

    Sharper比值: 0.13
    获胜比例: 0.54
    现有持仓浮动收益: -0.69

    最优参数有明显聚类现象(取前三十最高打分):
    K DeltaP fee Stoplossornot stoploss ReOpen Siz winnums winprofit lossnums
    0.3 0.01 0 0 0.01 0 1 1639 952.32 1347
    0.3 0.01 0 0 0.03 0 1 1639 952.32 1347
    0.3 0.01 0 0 0.05 0 1 1639 952.32 1347
    0.3 0.01 0 0 0.07 0 1 1639 952.32 1347
    0.3 0.01 0 0 0.09 0 1 1639 952.32 1347
    0.42 0.01 0 0 0.01 0 1 1402 883.06 1285
    0.42 0.01 0 0 0.03 0 1 1402 883.06 1285
    0.42 0.01 0 0 0.05 0 1 1402 883.06 1285
    0.42 0.01 0 0 0.07 0 1 1402 883.06 1285
    0.42 0.01 0 0 0.09 0 1 1402 883.06 1285
    0.32 0.01 0 0 0.01 0 1 1584 928.84 1344
    0.32 0.01 0 0 0.03 0 1 1584 928.84 1344
    0.32 0.01 0 0 0.05 0 1 1584 928.84 1344
    0.32 0.01 0 0 0.07 0 1 1584 928.84 1344
    0.32 0.01 0 0 0.09 0 1 1584 928.84 1344
    0.36 0.01 0 0 0.01 0 1 1515 906.16 1329
    0.36 0.01 0 0 0.03 0 1 1515 906.16 1329
    0.36 0.01 0 0 0.05 0 1 1515 906.16 1329
    0.36 0.01 0 0 0.07 0 1 1515 906.16 1329
    0.36 0.01 0 0 0.09 0 1 1515 906.16 1329
    0.34 0.01 0 0 0.01 0 1 1548 915.22 1334
    0.34 0.01 0 0 0.03 0 1 1548 915.22 1334
    0.34 0.01 0 0 0.05 0 1 1548 915.22 1334
    0.34 0.01 0 0 0.07 0 1 1548 915.22 1334
    0.34 0.01 0 0 0.09 0 1 1548 915.22 1334
    0.4 0.01 0 0 0.01 0 1 1435 889.84 1313
    0.4 0.01 0 0 0.03 0 1 1435 889.84 1313
    0.4 0.01 0 0 0.05 0 1 1435 889.84 1313
    0.4 0.01 0 0 0.07 0 1 1435 889.84 1313
    0.4 0.01 0 0 0.09 0 1 1435 889.84 1313



    lossprofit totalnums totalprofit floatprofit fees netprofit BuyandHold maxprofit maxloss
    -638.65 2986 313.67 0.02 0 313.67 -72.64 5 -4.87
    -638.65 2986 313.67 0.02 0 313.67 -72.64 5 -4.87
    -638.65 2986 313.67 0.02 0 313.67 -72.64 5 -4.87
    -638.65 2986 313.67 0.02 0 313.67 -72.64 5 -4.87
    -638.65 2986 313.67 0.02 0 313.67 -72.64 5 -4.87
    -599.82 2687 283.24 0.21 0 283.24 -72.64 5.64 -4.87
    -599.82 2687 283.24 0.21 0 283.24 -72.64 5.64 -4.87
    -599.82 2687 283.24 0.21 0 283.24 -72.64 5.64 -4.87
    -599.82 2687 283.24 0.21 0 283.24 -72.64 5.64 -4.87
    -599.82 2687 283.24 0.21 0 283.24 -72.64 5.64 -4.87
    -645.66 2928 283.18 0.97 0 283.18 -72.64 5 -4.87
    -645.66 2928 283.18 0.97 0 283.18 -72.64 5 -4.87
    -645.66 2928 283.18 0.97 0 283.18 -72.64 5 -4.87
    -645.66 2928 283.18 0.97 0 283.18 -72.64 5 -4.87
    -645.66 2928 283.18 0.97 0 283.18 -72.64 5 -4.87
    -623.39 2844 282.77 0.96 0 282.77 -72.64 5 -4.87
    -623.39 2844 282.77 0.96 0 282.77 -72.64 5 -4.87
    -623.39 2844 282.77 0.96 0 282.77 -72.64 5 -4.87
    -623.39 2844 282.77 0.96 0 282.77 -72.64 5 -4.87
    -623.39 2844 282.77 0.96 0 282.77 -72.64 5 -4.87
    -638.02 2882 277.2 0.97 0 277.2 -72.64 5 -4.87
    -638.02 2882 277.2 0.97 0 277.2 -72.64 5 -4.87
    -638.02 2882 277.2 0.97 0 277.2 -72.64 5 -4.87
    -638.02 2882 277.2 0.97 0 277.2 -72.64 5 -4.87
    -638.02 2882 277.2 0.97 0 277.2 -72.64 5 -4.87
    -614.29 2748 275.55 0.22 0 275.55 -72.64 5.64 -4.87
    -614.29 2748 275.55 0.22 0 275.55 -72.64 5.64 -4.87
    -614.29 2748 275.55 0.22 0 275.55 -72.64 5.64 -4.87
    -614.29 2748 275.55 0.22 0 275.55 -72.64 5.64 -4.87
    -614.29 2748 275.55 0.22 0 275.55 -72.64 5.64 -4.87


    maxdrawback maxdrawbackratio winmeanprofit lossmeanprofit recoverdurce meanprofit stdprofit Sharpe winprob
    -15.8 -0.088113936 0.581037218 -0.474127691 502 0.104661328 0.759145042 0.137867367 0.548894843
    -15.8 -0.088113936 0.581037218 -0.474127691 502 0.104661328 0.759145042 0.137867367 0.548894843
    -15.8 -0.088113936 0.581037218 -0.474127691 502 0.104661328 0.759145042 0.137867367 0.548894843
    -15.8 -0.088113936 0.581037218 -0.474127691 502 0.104661328 0.759145042 0.137867367 0.548894843
    -15.8 -0.088113936 0.581037218 -0.474127691 502 0.104661328 0.759145042 0.137867367 0.548894843
    -13.36 -0.088113936 0.629857347 -0.466785992 649 0.104787273 0.800280403 0.130938197 0.521771492
    -13.36 -0.088113936 0.629857347 -0.466785992 649 0.104787273 0.800280403 0.130938197 0.521771492
    -13.36 -0.088113936 0.629857347 -0.466785992 649 0.104787273 0.800280403 0.130938197 0.521771492
    -13.36 -0.088113936 0.629857347 -0.466785992 649 0.104787273 0.800280403 0.130938197 0.521771492
    -13.36 -0.088113936 0.629857347 -0.466785992 649 0.104787273 0.800280403 0.130938197 0.521771492
    -16.61 -0.088113936 0.586388889 -0.480401786 670 0.096221543 0.769583037 0.125030748 0.540983607
    -16.61 -0.088113936 0.586388889 -0.480401786 670 0.096221543 0.769583037 0.125030748 0.540983607
    -16.61 -0.088113936 0.586388889 -0.480401786 670 0.096221543 0.769583037 0.125030748 0.540983607
    -16.61 -0.088113936 0.586388889 -0.480401786 670 0.096221543 0.769583037 0.125030748 0.540983607
    -16.61 -0.088113936 0.586388889 -0.480401786 670 0.096221543 0.769583037 0.125030748 0.540983607
    -15.34 -0.088113936 0.598125413 -0.469066968 649 0.098905212 0.774836689 0.127646526 0.532700422
    -15.34 -0.088113936 0.598125413 -0.469066968 649 0.098905212 0.774836689 0.127646526 0.532700422
    -15.34 -0.088113936 0.598125413 -0.469066968 649 0.098905212 0.774836689 0.127646526 0.532700422
    -15.34 -0.088113936 0.598125413 -0.469066968 649 0.098905212 0.774836689 0.127646526 0.532700422
    -15.34 -0.088113936 0.598125413 -0.469066968 649 0.098905212 0.774836689 0.127646526 0.532700422
    -16.87 -0.088113936 0.59122739 -0.478275862 654 0.095487427 0.77337845 0.123467918 0.537126995
    -16.87 -0.088113936 0.59122739 -0.478275862 654 0.095487427 0.77337845 0.123467918 0.537126995
    -16.87 -0.088113936 0.59122739 -0.478275862 654 0.095487427 0.77337845 0.123467918 0.537126995
    -16.87 -0.088113936 0.59122739 -0.478275862 654 0.095487427 0.77337845 0.123467918 0.537126995
    -16.87 -0.088113936 0.59122739 -0.478275862 654 0.095487427 0.77337845 0.123467918 0.537126995
    -21.21 -0.088113936 0.620097561 -0.467852247 679 0.09965642 0.792181397 0.1258 0.522197962
    -21.21 -0.088113936 0.620097561 -0.467852247 679 0.09965642 0.792181397 0.1258 0.522197962
    -21.21 -0.088113936 0.620097561 -0.467852247 679 0.09965642 0.792181397 0.1258 0.522197962
    -21.21 -0.088113936 0.620097561 -0.467852247 679 0.09965642 0.792181397 0.1258 0.522197962
    -21.21 -0.088113936 0.620097561 -0.467852247 679 0.09965642 0.792181397 0.1258 0.522197962

    timelength buyholdingdurcemean buyholdingdurcestd buyholdingdurce sellholdingdurcemean sellholdingdurcestd sellholdingdurce timeholdingratio
    5998 1.510680908 0.864318709 2263 2.490326885 0.850904545 3733 0.999666556
    5998 1.510680908 0.864318709 2263 2.490326885 0.850904545 3733 0.999666556
    5998 1.510680908 0.864318709 2263 2.490326885 0.850904545 3733 0.999666556
    5998 1.510680908 0.864318709 2263 2.490326885 0.850904545 3733 0.999666556
    5998 1.510680908 0.864318709 2263 2.490326885 0.850904545 3733 0.999666556
    5998 1.710584752 1.109500601 2311 2.724852071 1.133451059 3684 0.999499833
    5998 1.710584752 1.109500601 2311 2.724852071 1.133451059 3684 0.999499833
    5998 1.710584752 1.109500601 2311 2.724852071 1.133451059 3684 0.999499833
    5998 1.710584752 1.109500601 2311 2.724852071 1.133451059 3684 0.999499833
    5998 1.710584752 1.109500601 2311 2.724852071 1.133451059 3684 0.999499833
    5998 1.541128484 0.901722361 2267 2.531929348 0.900373561 3727 0.999333111
    5998 1.541128484 0.901722361 2267 2.531929348 0.900373561 3727 0.999333111
    5998 1.541128484 0.901722361 2267 2.531929348 0.900373561 3727 0.999333111
    5998 1.541128484 0.901722361 2267 2.531929348 0.900373561 3727 0.999333111
    5998 1.541128484 0.901722361 2267 2.531929348 0.900373561 3727 0.999333111
    5998 1.590622813 0.97428935 2273 2.602097902 0.982916963 3721 0.999333111
    5998 1.590622813 0.97428935 2273 2.602097902 0.982916963 3721 0.999333111
    5998 1.590622813 0.97428935 2273 2.602097902 0.982916963 3721 0.999333111
    5998 1.590622813 0.97428935 2273 2.602097902 0.982916963 3721 0.999333111
    5998 1.590622813 0.97428935 2273 2.602097902 0.982916963 3721 0.999333111
    5998 1.55685734 0.92924117 2259 2.57231405 0.942673524 3735 0.999333111
    5998 1.55685734 0.92924117 2259 2.57231405 0.942673524 3735 0.999333111
    5998 1.55685734 0.92924117 2259 2.57231405 0.942673524 3735 0.999333111
    5998 1.55685734 0.92924117 2259 2.57231405 0.942673524 3735 0.999333111
    5998 1.55685734 0.92924117 2259 2.57231405 0.942673524 3735 0.999333111
    5998 1.662083936 1.055036264 2297 2.673897325 1.084000101 3698 0.999499833
    5998 1.662083936 1.055036264 2297 2.673897325 1.084000101 3698 0.999499833
    5998 1.662083936 1.055036264 2297 2.673897325 1.084000101 3698 0.999499833
    5998 1.662083936 1.055036264 2297 2.673897325 1.084000101 3698 0.999499833
    5998 1.662083936 1.055036264 2297 2.673897325 1.084000101 3698 0.999499833
     
  11. 受教了
     
  12. jemnbo, 辛苦了,请不要使用ATR过滤。
     
  13. 您的提问很有道理,我喜欢“新人”, 我喜欢异想天开的问题,我认为天是可以开的。
     
  14. 这个帖子是在2009年给我启发最大的帖子之一。M兄是个人物,给您拜年了!还没过元宵节,不算晚吧?

    我研究这个系统已经一年多了,要想用好这个系统,至少要解决两个问题,一个是跳空问题,另一个是长K线问题。

    第一个问题就是amy0_li的问题。这个系统用在豆子麦子上那是很差的。豆麦的K线,像<神话〉里面的天梯,只见横板,不见护栏。豆麦的问题很容易解决,这个系统是宝剑,收割麦子和豆子另找镰刀。问题出在有色金属和指数期货上,这些地方一般有护栏,这个系统很好用,偶尔有跳空,这才是问题。能放弃,再难的问题也不是问题。不能放弃的问题才是问题。风险管理是必须的。

    其次,要跟RTS系统结合。长K线出现以后面临着很大的风险敞口。假若,T日持有多头,T日是一根长K线,T+1日正常开盘,T+1日“多-空”反转点相对T日的收盘价会拉得很远。长K线的出现一定是有原因的,不管什么原因,一石激起千层浪,浪已经起来了,就不可能很快平息下去。我的探索结果是,可以借鉴RTS。dual thrust, RTS, swing trading(Larry),一脉同源。
     
  15. 没有用ATR过滤啊:(
    我只是加入止损阀值以及止损后是否立即开仓而已。
    跳空缺口,我考虑是否可用open(i)- close(i-1),经过一些统计算法,调整出一个参数,放入到 max( high(i)- close(i), close(i)- low(i) , adjusted(open(i)- close(i-1)) )中? :confused:
     

  16. Giga你好,也祝你新年好运。

    如果我没有理解错的话,你的研究重点怎样提高单个品种的绩效。我想对于一个逻辑简单的策略来说,更重要的是如何通过多品种分散风险。建议把重点放在组合上--选取适当的组合和风险搭配。

    滤网要考虑停板。停板的K线如果把它按一般意义来解释,会迷惑电脑程序。

    国内期货我感觉有很多品种是跟外盘走的。这些品种没有独立性,主要趋势在隔夜走完了,国内盘只能喝点剩汤。品种的选择要考虑这一点。

    M
     
  17. TB代码这个编程倒是比较简单,但是楼主这个系统恐怕不适合日内交易啊,国内期货隔夜风险很大。
     
  18. 非常棒的系统!

    是轴心交易的延伸!

    开盘的触发条件很棒!

    原来在国内股票上测试用轴心阻力做开盘封停测试,发现阻力位不好确定是第一阻力还是第二阻力,后来加了突破周线第一阻力轴心过滤,效果好了一点,但是,最好的还是这个公式,神了!
     
  19. 恩,不错
     
  20. 两个TB的代码都没有解决日内重复开仓平仓的问题