以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  debugfile连续打印怎么办?  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=54401)

--  作者:aaliwei91
--  发布时间:2013/7/29 16:30:23
--  debugfile连续打印怎么办?
 比如最简单的策略,每两分钟交易一次:

 variable:n=0,di=0,path=\'d:\\gf\\signal1\\debug.txt\',last_minute=-1,cur_minute=-1,can_print=1,last_hold=0;

n:=n+1;
m:=mod(n,2);
if (m<>0) then can_print:=0;
//cc:can_print;

lh:last_hold;
ch:holding;
if (m=0) THEN
BEGIN
    if (ISLASTBAR) then
    BEGIN
        can_print:=1;
        if (holding<1) THEN
        begin
            开多:buy(holding=0, 1, market);
            cur_minute:=minute();
            //ll:last_minute;
            //cc:cur_minute;
            if (holding=1 and last_hold<>1) THEN
            BEGIN
                DEBUGFILE(path,\'1B K%.0f\',holding);
                last_minute:=cur_minute;
                can_print:=0;
                last_hold:=1;
            END;
        end Else
        if (holding=1) THEN
        BEGIN
            平多:sell(holding=1,100%,market);
            开空:buyshort(holding=0,1,market);
            di:=-1;
            if (holding=-1 and last_hold<>-1) then
            begin
                DEBUGFILE(path,\'S K%.0f\',holding);
                can_print:=0;
                last_hold:=-1;
            end;
        end else if (holding=-1) then
        BEGIN
            平空:sellshort(holding=-1,100%,market);
            开多2:buy(holding=0,1,market);
            if (holding=1 and last_hold<>1) then
            begin
                DEBUGFILE(path,\'2B K%.0f\',holding);
                can_print:=0;
                last_hold:=1;
            end;
        end;
    end;
end;


但打印出来的结果:

2013-07-29 16:21:05.093    1B K1
2013-07-29 16:21:05.094    1B K1
2013-07-29 16:21:06.608    1B K1
2013-07-29 16:21:06.609    1B K1
2013-07-29 16:21:08.125    1B K1
2013-07-29 16:21:08.125    1B K1
2013-07-29 16:21:09.655    1B K1
2013-07-29 16:21:09.656    1B K1
2013-07-29 16:21:11.150    1B K1
2013-07-29 16:21:11.150    1B K1
2013-07-29 16:21:13.256    1B K1
2013-07-29 16:21:13.257    1B K1
2013-07-29 16:21:14.174    1B K1
2013-07-29 16:21:14.174    1B K1
2013-07-29 16:21:15.687    1B K1
2013-07-29 16:21:15.688    1B K1
2013-07-29 16:21:17.200    1B K1
2013-07-29 16:21:17.201    1B K1
2013-07-29 16:21:18.724    1B K1
2013-07-29 16:21:18.725    1B K1
2013-07-29 16:21:20.226    1B K1
2013-07-29 16:21:20.226    1B K1
2013-07-29 16:21:21.744    1B K1
2013-07-29 16:21:21.745    1B K1
2013-07-29 16:21:23.254    1B K1
2013-07-29 16:21:23.254    1B K1
2013-07-29 16:21:24.770    1B K1
2013-07-29 16:21:24.770    1B K1
2013-07-29 16:21:26.292    1B K1
2013-07-29 16:21:26.293    1B K1
2013-07-29 16:21:27.808    1B K1
2013-07-29 16:21:27.812    1B K1
2013-07-29 16:21:29.312    1B K1
2013-07-29 16:21:29.313    1B K1
2013-07-29 16:21:30.821    1B K1
2013-07-29 16:21:30.822    1B K1
2013-07-29 16:21:32.332    1B K1
2013-07-29 16:21:32.333    1B K1
2013-07-29 16:21:33.849    1B K1
2013-07-29 16:21:33.849    1B K1
2013-07-29 16:21:35.362    1B K1
2013-07-29 16:21:35.363    1B K1
2013-07-29 16:21:36.875    1B K1
2013-07-29 16:21:36.876    1B K1
2013-07-29 16:21:38.384    1B K1
2013-07-29 16:21:38.385    1B K1
2013-07-29 16:21:39.911    1B K1
2013-07-29 16:21:39.912    1B K1
2013-07-29 16:21:41.413    1B K1
2013-07-29 16:21:41.413    1B K1
2013-07-29 16:21:42.936    1B K1
2013-07-29 16:21:42.937    1B K1
2013-07-29 16:21:44.439    1B K1
2013-07-29 16:21:44.439    1B K1
2013-07-29 16:21:45.955    1B K1
2013-07-29 16:21:45.955    1B K1
2013-07-29 16:21:47.470    1B K1
2013-07-29 16:21:47.471    1B K1
2013-07-29 16:21:48.979    1B K1
2013-07-29 16:21:48.982    1B K1
2013-07-29 16:21:50.493    1B K1
2013-07-29 16:21:50.494    1B K1
2013-07-29 16:21:52.007    1B K1
2013-07-29 16:21:52.009    1B K1
2013-07-29 16:21:53.546    1B K1
2013-07-29 16:21:53.546    1B K1
2013-07-29 16:21:55.031    1B K1
2013-07-29 16:21:55.031    1B K1
2013-07-29 16:21:56.584    1B K1
2013-07-29 16:21:56.584    1B K1
2013-07-29 16:22:58.806    1B K1
2013-07-29 16:22:58.807    1B K1
2013-07-29 16:23:00.316    1B K1
2013-07-29 16:23:00.317    1B K1
2013-07-29 16:23:02.203    1B K1

。。。

请各位大侠帮忙看看哪里出了问题?谢谢。

--  作者:jinzhe
--  发布时间:2013/7/29 16:45:54
--  
这个是有行情刷新就会打印一次