[PEL] 复制代码 K1:=0.8;
K2:=0.7;
N:=2;
DN:=TODAYBAR;
CCH:=IF(time=CLOSETIME(0),CLOSE,0);
CCL:=IF(time=CLOSETIME(0),CLOSE,10000);
RO:=VALUEWHEN(DN=1,OPEN);
HH:=REF(HHV(HIGH,SUMBARS(DN=1,N)),DN);
HC:=REF(HHV(CCH,SUMBARS(DN=1,N)),DN);
LL:=REF(LLV(LOW,SUMBARS(DN=1,N)),DN);
LC:=REF(LLV(CCl,SUMBARS(DN=1,N)),DN);
RANGE1:=MAX(HH-LC,HC-LL);
BUYLINE:RO+K1*RANGE1;
SELLLINE:RO-K2*RANGE1;
if CROSS(CLOSE,BUYLINE) then
begin
sellshort(1,holding,market);
buy(holding=0,1,market);
end
if CROSS(SELLLINE,c) then
begin
sell(1,holding,market);
buyshort(holding=0,1,market);
end
if CROSS(RO,c ) then sell(1,holding,market);
if CROSS(CLOSE,RO) then sellshort(1,holding,market);
if time<=185700 then
begin
收盘平多:sell(1,holding,market);
收盘平空:sellshort(1,holding,market);
end
仅供参考 |