用全局变量,开一次仓开仓次数加1,例如
VARIABLE:n=0;
if date<>ref(date,1) then n:=0;
if 开仓条件 then begin
buy();
n:=n+1;
end
n就是开仓次数
[此贴子已经被作者于2015/1/29 9:42:07编辑过]
H10:=REF(HHV(H,5),1);
L10:=REF(LLV(L,5),1);
VARIABLE:m=0;
if date<>ref(date,1) then m:=0;
if h>h10 and holding<=entervol*1 and (m=0 or m=1) and time>091600 and time<150000 then begin
sellshort(1,0,market);
buy(1,1,market);
m:=m+1;
end
if l<l10 and holding<=entervol*-1 and (m=0 or m=1) and time>091600 and time<150000 then begin
sell(1,0,market);
buyshort(1,1,market);
m:=m+1;
end
if L<ENTERPRICE-20 and enterbars>0 then begin
sell(1,entervol,market);
end
if h>ENTERPRICE+20 and enterbars>0 then begin
sellshort(1,entervol,market);
end
if time>=151000 then begin
sellshort(1,0,market);
sell(1,0,market);
m:=0;
end
这样写,哪个地方错了,一笔交易都没有
我想在同时控制总仓量的单位数的情况下 ,又控制每天的开仓次数,