con:1;//开仓条件
str:stklabel&'.'&'date';//全局变量字符串名称
//初始开仓
if con and date>extgbdata(str) and tbuyholdingex('','',2)=0 then
begin
tbuy(1,1,mkt);
extgbdataset(str,date);
end
//加仓
if con and date>extgbdata(str) and tbuyholdingex('','',1)>0 then
begin
tbuy(1,1,mkt);
extgbdataset(str,date);
end
if con条件 and date>extgbdata(str) and tbuyholdingex('','',2)=0 then
begin
tbuy(1,1,mkt);
extgbdataset(str,date);
end
这里文件输出的结果显示date和extgbdata(str)是同一个数值,条件不满足,无法开仓
now:(date+19000000)*1000000+time;//k的唯一标识
globalvariable:newk:=0;
str_d:=stklabel&'.'&'location';
//初始标记的条件,即满足这个条件 就开始计数
if C>ref(C,40) then begin
EXTGBDATASET(str_d,now);
end
GET_D:EXTGBDATA(str_d);//读取最开始保存的K日期+时间信息
LEN:BARSLAST(NOW=GET_D);//利用BARSLAST 直接回溯满足条件位置,而不是利用全局变量技术。