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;
//昨日高點減去收盤 和 昨日收盤減去低點 兩者中大的數值 乘以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);
//買開倉位置到現在最高價
LL:=LLV(L,exitbars+1);
//賣開倉位置到現在最低價
if TIME>=0930 and C>=LL+L*9/1000 then SELLSHORT(holding<0,holding,market);
//最高階回撤1%止損
if TIME>=0930 and C<=HH-HH*9/1000 then sell(holding>0,holding,market);
//最高階回撤1%止損
if TIME>=1500 then sell(holding>0,holding,market);
if TIME>=1500 then SELLSHORT(holding<0,holding,market);