VARIABLE:nums=0;
if long and nums=0 then
begin
buy(holding=0,1,market);
nums:=1;
end
是不是这样写啊,好像我开不了仓。
另,平仓是否要定义nums啊?
编译没通过吧?
稍等
variable:nums=0;
short:=cross(ma(c,10),ma(c,5));
long:=cross(ma(c,5),ma(c,10));
tt:= time>092000 and time<151000;
n:=barslast(date<>ref(date,1))+1;
if n then begin
if long and tt and nums=0 then
begin
buy(holding=0,1,market);
nums:=1;
end
if short and tt and nums=1 then
begin
sell(holding>0,0,market);
end
if time>=151000 then nums:=0;//收盘前赋值变回去
end