缠论画笔源码,通达信主图公式
<p data-track="1">消息里一直有朋友在问是否可以分享缠论画笔的源码。现分享出来,并且在里面加入了时间周期和换手率。但是缠论博大精深,目前市场上也没有能精确表达的源码,此源码缺点明显,仅供缠论爱好者研究。</p><p class="pgc-img-caption">缠论画笔源码</p><p data-track="4">N:=5,100,10;</p><p data-track="5">振幅:=0,1,1;</p><p data-track="6">统计:=0,1,1;</p><p data-track="7">局部低点预选A:=BACKSET(LLV(L,10*N)<REF(LLV(L,10*N-1),1),10*N-1);</p><p data-track="8">局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);</p><p data-track="9">局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);</p><p data-track="10">局部高点预选A:=BACKSET(HHV(H,10*N)>REF(HHV(H,10*N-1),1),10*N-1);</p><p data-track="11">局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);</p><p data-track="12">局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0);</p><p data-track="13">缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));</p><p data-track="14">距前高天:=BARSLAST(局部高点预选C=1);</p><p data-track="15">距前低天:=BARSLAST(局部低点预选C=-1);</p><p data-track="16">小值周期:=LOWRANGE(L);</p><p data-track="17">大值周期:=TOPRANGE(H);</p><p data-track="18">低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);</p><p data-track="19">低保留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);</p><p data-track="20">低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0);</p><p data-track="21">预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);</p><p data-track="22">判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0);</p><p data-track="23">高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);</p><p data-track="24">高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0);</p><p data-track="25">高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0);</p><p data-track="26">预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);</p><p data-track="27">判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0);</p><p data-track="28">低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);</p><p data-track="29">低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);</p><p data-track="30">低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0);</p><p data-track="31">距前高天A:=BARSLAST(高保留=1);</p><p data-track="32">距前低天A:=BARSLAST(低保留=-1);</p><p data-track="33">预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);</p><p data-track="34">判断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);</p><p data-track="35">高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);</p><p data-track="36">高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0);</p><p data-track="37">高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0);</p><p data-track="38">预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);</p><p data-track="39">判断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);</p><p data-track="40">低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);</p><p data-track="41">低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0);</p><p data-track="42">低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0);</p><p data-track="43">距前高天YA:=BARSLAST(高保留X=1);</p><p data-track="44">距前低天YA:=BARSLAST(低保留X=-1);</p><p data-track="45">预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);</p><p data-track="46">判断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);</p><p data-track="47">高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);</p><p data-track="48">高保留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);</p><p data-track="49">高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H>REF(L,距前低天YA+1),1,0);</p><p data-track="50">预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0);</p><p data-track="51">判断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);</p><p data-track="52">低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);</p><p data-track="53">低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0);</p><p data-track="54">低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0);</p><p data-track="55">AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0));</p><p data-track="56">极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);</p><p data-track="57">极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)),CIRCLEDOT,COLORLIMAGENTA;</p><p data-track="58">顶周期:=N*10;</p><p data-track="59">底周期:=N*10;</p><p data-track="60">上内:=LLVBARS(H,顶周期);</p><p data-track="61">上外:=LLVBARS(L,顶周期);</p><p data-track="62">下内:=HHVBARS(L,底周期);</p><p data-track="63">下外:=HHVBARS(H,底周期);</p><p data-track="64">上力度:=HHV(L,上内+1)>LLV(H,上内+1);</p><p data-track="65">下力度:=HHV(L,下内+1)>LLV(H,下内+1);</p><p data-track="66">上包含:=COUNT(L>=REF(L,1),上外)>2 AND COUNT(H>=REF(H,1),上内)>2;</p><p data-track="67">下包含:=COUNT(H<=REF(H,1),下外)>2 AND COUNT(L<=REF(L,1),下内)>2; </p><p data-track="68">顶A:=顶周期 AND 上力度 AND 上包含 AND 上外>3;</p><p data-track="69">底B:=底周期 AND 下力度 AND 下包含 AND 下外>3;</p><p data-track="70">顶:=顶A AND H=HHV(H,BARSLAST(底B))AND BARSLAST(底B)>3;</p><p data-track="71">底:=底B AND L=LLV(L,BARSLAST(顶A))AND BARSLAST(顶A)>3;</p><p data-track="72">C1:=DRAWLINE(顶,H,底,L,0);</p><p data-track="73">C2:=DRAWLINE(底,L,顶,H,0);</p><p data-track="74">GD:=C2=C1 AND 顶;</p><p data-track="75">DD:=C2=C1 AND 底;</p><p data-track="76">CC:=DD OR GD;</p><p data-track="77">变点:IF(DD=1,L,IF(GD=1,H,DRAWNULL)),CIRCLEDOT,COLORYELLOW;</p><p data-track="78">交易周期:BARSLAST(CC)+1,NODRAW;</p><p data-track="79">区间成交额:SUM(AMO.AMOW/10000,交易周期),NODRAW;{亿}</p><p data-track="80">区间换手:IF(CC=0,SUM(HSL.HSL,交易周期),0),COLORRED,NODRAW;{%}</p><p data-track="81">区间涨幅:C/REF(C,交易周期)*100-100,NODRAW,COLORWHITE;{%}</p><p data-track="82">高点换手:=VARCAT(VARCAT('换',VAR2STR(SUM(HSL.HSL,BARSLAST(GD)+1),2)),'%');</p><p data-track="83">低点换手:=VARCAT(VARCAT('换',VAR2STR(SUM(HSL.HSL,BARSLAST(DD)+1),2)),'%');</p><p data-track="84">区间振幅:IF(GD>0,-(REF(H,BARSLAST(GD))/L*100-100),H/REF(L,BARSLAST(DD))*100-100),COLORYELLOW,NODRAW;</p><p data-track="85">高跌幅A:=IF(振幅=1,-(REF(H,BARSLAST(GD))/L*100-100),C/REF(C,BARSLAST(GD)+1)*100-100);</p><p data-track="86">低涨幅A:=IF(振幅=1,H/REF(L,BARSLAST(DD))*100-100,C/REF(C,BARSLAST(DD)+1)*100-100);</p><p data-track="87">高跌幅:=IF(振幅=1,VARCAT(VARCAT('振',VAR2STR(高跌幅A,2)),'%'),VARCAT(VARCAT('幅',VAR2STR(高跌幅A,2)),'%'));</p><p data-track="88">低涨幅:=IF(振幅=1,VARCAT(VARCAT('振',VAR2STR(低涨幅A,2)),'%'),VARCAT(VARCAT('幅',VAR2STR(低涨幅A,2)),'%'));</p><p data-track="89">高点时间:=VARCAT(VARCAT('交易',VAR2STR(BARSLAST(GD)+1,0)),'天');</p><p data-track="90">低点时间:=VARCAT(VARCAT('交易',VAR2STR(BARSLAST(DD)+1,0)),'天');</p><p data-track="91">星期:=VARCAT(VARCAT('(',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五','')))))),')'); </p><p data-track="92">日期:=VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VARCAT(VAR2STR(YEAR,0),'年'),VAR2STR(MONTH,0)),'月'),VAR2STR(DAY,0)),'日'),星期);</p><p data-track="93">价格:=VARCAT(VAR2STR(极点,2),'元');</p><p data-track="94">日期价格:=VARCAT(日期,价格);</p><p data-track="95">高点显示:=VARCAT(VARCAT(低点时间,低涨幅),低点换手);</p><p data-track="96">低点显示:=VARCAT(VARCAT(高点时间,高跌幅),高点换手);</p><p data-track="97">ST:=NAMELIKE('ST')=1 OR NAMELIKE('*ST')=1 OR NAMELIKE('SST')=1 OR NAMELIKE('S*ST')=1 OR NAMELIKE('S ST')=1;</p><p data-track="98">明涨停:IF(ST=1,ZTPRICE(C,0.05),ZTPRICE(C,0.1)),COLORRED,NODRAW;</p><p data-track="99">明跌停:IF(ST=1,DTPRICE(C,0.05),DTPRICE(C,0.1)),COLORGREEN,NODRAW;</p><p data-track="100">DRAWBAND(C1,RGB(0,0,0),C1,RGB(0,0,0)),COLORGREEN,DOTLINE;</p><p data-track="101">DRAWBAND(C2,RGB(0,0,0),C2,RGB(0,0,0)),COLORRED,DOTLINE;</p><p data-track="102">DRAWTEXT(GD=1 AND 统计=1 ,H,高点显示),DRAWABOVE,COLORRED;</p><p data-track="103">DRAWTEXT(DD=1 AND 统计=1 ,L,低点显示),DRAWABOVE,COLORGREEN;</p><p data-track="104">DRAWTEXT(GD=1 AND 统计=1 ,H*0.93,日期价格),DRAWABOVE;</p><p data-track="105">DRAWTEXT(DD=1 AND 统计=1 ,L,日期价格);</p> 很好的东东 感谢感谢 支持一下:lol 楼主哪儿来的这么多好东西! 有道理。。。 多谢分享下载收藏了
页:
[1]