//用的是1分钟K线,走完一根K线
runmode:1;
price:='price';// 全局变量,控制开仓次数
if tholding=0 and DYNAINFO(207)>112300 then
begin
tbuy(1,1,mkt);
extgbdataset('price',close);//记录开仓价格
end
tsell(tholding>0 and tenterbars>5,1,mkt);
if islastbar then
begin
DEBUGFILE2('d:\debug.txt','xinhao:%.2f',ttype(1),1);//+',当前持仓量:'+numtostr(abs(tholding),0)
DEBUGFILE2('d:\debug.txt','jiage:%.2f',extgbdata('price'),1);
end
全局变量price的值在每根K线上,都有变化,且变化为该周期的开盘价
从全局变量表里,和DEBUG文件里看到的都是这样.
我明明限定了,在开仓的时候,才改变其值,应该一直都是开仓价的
在该句中加入了红色部分,貌似正常了,明天继续跟踪一下.
if tholding=0 and DYNAINFO(207)>112300 and islastbar then
begin
tbuy(1,1,mkt);
extgbdataset('price',close);//记录开仓价格
end