这是一个具体的例子:
runmode:0;
variable:cc=0;
islast:=islastbar;
bb:=c>o+0.6;
ss:=c<o-0.6;
if cc>0 and ss then begin
cc:=0;
end
if cc<0 and bb then begin
cc:=0;
end
if cc=0 and bb then begin
cc:=1;
end
if cc=0 and ss then begin
cc:=-1;
end
lcc:=ref(cc,1);
if islast then att:=extgbdata('att');
if (lcc>0 and cc<=0) or (islast and cc<=0 and barpos>att and tbuyholding(1)>0) then begin
exitlong:1;
if lcc>0 and cc<=0 and islast then extgbdataset('att',barpos);
end
if (lcc<0 and cc>=0) or (islast and cc>=0 and barpos>att and tsellholding(1)>0) then begin
exitshort:1;
if lcc<0 and cc>=0 and islast then extgbdataset('att',barpos);
end
if (lcc<=0 and cc>0) or (islast and cc>0 and barpos>att and tbuyholding(1)=0) then begin
enterlong:1;
if lcc<=0 and cc>0 and islast then extgbdataset('att',barpos);
end
if (lcc>=0 and cc<0) or (islast and cc<0 and barpos>att and tsellholding(1)=0) then begin
entershort:1;
if lcc>=0 and cc<0 and islast then extgbdataset('att',barpos);
end
盘中出现信号即下单,次周期检查信号是否消失,如果消失补回持仓
固定轮询1秒或者高频
[此贴子已经被作者于2012-3-8 15:19:26编辑过]