N1=1
longcond:=平空开多条件
shortcond:=平多开空条件;
if holding=0 then begin
if longcond then
buy(1,N1,THISCLOSE);
end
if holding=0 then begin
if shortcond then
buyshort(1,N1,THISCLOSE);
end
if holding>0 then begin
if shortcond then begin
sell(1,holding,THISCLOSE);
buyshort(1,N1,THISCLOSE);
end
end
if holding<0 then begin
if longcond then begin
sellshort(1,holding,THISCLOSE);
buy(1,N1,THISCLOSE);
end
请帮忙看看这个下单程序有没有逻辑混乱的地方,为什么模拟时,总是出现多个 委托单,成交后又平掉,剩下一个单。程序中是不是有重复下单的问题,请帮忙指出来谢谢大家
if holding=0 then begin
if longcond then
buy(1,N1,THISCLOSE);
end
把这样的的都改成
if longcond then begin
buy(holding=0,n1,thisclsoe);
end