第一个问题您可以参考以下内容,但这个思路有点问题,你开单条件和上次开单价格有关,但是上次开的单依旧是根据上上次来的话,有点死循环了。
variable:dprice=0,kprice=0;
if c<dprice then begin
sell(1,1,market);
goto skip@;
end
if c>kprice then begin
sellshort(1,1,market);
end
if c>kprice then begin
buy(1,1,market);
dprice:=c;
end
skip@;
if c<dprice then begin
buyshort(1,1,market);
kprice:=c;
end