Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:DEBUGFILE2输出是1和0的交替输出,求解?

1楼
fly 发表于:2011/5/9 15:28:38

3分钟K线,固定时间间隔--1秒,

意图:一旦有可用仓位,使状态标志为1.

       一旦无实际持仓时,使状态标志为0.

 

一直是有实际持仓的.可DEBUGFILE2输出日志中,是1和0的交替输出,求解,谢谢

IF tholding<>0 and extgbdata ('状态标志')=0 then begin
     DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
     extgbdataset('状态标志',1);
 END
 
 IF tholding2=0 and extgbdata ('状态标志')=1 then begin
     DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
     extgbdataset('状态标志',0);
 END

 

输出日志中,是1和0的交替输出

2011-05-09 14:11:17.242    状态标志:1.00
2011-05-09 14:11:17.252    状态标志:0.00
2011-05-09 14:11:18.262    状态标志:1.00
2011-05-09 14:11:18.267    状态标志:0.00
2011-05-09 14:11:19.267    状态标志:1.00
2011-05-09 14:11:19.282    状态标志:0.00
2011-05-09 14:11:20.282    状态标志:1.00
2011-05-09 14:11:20.292    状态标志:0.00
2011-05-09 14:11:21.302    状态标志:1.00
2011-05-09 14:11:21.312    状态标志:0.00
2011-05-09 14:11:22.352    状态标志:1.00
2011-05-09 14:11:22.362    状态标志:0.00

2楼
hebeihk 发表于:2011/5/9 15:45:28

相当于

IF tholding<>0 and extgbdata ('状态标志')=0 then begin
DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
extgbdataset('状态标志',1);
END

IF {tholding2=0 and } extgbdata ('状态标志')=1 then begin
DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
extgbdataset('状态标志',0);
END

仓位一直存在,就是说第二个IF里的tholding2=0 没 起作用

 

3楼
王锋 发表于:2011/5/9 16:09:26

IF ISLASTBAR then begin
IF tholding<>0 and extgbdata ('状态标志')=0 then begin
     DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
     extgbdataset('状态标志',1);
 END
 
 IF tholding2=0 and extgbdata ('状态标志')=1 then begin
     DEBUGFILE2('d:\1111.txt','状态标志:%.2f',extgbdata ('状态标志'),1);
     extgbdataset('状态标志',0);
 END

END

 

这样就没问题了

共3 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.03809 s, 3 queries.