金折,下面的代码是我曾经询问过的,但是正好今天有跌停,我验证了有下,输出不对啊: if rmmr<>dynainfo(28) and tholding<>0 then
begin
rmmr:=dynainfo(28);//当前买入价
rmmrtime:=timetot0(dynainfo(207));//当前买入价起始时间
end
if rmmc<>dynainfo(34) and tholding<>0 then
begin
rmmc:=dynainfo(34);//当前卖出价
rmmctime:=timetot0(dynainfo(207));//当前卖出价起始时间
end
rmmrcxsj:=timetot0(dynainfo(207))-rmmrtime;//当前买入价持续时间
rmmccxsj:=timetot0(dynainfo(207))-rmmctime;//当前卖出价持续时间
DEBUGFILE('D:\金子塔调试文件保存\TEST.TXT','买入持续时间为 %.0f',RMMRCXSJ);
DEBUGFILE('D:\金子塔调试文件保存\TEST.TXT','卖出持续时间为 %.0f',RMMCcxsj);
[此贴子已经被作者于2015/7/8 10:48:11编辑过]
用extgbdataset试试
[此贴子已经被作者于2015/7/8 10:56:42编辑过]
我现在代码中,起始定义RMMR和RMMC为1,也就是:
GLOBALVARIABLE:rmmr=1,rmmc=1;
啊,必须要用EXTGBDATASETAMT吗?我就是想避免这个东西的,因为其他的策略里也用用到这个代码的。
我不想改的太多了,不然就乱了。
还是输出不对啊。拿螺纹钢来试的,总是输出-1 。//价位持续一定时间后的处理
if extgbdata('rmmr')=0 then extgbdataset('rmmr',1);
if extgbdata('rmmc')=0 then extgbdataset('rmmc',1);
if extgbdata('rmmrtime')=0 then extgbdataset('rmmr',1);
if extgbdata('rmmctime')=0 then extgbdataset('rmmc',1);
if extgbdata('rmmr')<>dynainfo(28) and tholding<>0 then
begin
extgbdataset('rmmr',dynainfo(28));//当前买入价
rmmrtime:=extgbdataset('rmmrtime',timetot0(dynainfo(207)));//当前买入价起始时间
end
if extgbdata('rmmc')<>dynainfo(34) and tholding<>0 then
begin
extgbdataset('rmmc',dynainfo(34));//当前卖出价
rmmctime:=extgbdataset('rmmctime',timetot0(dynainfo(207)));//当前卖出价起始时间
end
rmmrcxsj:=timetot0(dynainfo(207))-rmmrtime;//当前买入价持续时间
rmmccxsj:=timetot0(dynainfo(207))-rmmctime;//当前卖出价持续时间
DEBUGFILE('D:\金子塔调试文件保存\TEST.TXT','买入持续时间为 %.0f',RMMRCXSJ);
DEBUGFILE('D:\金子塔调试文件保存\TEST.TXT','卖出持续时间为 %.0f',RMMCcxsj);
if extgbdata('rmmr')=0 then extgbdataset('rmmr',1);
if extgbdata('rmmc')=0 then extgbdataset('rmmc',1);
if extgbdata('rmmrtime')=0 then extgbdataset('rmmr',1);
if extgbdata('rmmctime')=0 then extgbdataset('rmmc',1);
if extgbdata('rmmr')<>dynainfo(28) then
begin
extgbdataset('rmmr',dynainfo(28));//当前买入价
extgbdataset('rmmrtime',timetot0(dynainfo(207)));//当前买入价起始时间
end
if extgbdata('rmmc')<>dynainfo(34) then
begin
extgbdataset('rmmc',dynainfo(34));//当前卖出价
extgbdataset('rmmctime',timetot0(dynainfo(207)));//当前卖出价起始时间
end
rmmrtime:extgbdata('rmmrtime');
rmmctime:extgbdata('rmmctime');
rmmrcxsj:timetot0(dynainfo(207))-rmmrtime;//当前买入价持续时间
rmmccxsj:timetot0(dynainfo(207))-rmmctime;//当前卖出价持续时间
dd:timetot0(dynainfo(207));
DEBUGFILE('D:\TEST.TXT','买入持续时间为 %.0f',RMMRCXSJ);
DEBUGFILE('D:\TEST.TXT','卖出持续时间为 %.0f',RMMCcxsj);