[PEL] 复制代码
TRx :=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR :=MA(TRx,20);
B1:ref(HHV(C,10),1),COLORBLUE,LINETHICK2;
B2:ref(LlV(C,10),1),COLORBLUE,LINETHICK2;
A1:ref(HHV(C,20),1),COLORRED,LINETHICK2;
A2:ref(LlV(C,20),1),COLORRED,LINETHICK2;
STICKLINE(C>A1 and holding=0,o,c,10,0,COLORYELLOW);
if C>A1 then buy(holding=0,2,THISCLOSE);
if C<B2 AND C>=A2 then sell(holding>0,holding,THISCLOSE);
if C<B2 AND C<A2 then
begin
sell(holding>0,holding,THISCLOSE);
buyshort(holding=0,2,THISCLOSE);
end
if C<ENTERPRICE-ATR*2 then sell(holding>0,holding,THISCLOSE);
if C>ENTERPRICE+ATR*5 then sell(holding=2,1,THISCLOSE);
if C<A2 then buyshort(holding=0,2,THISCLOSE); ;
if C>B1 AND C<=A1 then sellshort(holding<0,holding,THISCLOSE);
if C>B1 AND C>A1 then
begin
sellshort(holding<0,holding,THISCLOSE);
STICKLINE(C>B1 AND C>A1 and holding=0,o,c,10,0,COLORYELLOW);
buy(holding=0,2,THISCLOSE);
end
if C>ENTERPRICE+ATR*2 then sellshort(holding<0,holding,THISCLOSE);
if C<ENTERPRICE-ATR*5 then sellshort(holding=-2,1,THISCLOSE);
DRAWTEXTEX(1,0,15,3,DYNAINFO(210),COLORBLACK);