公式很简单,股票账户中也有持仓,但利用debugfile总是输出错误的结果,不知道是我对函数的用法有误,还是函数用于股市有问题?下面附公式:
runmode:0;
if tholding>0 then DEBUGFILE('c:\chicangshijian.txt','持仓时间=%.0f'+',品种:'+stkname,tenterbars(0));
持仓输出正常,公式如下:
runmode:0;
if tholding>0 then DEBUGFILE('c:\chicangshijian.txt','持仓量=%.0f'+',品种:'+stkname,tholding);
if tholding>0 then DEBUGFILE('c:\chicangshijian.txt','持仓时间=%.0f'+',品种:'+stkname,tenterbars(0));
输出如下:
2012-05-11 09:01:22.879 持仓量=400,品种:华联控股
2012-05-11 09:01:22.880 持仓时间=-1,品种:华联控股
2012-05-11 09:01:23.558 持仓量=200,品种:中水渔业
2012-05-11 09:01:23.558 持仓时间=-1,品种:中水渔业
2012-05-11 09:01:24.033 持仓量=200,品种:利欧股份
2012-05-11 09:01:24.034 持仓时间=-1,品种:利欧股份
2012-05-11 09:01:24.076 持仓量=100,品种:精诚铜业
2012-05-11 09:01:24.076 持仓时间=-1,品种:精诚铜业
2012-05-11 09:01:24.311 持仓量=100,品种:新筑股份
2012-05-11 09:01:24.312 持仓时间=-1,品种:新筑股份
2012-05-11 09:01:24.389 持仓量=100,品种:中泰桥梁
2012-05-11 09:01:24.389 持仓时间=-1,品种:中泰桥梁
2012-05-11 09:01:24.442 持仓量=100,品种:四川路桥
2012-05-11 09:01:24.443 持仓时间=-1,品种:四川路桥
2012-05-11 09:01:24.637 持仓量=100,品种:西部资源
2012-05-11 09:01:24.637 持仓时间=-1,品种:西部资源
认真研读过说明,空仓情况下输出-1,问题是目前有持仓。当然,可能我的理解还不到位,或者牵涉到哪里的设置会有影响?