原文地址:通达信公式--{通达信和缠论}作者: 通达信公式--{通达信和缠论} y:=(h+o+l+3*c)6; x:=ema(100-(100(1+sum(if(yref(y,1),y*vol,0),14)sum(if(yref(y,1),y*vol,0),14,5),color00ffff; tj:=drawline(x=hhv(x,5),x,x=llv(x,5),x,1); tj1:=x=tj; tj2:=xref(x,1); drawtext(tj1 and tj2,l, ←ok ),color33ffcc; 局部低点预选a:=backset(llv(l,5)ref(llv(l,4),1),4);局部低点预选b:=backset(局部低点预选a=0 and ref(局部低点预选a,1)=1,2);局部低点预选c:=if(局部低点预选b=1 and ref(局部低点预选b,1)=0,-1,0);局部高点预选a:=backset(hhv(h,5)ref(hhv(h,4),1),4);局部高点预选b:=backset(局部高点预选a=0 and ref(局部高点预选a,1)=1,2);局部高点预选c:=if(局部高点预选b=1 and ref(局部高点预选b,1)=0,1,0);缺口判断:=if(lref(h,1),1,if(href(l,1),-1,0));距前高天:=barslast(局部高点预选c=1);距前低天:=barslast(局部低点预选c=-1);小值周期:=lowrange(l);大值周期:=toprange(h);低保留aa:=if(局部低点预选c=-1 and ref(距前高天,1)ref(距前低天,1) and llv(l,距前高天+1)ref(llv(l,距前高天+1),1),-1,0);低保留ab:=if(局部低点预选c=-1 and ref(距前高天,1)=ref(距前低天,1) and (距前高天=4 or llv(缺口判断,距前高天)=-1 or llv(l,距前低天+2)ref(llv(l,距前低天+1),1)),-1,0);低保留s:=if((低保留aa=-1 or 低保留ab=-1) and lref(h,距前高天+1),-1,0);预判:=if((距前低天4 and hhv(缺口判断,距前低天)!=1) or ref(低保留s,距前低天)=0,1,0);判断:=if(局部高点预选c=1 and ref(距前低天,1)=ref(距前高天,1) and 预判=1 and 大值周期ref(小值周期,距前低天+1) and 大值周期ref(小值周期,距前低天) and 大值周期ref(大值周期,距前高天),1,0);高保留a:=if(局部高点预选c=1 and ref(距前低天,1)ref(距前高天,1) and hhv(h,距前低天+1)ref(hhv(h,距前低天+1),1),1,0);高保留b:=if(局部高点预选c=1 and ref(距前低天,1)=ref(距前高天,1) and ref(低保留s,距前低天)=-1 and (距前低天=4 or hhv(缺口判断,距前低天)=1),1,0);高保留:=if((高保留a=1 or 高保留b=1 or 判断=1) and href(l,距前低天+1),1,0);预判a:=if((距前高天4 and hhv(缺口判断,距前高天)!=1) or ref(高保留,距前高天)=0,1,0);判断a:=if(局部低点预选c=-1 and ref(距前高天,1)=ref(距前低天,1) and 预判a=1 and 小值周期ref(大值周期,距前高天+1) and 小值周期ref(大值周期,距前高天) and 小值周期ref(小值周期,距前低天),-1,0); 低保留a:=if(局部低点预选c=-1 and ref(距前高天,1)ref(距前低天,1) and llv(l,距前高天+1)ref(llv(l,距前高天+1),1),-1,0);低保留b:=if(局部低点预选c=-1 and ref(距前高天,1)=ref(距前低天,1) and (距前高天=4 or llv(缺口判断,距前高天)=-1 or 判断a=-1),-1,0);低保留:=if((低保留a=-1 or 低保留b=-1) and lref(h,距前高天+1),-1,0);距前高天a:=barslast(高保留=1);距前低天a:=barslast(低保留=-1); 预判x:=if((距前低天a4 and hhv(缺口判断,距前低天a)!=1) or ref(低保留,距前低天a)=0,1,0);判断x:=if(局部高点预选c=1 and ref(距前低天a,1)=ref(距前高天a,1) and 预判x=1 and 大值周期ref(小值周期,距前低天a+1) and 大值周期ref(小值周期,距前低天a) and 大值周期ref(大值周期,距前高天a),1,0);高保留xa:=if(局部高点预选c=1 and ref(距前低天a,1)ref(距前高天a,1) and hhv(h,距前低天a+1)ref(hhv(h,距前低天a+1),1),1,0);高保留xb:=if(局部高点预选c=1 and ref(距前低天a,1)=ref(距前高天a,1) and ref(低保留,距前低天a)=-1 and (距前低天a=4 or hhv(缺口判断,距前低天a)=1),1,0);高保留x:=if((高保留xa=1 or 高保留xb=1 or 判断x=1) and href(l,距前低天a+1),1,0);预判xa:=if((距前高天a4 and hhv(缺口判断,距前高天a)!=1) or ref(高保留xa,距前高天a)=0,1,0);判断xa:=if(局部低点预选c=-1 and ref(距前高天a,1)=ref(距前低天a,1) and 预判xa=1 and 小值周期ref(大值周期,距前高天a+1) and 小值周期ref(大值周期,距前高天a) and 小值周期ref(小值周期,距前低天a),-1,0); 低保留xa:=if(局部低点预选c=-1 and ref(距前高天a,1)ref(距前低天a,1) and llv(l,距前高天a+1)ref(llv(l,距前高天a+1),1),-1,0);低保留xb:=if(局部低点预选c=-1 and ref(距前高天a,1)=ref(距前低天a,1) and (距前高天a=4 or llv(缺口判断,距前高天a)=-1 or 判断xa=-1),-1,0);低保留x:=if((低保留xa=-1 or 低保留xb=-1) and lref(h,距前高天a+1),-1,0);距前高天ya:=barslast(高保留x=1);距前低天ya:=barslast(低保留x=-1); 预判yx:=if((距前低天ya4 and hhv(缺口判断,距前低天ya)!=1) or ref(低保留x,距前低天ya)=0,1,0);判断yx:=if(局部高点预选c=1 and ref(距前低天ya,1)=ref(距前高天ya,1) and 预判yx=1 and 大值周期ref(小值周期,距前低天ya+1) and 大值周期ref(小值周期,距前低天ya) and 大值周期ref(大值周期,距前高天ya),1,0);高保留yxa:=if(局部高点预选c=1 and ref(距前低天ya,1)ref(距前高天ya,1) and hhv(h,距前低天ya+1)ref(hhv(h,距前低天ya+1),1),1,0);高保留yxb:=if(局部高点预选c=1 and ref(距前低天ya,1)=ref(距前高天ya,1) and ref(低保留x,距前低天ya)=-1 and (距前低天ya=4 or hhv(缺口判断,距前低天ya)=1),1,0);高保留yx:=if((高保留yxa=1 or 高保留yxb=1 or 判断yx=1) and href(l,距前低天ya+1),1,0);预判yxa:=if((距前高天ya4 and hhv(缺口判断,距前高天ya)!=1) or ref(高保留yxa,距前高天ya)=0,1,0);判断yxa:=if(局部低点预选c=-1 and ref(距前高天ya,1)=ref(距前低天ya,1) and 预判yxa=1 and 小值周期ref(大值周期,距前高天ya+1) and 小值周期ref(大值周期,距前高天ya) and 小值周期ref(小值周期,距前低天ya),-1,0); 低保留yxa:=if(局部低点预选c=-1 and ref(距前高天ya,1)ref(距前低天ya,1) and llv(l,距前高天ya+1)ref(llv(l,距前高天ya+1),1),-1,0);低保留yxb:=if(局部低点预选c=-1 and ref(距前高天ya,1)=ref(距前低天ya,1) and (距前高天ya=4 or llv(缺口判断,距前高天ya)=-1 or 判断yxa=-1),-1,0);低保留yx:=if((低保留yxa=-1 or 低保留yxb=-1) and lref(h,距前高天ya+1),-1,0); aaad:=if(高保留yx=1 and 低保留yx=-1 and href(h,ref(距前高天ya,1)+2),1,if(高保留yx=1 and 低保留yx=-1 and lref(l,ref(距前低天ya,1)+2),-1,0));极点保留:=if(aaad=0,高保留yx+低保留yx,aaad); 局部极点:if(极点保留=-1,l,if(极点保留=1,h,drawnull)) circledot coloryellow; drawline(极点保留=-1,局部极点,极点保留=1,局部极点,0)colorblue; drawline(极点保留=1,局部极点,极点保留=-1,局部极点,0)colorblue; drawicon(极点保留=-1,l-0.03,1); drawicon(极点保留=1,h+0.03,2);