ihzx 发表于 2021-8-22 16:25:49

以下为本人为文华财经行情分析软件写的混沌交易之基本分形公式

<p>以下是以下为本人为文华财经行情分析软件写的混沌交易之基本分形公式(无源码的请下载附件导入)</p>
<div class="con" id="rjsmad1"></div>
<p>TMP:=OPEN-CLOSE;<br>
&nbsp;DRAWLINE(TMP&gt;0.0001,HIGH,TMP&gt;0.0001,OPEN,COLORCYAN);<br>
&nbsp;DRAWLINE(TMP&gt;0.0001,LOW,TMP&gt;0.0001,CLOSE,COLORCYAN);<br>
&nbsp;DRAWLINE(TMP&lt;-0.0001,HIGH,TMP&lt;-0.0001,CLOSE,COLORRED);<br>
&nbsp;DRAWLINE(TMP&lt;-0.0001&lt;CLOSE,LOW,TMP&lt;-0.0001,OPEN,COLORRED);<br>
&nbsp;DRAWLINE(ABS(TMP)&lt;0.0001,LOW,ABS(TMP)&lt;0.0001,OPEN,COLORWHITE);<br>
&nbsp;DRAWLINE(ABS(TMP)&lt;0.0001,HIGH,ABS(TMP)&lt;0.0001,OPEN,COLORWHITE);<br>
&nbsp;STICKLINE(TMP&gt;0,OPEN,CLOSE,COLORCYAN,0);<br>
&nbsp;STICKLINE(TMP&lt;=0,OPEN,CLOSE,COLORRED,1);<br>
&nbsp;VAR1:=HIGH&gt;=REFX(HIGH,1) &amp;&amp; HIGH&gt;=REFX(HIGH,2) &amp;&amp; HIGH=HHV(HIGH,3);<br>
&nbsp;VAR2:=LOW&lt;=REFX(LOW,1) &amp;&amp; LOW&lt;=REFX(LOW,2) &amp;&amp; LOW = LLV(LOW,3);<br>
&nbsp;STICKLINE(VAR1,OPEN,CLOSE,COLORMAGENTA,0);<br>
&nbsp;STICKLINE(VAR2,OPEN,CLOSE,COLORGREEN,0);<br>
&nbsp;STICKLINE(CROSS(HIGH,REF(HIGH,BARSLAST(VAR1))),REF(HIGH,BARSLAST(VAR1)),1.002*REF(HIGH,BARSLAST(VAR1)),COLORWHITE,0);<br>
&nbsp;STICKLINE(CROSS(REF(LOW,BARSLAST(VAR2)),LOW),REF(LOW,BARSLAST(VAR2)),0.998*REF(LOW,BARSLAST(VAR2)),COLORYELLOW,0);<br>
&nbsp;DRAWTEXT(VAR1,1.02*HIGH,'----');<br>
&nbsp;DRAWTEXT(VAR2,1.02*LOW,'----');<br>
&nbsp;DRAWTEXT(CROSS(HIGH,REF(HIGH,BARSLAST(VAR1))),1.004*REF(HIGH,BARSLAST(VAR1)),'涨');<br>
DRAWTEXT(CROSS(REF(LOW,BARSLAST(VAR2)),LOW),1.004*REF(LOW,BARSLAST(VAR2)),'跌');</p>
<p>文华财经用鳄鱼线指标(主图)</p>
<p>var1:=(HIGH+LOW)/2;<br>
&nbsp;Lip:REF(SMA(var1,5,1),3),COLORGREEN;<br>
&nbsp;Tooth:REF(SMA(var1,8,1),5),COLORRED;<br>
&nbsp;Jaw:REF(SMA(var1,13,1),8),COLORBLUE;</p>
<p>//{平衡线}<br>
P1:=REF(HIGH,1)&gt;HIGH AND REF(HIGH,1)&gt;Jaw;<br>
&nbsp;BBUY:REF(REF(HIGH,1),BARSLAST(P1)),COLORWHITE;</p>
<p>STICKLINE(CROSS(HIGH,BBUY) AND LOW&gt;BBUY,(HIGH+LOW)/2,(HIGH+LOW)/2,COLORWHITE,0);<br>
&nbsp;STICKLINE(CROSS(HIGH,BBUY) AND LOW&lt;=BBUY,BBUY,BBUY,COLORWHITE,0);<br>
&nbsp;P2:=REF(LOW,1)&lt;LOW AND REF(LOW,1)&lt;Jaw;<br>
&nbsp;BSELL:REF(REF(LOW,1),BARSLAST(P2)),COLORMAGENTA;</p>
<p><br>
&nbsp;STICKLINE(CROSS(BSELL,LOW) AND HIGH&lt;BSELL,(HIGH+LOW)/2,(HIGH+LOW)/2,COLORMAGENTA,0);<br>
&nbsp;STICKLINE(CROSS(BSELL,LOW) AND HIGH&gt;=BSELL,BSELL,BSELL,COLORMAGENTA,0);</p>
<p>ho:=HIGH&gt;REF(HIGH,1) AND HIGH&gt;REF(HIGH,2) AND HIGH&gt;=REFX(HIGH,1) AND IFELSE(HIGH=REFX(HIGH,2),HIGH&gt;REFX(HIGH,3),HIGH&gt;REFX(HIGH,2));<br>
&nbsp;fxh:=CROSS(ho,0.9);<br>
&nbsp;hh:=REF(HIGH,BARSLAST(fxh));<br>
&nbsp;lo:=LOW&lt;REF(LOW,1) AND LOW&lt;REF(LOW,2) AND LOW&lt;=REFX(LOW,1) AND IFELSE(LOW=REFX(LOW,2),LOW&lt;REFX(LOW,3),LOW&lt;REFX(LOW,2));<br>
&nbsp;fxl:=CROSS(lo,0.9);<br>
&nbsp;ll:=REF(LOW,BARSLAST(fxl));<br>
&nbsp;//DRAWSL(ll,LOW,0,2,0, COLORGREEN);<br>
&nbsp;//DRAWSL(hh,HIGH,0,2,0, COLORRED);<br>
&nbsp;//SFX: hh, POINTDOT,ColorEA91B5;<br>
&nbsp;STICKLINE(CLOSE,hh,hh,COLORRED,0);<br>
&nbsp;//XFX: ll, POINTDOT,Color3791B5;<br>
&nbsp;STICKLINE(CLOSE,ll,ll,COLORYELLOW,0);</p>
<p>Y:=(HIGH+LOW)/2;<br>
&nbsp;//AO:=MA(Var1,5)-MA(Var1,34);<br>
&nbsp;AC:=MA(Y,5)-MA(Y,34)-MA(MA(Y,5)-MA(Y,34),5);<br>
&nbsp;ac1:=REF(AC,1);<br>
&nbsp;//{STICKLINE(AC&gt;ac1,20,ac+20,8,0),colorRED;}<br>
&nbsp;//{STICKLINE(AC&lt;ac1,20,ac+20,8,0),colorgreen;}<br>
&nbsp;Var1:=(HIGH+LOW)/2;<br>
&nbsp;AO:=MA(Var1,5)-MA(Var1,35);</p>
<p>ao1:=REF(AO,1);<br>
&nbsp;//{STICKLINE(Ao&gt;ao1,0,ao,8,0),colorRED;}<br>
&nbsp;//{STICKLINE(Ao&lt;ao1,0,ao,8,0),colorgreen;}</p>
<p>STICKLINE(AC&gt;ac1 AND AO&gt;ao1,HIGH,LOW,COLORRED,0);<br>
&nbsp;m:=IFELSE(CLOSE&gt;OPEN,0,1);<br>
&nbsp;STICKLINE(AC&gt;ac1 AND AO&gt;ao1 AND CLOSE&lt;OPEN,CLOSE,OPEN,colorred,1);<br>
&nbsp;STICKLINE(AC&gt;ac1 AND AO&gt;ao1 AND CLOSE&gt;OPEN,CLOSE,OPEN,colorred,0);<br>
&nbsp;STICKLINE(AC&gt;ac1 AND AO&lt;ao1 OR AC&lt;ac1 AND AO&gt;ao1,HIGH,LOW,COLORLIGHTGREY,0);<br>
&nbsp;STICKLINE((AC&gt;ac1 AND AO&lt;ao1 OR AC&lt;ac1 AND AO&gt;ao1) AND CLOSE&gt;OPEN,CLOSE,OPEN,COLORLIGHTGREY,0);<br>
&nbsp;STICKLINE((AC&gt;ac1 AND AO&lt;ao1 OR AC&lt;ac1 AND AO&gt;ao1) AND CLOSE&lt;OPEN,CLOSE,OPEN,COLORLIGHTGREY,1);<br>
&nbsp;STICKLINE(AC&lt;ac1 AND AO&lt;ao1,HIGH,LOW,COLORGREEN,0);<br>
&nbsp;STICKLINE(AC&lt;ac1 AND AO&lt;ao1 AND CLOSE&gt;OPEN,CLOSE,OPEN,COLORGREEN,0);<br>
&nbsp;STICKLINE(AC&lt;ac1 AND AO&lt;ao1 AND CLOSE&lt;OPEN,CLOSE,OPEN,COLORGREEN,1);</p>
<p>R1:=REF(SMA(Y,8,1),5);<br>
&nbsp;R2:=IFELSE(C&lt;R1,0,R1);<br>
&nbsp;R3:=IFELSE(C&gt;R1,0,R1);</p>
<p>//{========AO及AC方向========}<br>
DRAWTEXT(ISLASTBAR AND AO&gt;REF(AO,1) AND AC&gt;REF(AC,1),1.0004*R1,'&uarr;&uarr;');<br>
&nbsp;DRAWTEXT(ISLASTBAR AND AO&lt;REF(AO,1) AND AC&lt;REF(AC,1),1.0004*R1,'&darr;&darr;');<br>
&nbsp;DRAWTEXT(ISLASTBAR AND AO&gt;REF(AO,1) AND AC&lt;REF(AC,1),1.0004*R1,'&uarr;&darr;');<br>
&nbsp;DRAWTEXT(ISLASTBAR AND AO&lt;REF(AO,1) AND AC&gt;REF(AC,1),1.0004*R1,'&darr;&uarr;');</p>
<p>文华财经用AC指标(副图)</p>
<p>//{ Chaos Accelerator/Decelerator Oscillator }<br>
&nbsp;//{ Measures acceleration -AC}<br>
&nbsp;//{ Plot AS histogram }<br>
&nbsp;Y:=(HIGH+LOW)/2;<br>
&nbsp;AC:=MA(Y,5)-MA(Y,34)-MA(MA(Y,5)-MA(Y,34),5);<br>
&nbsp;//{Put in the same window AND plot green}<br>
&nbsp;ACGreen:IFELSE(AC&gt;REF( AC,1) ,AC,0 ),COLORRED;<br>
&nbsp;STICKLINE(AC&lt;REF(AC,1),0,AC,COLORGREEN,1);<br>
&nbsp;//{Put in its on window AS a histogram AND plot red}<br>
&nbsp;ACRed:IFELSE(AC&lt;REF( AC,1) ,AC,0 ),COLORGREEN;<br>
&nbsp;STICKLINE(AC&gt;REF(AC,1),0,AC,COLORRED,1);<br>
&nbsp;ac1:=REF(AC,1);<br>
&nbsp;buy1:=REF(AC,3)&lt;REF(ac1,3) AND REF(AC,2)&lt;REF(ac1,2) AND REF(AC,2)&lt;REF(AC,3) AND REF(AC,1)&gt;REF(ac1,1) AND AC&gt;ac1 AND COUNT(AC&gt;0,4)=4;// {REF(AC,3)&gt;0 AND REF(AC,1)&gt;0 AND REF(AC,2)&gt;0 AND AC&gt;0};<br>
&nbsp;//DRAWICON(buy1,AC,4);<br>
&nbsp;DRAWTEXT(buy1,AC, 'B'),COLORWHITE;<br>
&nbsp;buy2:=COUNT(AC&lt;0,4)=4 AND REF(AC,3)&lt;REF(ac1,3) AND COUNT(AC&gt;ac1,3)=3;<br>
&nbsp;//DRAWICON(buy2,AC,4);<br>
&nbsp;DRAWTEXT(buy2,AC, 'B'),COLORWHITE;<br>
&nbsp;buy3:=REF(AC,3)&lt;REF(ac1,3) AND REF(AC,2)&lt;REF(ac1,2) AND REF(AC,2)&lt;REF(AC,3) AND COUNT(AC&gt;ac1,2)=2 AND REF(AC,1)&lt;0 AND AC&gt;0;<br>
&nbsp;//DRAWICON(buy3,AC,4);<br>
&nbsp;DRAWTEXT(buy3,AC, 'B'),COLORWHITE;<br>
&nbsp;buy4:=REF(AC,4)&lt;REF(ac1,4) AND REF(AC,3)&lt;REF(ac1,3) AND REF(AC,3)&lt;REF(AC,4) AND COUNT(AC&gt;ac1,3)=3 AND REF(AC,1)&lt;0 AND AC&gt;0;<br>
&nbsp;//DRAWICON(buy4,AC,4) ALIGN0;<br>
&nbsp;DRAWTEXT(buy4,AC, 'B'),COLORWHITE;</p>
<p><br>
&nbsp;s1:=REF(AC,3)&gt;REF(ac1,3) AND REF(AC,2)&gt;REF(ac1,2) AND REF(AC,2)&gt;REF(AC,3) AND REF(AC,1)&lt;REF(ac1,1) AND AC&lt;ac1 AND COUNT(AC&lt;0,4)=4;// {REF(AC,3)&lt;0 AND REF(AC,1)&lt;0 AND REF(AC,2)&lt;0 AND AC&lt;0};<br>
&nbsp;//DRAWICON(s1,AC,5);<br>
&nbsp;DRAWTEXT(s1,AC, 'S'),COLORWHITE;</p>
<p>s2:=COUNT(AC&gt;0,4)=4 AND REF(AC,3)&gt;REF(ac1,3) AND COUNT(AC&lt;ac1,3)=3;<br>
&nbsp;//DRAWICON(s2,AC,5);<br>
&nbsp;DRAWTEXT(s2,AC, 'S'),COLORWHITE;</p>
<p>s3:=REF(AC,3)&gt;REF(ac1,3) AND REF(AC,2)&gt;REF(ac1,2) AND REF(AC,2)&gt;REF(AC,3) AND COUNT(AC&lt;ac1,2)=2 AND REF(AC,1)&gt;0 AND AC&lt;0;<br>
&nbsp;//DRAWICON(s3,AC,5);<br>
&nbsp;DRAWTEXT(s3,AC, 'S'),COLORWHITE;<br>
&nbsp;s4:=REF(AC,4)&gt;REF(ac1,4) AND REF(AC,3)&gt;REF(ac1,3) AND REF(AC,3)&gt;REF(AC,4) AND COUNT(AC&lt;ac1,3)=3 AND REF(AC,1)&gt;0 AND AC&lt;0;<br>
&nbsp;//DRAWICON(s4,AC,5) ALIGN0;<br>
&nbsp;DRAWTEXT(s4,AC, 'S'),COLORWHITE;</p>
<p>文华财经用AO指标(副图)</p>
<p>Y:=(HIGH+LOW)/2;<br>
&nbsp;AO:=MA(Y,5)-MA(Y,34);<br>
&nbsp;AOGreen:IFELSE(AO&gt;REF(AO,1),AO,0),COLORRED;<br>
&nbsp;STICKLINE(AO&gt;=REF(AO,1),0,AO,COLORRED,1);<br>
&nbsp;AORed:IFELSE(AO&lt;REF( AO,1),AO,0),COLORGREEN;<br>
&nbsp;STICKLINE(AO&lt;REF(AO,1),0,AO,COLORGREEN,1);<br>
&nbsp;SignalLine:MA(AO,5),COLORBLUE;<br>
&nbsp;s1:=CROSS(0,AO);<br>
&nbsp;//DRAWICON(s1,AO,5),ALIGN0; //文华此函数绘图不佳<br>
DRAWTEXT(s1,AO,'S'),COLORWHITE;<br>
&nbsp;//----------------------------以上是下穿0信号;<br>
s2:=AO&lt;0 AND REF(AO,1)&gt;REF(AO,2) AND AO&lt;REF(AO,1);<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao,lu2,0);<br>
&nbsp;//DRAWICON(s2,AO,5),ALIGN0;<br>
&nbsp;DRAWTEXT(s2,AO,'S'),COLORWHITE;<br>
&nbsp;//-----------------------------以上碟型卖出信号;</p>
<p>scount:=BARSLAST(AO&lt;0);//上一次ao&gt;0后到现在的周期数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao-0.1,scount,0);<br>
&nbsp;sd:=HHV(AO,scount);//求上面周期的最大ao;<br>
&nbsp;scountd:=HHVBARS(AO,scount);//求最大值到现在的周期数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao-0.3,scountd,0);<br>
&nbsp;s3:=AO&gt;0 AND REF(AO,1)&gt;REF(AO,2) AND AO&lt;REF(AO,1);//满足峰的条件;<br>
s31:=COUNT(s3,scountd);//满足上面条件的次数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao-0.5,s31,0);<br>
&nbsp;//DRAWICON(s31&gt;=2 AND s3,AO,5),ALIGN0;<br>
&nbsp;DRAWTEXT(s31&gt;=2 AND s3,AO,'S'),COLORWHITE;</p>
<p>//----------------------------以上是双峰卖出信号;<br>
b1:=CROSS(AO,0);<br>
&nbsp;//DRAWICON(b1,AO,4),ALIGN0;<br>
&nbsp;DRAWTEXT(b1,AO,'B'),COLORWHITE;<br>
&nbsp;//----------------------------以上是上穿0信号;<br>
b2:=AO&gt;0 AND REF(AO,1)&lt;REF(AO,2) AND AO&gt;REF(AO,1) ;<br>
&nbsp;//DRAWNUMBER(1&gt;0,AO,lu2,0);<br>
&nbsp;//DRAWICON(b2,AO,4),ALIGN0;<br>
&nbsp;DRAWTEXT(b2,AO,'B'),COLORWHITE;<br>
&nbsp;//-----------------------------以上碟型买入信号;<br>
bcount:=BARSLAST(AO&gt;0);//上一次ao&gt;0后到现在的周期数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao-0.1,bcount,0);<br>
&nbsp;bd:=LLV(AO,bcount);//求上面周期的最小ao;<br>
&nbsp;bcountd:=LLVBARS(AO,bcount);//求最小值到现在的周期数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,AO-0.3,bcountd,0);<br>
&nbsp;b3:=AO&lt;0 AND REF(AO,1)&lt;REF(AO,2) AND AO&gt;REF(AO,1);//满足峰的条件;<br>
b31:=COUNT(b3,bcountd);//满足上面条件的次数;<br>
&nbsp;//DRAWNUMBER(1&gt;0,ao-0.5,lu31,0);<br>
&nbsp;//DRAWICON(b31&gt;=2 AND b3,AO,4),ALIGN0;<br>
&nbsp;DRAWTEXT(b31&gt;=2 AND b3,AO,'B'),COLORWHITE;<br>
&nbsp;//----------------------------以上是双峰买进信号;</p>
<p>&nbsp;</p>
页: [1]
查看完整版本: 以下为本人为文华财经行情分析软件写的混沌交易之基本分形公式