if holding=0 then begin
if enterlongcond then begin
buy(1,1,market);
HL:=high;
cc:=1;
end
if entershortcond then begin
buyshort(1,1,market);
HL:=low;
cc:=-1;
end
end
//中间变量
if cc=-1 and low<HL then begin
HL:=low;
end
if cc=1 and high>HL then begin
HL:=high;
end
//加仓
if cc=1 and HL-close>=dayopen*0.01 then begin
buy(1,1,market);
cc:=2;
end
if cc=-1 and close-HL>=dayopen*0.01 then begin
buyshort(1,1,market);
cc:=-2;
end
原意是最高回撤开盘价1%加仓1手,但是结果出来后只有多头会加仓,空头不会加仓,请高手看看到底哪里写错了。
[此贴子已经被作者于2013-3-21 23:33:45编辑过]
if holding<0 and enterlongcond then begin
sellshort(1,0,thisclose);
end
if holding>0 and entershortcond then begin
sell(1,0,thisclose);
end
平仓有写的,很简单应该没问题就没贴上,主条件就是一根均线突破