[PEL] 复制代码
sj:=1;
var2q:=ema(close,60)*sj;
var3:=(close*sj-var2q*sj)*2/(60+1)+var2q;
生命线:var3*sj,linethick2, coloryellow;
ma3:=ma(c,170);
hh1:=if(h<ref(h,1)&&ref(h,1)<ref(h,2),ref(h,2),0);
ll1:=if(l>ref(l,1)&&ref(l,1)>ref(l,2),ref(l,2),0);
hh2:=valuewhen(hh1>0,hh1);
ll2:=valuewhen(ll1>0,ll1);
hh:hhv(high,1)/10*sj+hhv(high,2)/10+hhv(high,2)/10+hhv(high,4)/10+hhv(high,4)/10+hhv(high,8)/10+hhv(high,8)/10+hhv(high,13)/10+hhv(high,40)/10+hhv(high,20)/10;
ll:llv(low,1)/10*sj+llv(low,2)/10+llv(low,2)/10+llv(low,4)/10+llv(low,4)/10+llv(low,8)/10+llv(low,8)/10+llv(low,13)/10+llv(low,40)/10+llv(low,20)/10;
h1:=if(hh<ref(hh,1)&&ll<ref(ll,1)&&ref(open,1)>close&&open>close&&(hhv(open,0)-close)>0,ref(hh,2),0);
l1:=if(ll>ref(ll,1)&&hh>ref(hh,1)&&ref(open,1)<close&&open<close&&(close-llv(open,0))>0,ref(ll,2),0);
x:=date;
x0:=h1,linethick2;
x00:=l1;
xxx0:=o,linethick2;
xxx00:=c;
xxx000:=h;
xxx0000:=l;
h2:=valuewhen(x0>0,x0),linethick2;
l2:=valuewhen(x00>0,x00),linethick2;
k1:=if(close>h2,-3,if(close<l2,1,0));
k2:=valuewhen(k1<>0,k1);
g:=if(k2=1,h2,l2);
g1:=valuewhen(islastbar,g);
x000:=k2,linethick2;
tmp:=k2,linethick2;
w1:=x000,linethick2;
x0000:=open-close,linethick2;
w2:=x0000,linethick2;
ht:=if(open>close,open,close),linethick2;
lt:=if(open<close,open,close),linethick2;
drawtext(cross(tmp,0),hh,'空'),colorgreen;
drawtext(cross(0,tmp),ll,'多');
//反手按照市价处理,可自行调整为限价指令,并指定价格
if ref(cross(0,tmp),1) then
begin
sellshort(1,holding,market);
buy(holding=0,1,market);
end
if ref(cross(tmp,0),1) then
begin
sell(1,holding,market);
buyshort(holding=0,1,market);
end
if c<=enterprice*0.999&&holding>0 then sell(1,holding,market);
if c>=enterprice*1.001&&holding<0 then sellshort(1,holding,market);
bkhigh:=hhv(h,enterbars+1);
sklow:=llv(l,enterbars+1);
if bkhigh>=enterprice*(1+0.05/100)&&c<=bkhigh-(bkhigh-enterprice)*(1-0.05/100)&&holding>0 then sell(1,holding,market);
if sklow<=enterprice*(1-0.05*100)&&c>=sklow+(enterprice-sklow)*(1-0.05/100)&&holding<0 then sellshort(1,holding,market);