你开仓信号用平仓周期来判断,那会有信号吗?不开仓会有平仓周期吗?
用全局变量来记录
variable:bj=0;
if bj=0 and holding=0 and 开多条件 then begin
buy.......;
bj:=1;
end
if bj=0 and holding=0 and 开空条件 then begin
buyshort.......;
bj:=1;
end
if typebar(1,2)>10 and typebar(1,4)>10 and bj=1 and holding=0 and 开多条件 then buy.......;
if typebar(1,2)>10 and typebar(1,4)>10 and bj=1 and holding=0 and 开空条件 then buyshort....;