ihzx 发表于 2021-8-21 12:50:57

飞狐macd顶底背离组合指标公式

<p>DRAWGBK(CLOSE&gt;0, COLORRGB(1,0,0), COLORRGB(1,0,0),2);<br />
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26),LINETHICK;<br />
DEA:EMA(DIFF,9),Color39FD96,LINETHICK1;<br />
FILLRGN(DIFF&gt;DEA,DIFF,DEA),Color39FD96;<br />
MACD:=2*(DIFF-DEA), COLORSTICK,LINETHICK1;<br />
s:=MACD;<br />
s1:=s&lt;ref(s,1) and s&gt;0;<br />
s2:=s&lt;ref(s,1) and s&lt;0;<br />
STICKLINE(s&gt;=0,0,s,2,1),COLORRED,LINETHICK1;<br />
STICKLINE(s1,0,s,2,1),Color677937,LINETHICK1;<br />
STICKLINE(s2,0,s,2,1),Color964E27,LINETHICK1;<br />
HD := HIGH-REF(HIGH,1);<br />
LD := REF(LOW,1)-LOW;<br />
PDM:= SUM(IF(HD&gt;0 AND HD&gt;LD,HD,0),14);<br />
MDM:= SUM(IF(LD&gt;0 AND LD&gt;HD,LD,0),14);<br />
PDI:= PDM*100/TR;<br />
MDI:= MDM*100/TR;<br />
A1:=BARSLAST(ref(cross(&quot;macd.diff&quot;(12,26,9),&quot;macd.dea&quot;(12,26,9)),1));<br />
B1:=ref(c,A1+1)&gt;c and ref(&quot;macd.diff&quot;(12,26,9),A1+1)&lt;&quot;macd.diff&quot;(12,26,9) and cross(&quot;macd.diff&quot;(12,26,9),&quot;macd.dea&quot;(12,26,9));<br />
A2:=BARSLAST(ref(cross(&quot;kdj.k&quot;(9,3,3),&quot;kdj.d&quot;(9,3,3)),1));<br />
B2:=ref(c,A2+1)&gt;c and ref(&quot;kdj.k&quot;(9,3,3),A2+1)&lt;&quot;kdj.k&quot;(9,3,3) and cross(&quot;kdj.k&quot;(9,3,3),&quot;kdj.d&quot;(9,3,3));<br />
A3:=BARSLAST(ref(cross(&quot;RSI.RSI1&quot;(6,12,24),&quot;RSI.RSI2&quot;(6,12,24)),1));<br />
B3:=ref(c,A3+1)&gt;c and ref(&quot;RSI.RSI1&quot;(6,12,24),A3+1)&lt;&quot;RSI.RSI1&quot;(6,12,24) and cross(&quot;RSI.RSI1&quot;(6,12,24),&quot;RSI.RSI2&quot;(6,12,24));<br />
C1:=BARSLAST(ref(cross(&quot;macd.dea&quot;(12,26,9),&quot;macd.diff&quot;(12,26,9)),1));<br />
D1:=ref(c,C1+1)&lt;c and ref(&quot;macd.diff&quot;(12,26,9),C1+1)&gt;&quot;macd.diff&quot;(12,26,9) and cross(&quot;macd.dea&quot;(12,26,9),&quot;macd.diff&quot;(12,26,9));<br />
C2:=BARSLAST(ref(cross(&quot;kdj.d&quot;(9,3,3),&quot;kdj.k&quot;(9,3,3)),1));<br />
D2:=ref(c,C2+1)&lt;c and ref(&quot;kdj.k&quot;(9,3,3),C2+1)&gt;&quot;kdj.k&quot;(9,3,3) and cross(&quot;kdj.d&quot;(9,3,3),&quot;kdj.k&quot;(9,3,3));<br />
C3:=BARSLAST(ref(cross(&quot;RSI.RSI2&quot;(6,12,24),&quot;RSI.RSI1&quot;(6,12,24)),1));<br />
D3:=ref(c,C3+1)&lt;c and ref(&quot;RSI.RSI1&quot;(6,12,24),C3+1)&gt;&quot;RSI.RSI1&quot;(6,12,24) and cross(&quot;RSI.RSI2&quot;(6,12,24),&quot;RSI.RSI1&quot;(6,12,24));<br />
C4:=BARSLAST(ref(cross(mdi,pdi),1));<br />
D4:=ref(c,C4+1)&lt;c and ref(mdi,C4+1)&gt;mdi and cross(mdi,pdi);<br />
A4:=BARSLAST(ref(cross(PDI,MDI),1));<br />
B4:=ref(c,A4+1)&gt;c and ref(pdi,A4+1)&lt;pdi and cross(pdi,mdi);<br />
DMI底背:IF(B4&gt;0,-0.1,0),COLOR0099FF,POINTDOT;<br />
DMI顶背:IF(D4&gt;0,0.1,0),COLORBLUE,POINTDOT;<br />
MACD底背:if(B1&gt;0,-0.1,0),colorred,pointdot;<br />
KDJ底背:if(B2&gt;0,-0.1,0),colorff00ff,pointdot;<br />
RSI底背:if(B3&gt;0,-0.1,0),coloryellow,pointdot;<br />
MACD顶背:if(D1&gt;0,0.1,0),color00ff00,pointdot;<br />
KDJ顶背:if(D2&gt;0,0.1,0),colorffcc66,pointdot;<br />
RSI顶背:if(D3&gt;0,0.1,0),colorwhite,pointdot;<br />
STICKLINE(B1&gt;0,-0.1,0,4,0),colorred;<br />
STICKLINE(B2&gt;0,-0.1,0,4,0),colorff00ff;<br />
STICKLINE(B3&gt;0,-0.1,0,4,0),coloryellow;<br />
{股旁网-股票公式网站 www.gupang.com}<br />
STICKLINE(d1&gt;0,0.1,0,4,0),color00ff00;<br />
STICKLINE(d2&gt;0,0.1,0,4,0),colorffcc66;<br />
STICKLINE(d3&gt;0,0.1,0,4,0),colorwhite;<br />
STICKLINE(B4&gt;0,-0.1,0,4,0),color0099ff;<br />
STICKLINE(D4&gt;0,0.1,0,4,0),colorblue;<br />
VVA:=((AMOUNT)/(VOL))/(100);<br />
VVB:=((3)*(HIGH)+LOW+OPEN+(2)*(CLOSE))/(7);<br />
VVC:=((SUM(AMOUNT,7))/(VVA))/(100);<br />
VVD:=DMA(VVB,(VOL)/(VVC));<br />
VVE:=((CLOSE-VVD)/(VVD))*(100);<br />
VVF:=((CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34)))*(100);<br />
VVJ:=MA(VVE,20)+STD(VVE,20);<br />
BIAS18:=((CLOSE-MA(CLOSE,18))/(MA(CLOSE,18)))*(100);<br />
KV:=SMA(VVF,3,1);<br />
STICKLINE((REF(BIAS18,1)&gt;=5) AND CROSS(VVJ,VVE) AND (KV&gt;79),macd,macd+0.03,4,0),color00ff00;<br />
LC:=REF(CLOSE,1);<br />
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;<br />
stickline(cross(84,RSI),macd,macd+0.03,4,0),COLOR00FF00;<br />
多方趋势:=7*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1)<br />
-3*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1),3,1)<br />
-sma(SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1)<br />
,3,1),2,1);<br />
天线:=78.89;<br />
stickline(cross(天线,多方趋势),macd,macd+0.03,4,0),Color00FF00;<br />
A1:=EMA(CLOSE,8)-EMA(CLOSE,14);<br />
B1:=EMA(0.668*REF(A1,1)+0.333*A1,1);<br />
做多:IF(A1&gt;=B1,A1,B1),ColorFF00FF,LINETHICK1;<br />
做空:=IF(B1-A1,B1,A1),LINETHICK;<br />
FILLRGN(做多&gt;做空,做多,做空),ColorFF00FF;</p>
<p></p>
<p>&nbsp;</p>
页: [1]
查看完整版本: 飞狐macd顶底背离组合指标公式