C1:=VALUEWHEN(DATE<>REF(DATE,1),REF(C,1));
H1:=VALUEWHEN(DATE<>REF(DATE,1),REF(H,1));
L1:=VALUEWHEN(DATE<>REF(DATE,1),REF(L,1));
CF:=MAX((H1-C1),(C1-L1))*4;
//昨日高點減去收盤 和 昨日收盤減去低點 兩者中大的數(shù)值 乘以3
O1:=VALUEWHEN(DATE<>REF(DATE,1),O);
if C>O1+CF then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
//收盤大于今日開盤+ CF 買入
if C<O1-CF then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end
//收盤低于今日開盤- CF 賣出
HH:=HHV(H,enterbars+1);
//買開倉位置到現(xiàn)在最高價
LL:=LLV(L,exitbars+1);
//賣開倉位置到現(xiàn)在最低價
if TIME>=0930 and C>=LL+L*9/1000 then sellshort(holding<0,holding,market);
//最高階回撤1%止損
if TIME>=0930&&C<=HH-HH*9/1000 then sell(holding>0,holding,market);
//最高階回撤1%止損
if TIME>=1455 then sell(holding>0,holding,market);
if TIME>=1455 then sellshort(holding<0,holding,market);
//TIME>=1456,BP;