input:grid(70,1,600,1); variable:level=0; n: = 10; 保證金比率: = 0.1; SS: = ASSET/n/CLOSE/MULTIPLIER/保證金比率; VARIABLE : oo = 3000; if holding=0 and c >oo then begin??????? //初始化開多dnprice:=oo-grid*mindiff;if low<=dnprice then begin buy(1,SS,limitr,dnprice); level:=-1;end end if holding=0 and c<oo? then begin?????? //初始化開空 upprice:=oo+grid*mindiff;if high>=upprice then begin buyshort(1,SS,limitr,upprice); level:=1;end end if holding>0 and level <n? then begin???? //加多 upprice:=oo+(level+1)*grid*mindiff; dnprice:=oo+(level-1)*grid*mindiff;if high>=upprice then begin sell(1,SS,limitr,upprice); level:=level+1; end if low<=dnprice then begin buy(1,SS,limitr,dnprice); level:=level-1; end endif holding<0 and level <n? then begin???????? //加空 upprice:=oo+(level+1)*grid*mindiff; dnprice:=oo+(level-1)*grid*mindiff;if low<=dnprice then begin sellshort(1,SS,limitr,dnprice); level:=level-1;endif high>=upprice then begin buyshort(1,SS,limitr,upprice); level:=level+1; end endif holding >0 and l <oo then begin????? //多 切換 sell(1,holding,limitr,oo); end if holding <0 and h> oo then begin??? //空? 切換 sellshort(1,holding,limitr,oo); end if holding >0 and h >oo+(n+1)*grid*mindiff then begin??? //多全平 ? oo = oo+(n+1)*grid*mindiff; ?sellshort(1,holding,limitr,close); ?end ?if holding <0 and l >oo-(n+1)*grid*mindiff then begin?? //空全平 ? ?oo = oo-(n+1)*grid*mindiff; ?sell(1,holding,limitr,close); ?end ?