ihzx 发表于 2021-8-21 14:01:30

大智慧优化MACD精确控盘指标公式

<p>{SHORT=26,LONG=12,M=9,P1=19,P2=120,K= -40,G=-26}</p>
<p>stickline(c&gt;0,-1,1,6,0),color330066;<br />
DIF:=((EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)))*-1;<br />
DEA:=EMA(DIF,M),COLORFF00FF;<br />
MACD:=2*(DIF-DEA);<br />
HH:=MA(CLOSE,10);<br />
GG:=MA(CLOSE,12);<br />
上:=ema((MA(HIGH,3) * 1.05),30);<br />
下:=ema((MA(LOW,3) * 0.96),30);<br />
决战:STICKLINE((((CROSS(DIF,DEA) AND ((下 - REF(下,1)) &gt; 0)) AND (MACD &gt;= REF(MACD,1)))AND (DIF &lt; 0)),DIF,0.4,3,0),color0000FF;<br />
DRAWICON((((CROSS(DIF,DEA) AND ((下 - REF(下,1)) &gt; 0)) AND (MACD &gt;= REF(MACD,1))) AND (DIF &lt; 0)),0.4,0);DRAWTEXT((((CROSS(DIF,DEA) AND ((下 - REF(下,1)) &gt; 0)) AND (MACD &gt;= REF(MACD,1))) AND (DIF &lt;= 0)),0.4,'DIFF金叉'),color0000FF;<br />
STICKLINE(FILTER(((((MACD &gt;= REF(MACD,5)) AND ((下 - REF(下,1)) &gt; 0)) AND (MACD &lt;= 0)) AND ((GG - REF(GG,1)) &gt;= 0)),3),0,0.5,3,0),color00FF00;<br />
DRAWICON(FILTER(((((MACD &gt;= REF(MACD,5)) AND ((下 - REF(下,1)) &gt; 0)) AND (MACD &lt;= 0)) AND ((GG - REF(GG,1)) &gt;= 0)),3),0.5,0);<br />
DRAWTEXT(FILTER(((((MACD &gt;= REF(MACD,5)) AND ((下 - REF(下,1)) &gt; 0)) AND MACD &lt;= 0)) AND ((GG - REF(GG,1)) &gt;= 0)),3),0.5,'绝佳买入'),color00FF00;<br />
VCF1:=LLV(LOW,5);<br />
VCF2:=HHV(HIGH,5);<br />
VCF3:=EMA((((CLOSE - VCF1) / (VCF2 - VCF1)) * 100),4);<br />
VCF4:=EMA(((0.667 * REF(VCF3,1)) + (0.333 * VCF3)),2);<br />
VCF5:=((HIGH + LOW) / 2);<br />
VCF6:=DMA(VCF5,(VOL / SUM(VOL,5)));<br />
VCF7:=DMA(VCF5,(VOL / SUM(VOL,13)));<br />
VCF8:=DMA(VCF5,(VOL / SUM(VOL,34)));<br />
VCF9:=DMA(VCF5,(VOL / SUM(VOL,75)));<br />
VCFA:=EMA(WINNER((0.9 * CLOSE)),5);<br />
VCFB:=(1 - EMA(WINNER((1.2 * CLOSE)),5));<br />
VCFC:=EMA(WINNER(CLOSE),5);<br />
VCFD:=((100 * (CLOSE - VCF6)) / VCF6);<br />
VCFE:=((100 * (CLOSE - VCF7)) / VCF7);<br />
VCFF:=((100 * (MIN(CLOSE,OPEN) - VCF8)) / VCF8);<br />
VCF10:=BARSLAST(((VCF8 &gt; VCF9) AND (REF(VCF8,1) &lt;= REF(VCF9,1))));<br />
VCF11:=((((COUNT(((WINNER(CLOSE) &lt; 0.11) AND (EMA(WINNER(CLOSE),5) &lt; 0.15)),2) &gt; 0) OR (((1 - WINNER((1.2 * CLOSE))) &gt;= 0.8) AND (WINNER(CLOSE) &lt; 0.05))) AND (COUNT((VCFE &lt; (0 - 16)),2) &gt; 0)) AND (COUNT((VCFF &lt; (0 - 20)),2) &gt; 0));<br />
VCF12:=((((COUNT((VCFD &lt; (0 - 10)),2) &gt; 0) AND (COUNT((VCFE &lt; (0 - 15)),2) &gt; 0)) AND (COUNT((VCFF &lt; (0 - 15)),2) &gt; 0)) AND (COUNT((VCFA &gt; 0.8),VCF10) = 0));<br />
VCF13:=(((COUNT((VCF11 OR VCF12),2) &gt; 0) AND (VCF3 &gt; REF(VCF3,1))) AND (((1 - WINNER((1.15 * CLOSE))) * 100) &gt; 80));<br />
出击1:=IF((VCF13 AND (COUNT(VCF13,3) &lt;= 1)),0.1,0);<br />
黑马出击:IF((VCF13 AND (COUNT(VCF13,3) &lt;= 1)),0.37,0),LINETHICK3,color0000FF;<br />
DRAWICON((黑马出击 &gt; 0),0.37,1);<br />
DRAWTEXT((黑马出击 &gt; 0),0.35,'★黑马'),colorFFFFFF;<br />
DRAWTEXT((黑马出击 &gt; 0),0.35,'出击'),color00FF00;<br />
VAR26:=(((CLOSE - REF(CLOSE,1)) / REF(CLOSE,1)) * 100);<br />
VAR27:=((EMA(CLOSE,12) - EMA(CLOSE,26)) * 100);<br />
VAR28:=EMA(VAR27,9);<br />
VAR29:=(2 * (VAR27 - VAR28));<br />
STICKLINE(((VAR27 &lt; (0 - 50)) AND (VAR26 &gt; 7)),0,(0 - 0.1),5,0),color0000FF;<br />
DRAWTEXT((((VAR27 &lt; (0 - 50)) AND (VAR26 &gt; 7)) AND (VAR27 &lt; VAR28)),(0 - 0.09),'底'),colorFFFFFF;<br />
DRAWTEXT((((VAR27 &lt; (0 - 50)) AND (VAR26 &gt; 7)) AND (VAR27 &gt;= VAR28)),(0 - 0.1),'追'),colorFFFFFF;<br />
VAR1:=1;<br />
VAR2:=MA(CLOSE,18);<br />
VAR3:=(((CLOSE - VAR2) / VAR2) * 100);<br />
VAR4:=MA(VAR3,1);<br />
升跌:=(VAR4 * VAR1);<br />
VAR5:=BARSLAST((CROSS((0 - 10),VAR4) = 1));<br />
VAR6:=BARSLAST((CROSS(VAR4,10) = 1));<br />
VAR7:=((VAR4 &lt; (0 - 10)) AND (VAR5 &gt;= 5));<br />
VAR8:=((VAR4 &gt; 10) AND (VAR6 &gt;= 5));<br />
{C1:(0.01 * (IF(((VAR4 &lt; (0 - 10)) AND (VAR5 &gt;= 5)),VAR4,0) * VAR1)),LINETHICK1,color0000FF;C2:=C1;}<br />
C3:=(IF(((VAR4 &gt; 10) AND (VAR6 &gt;= 5)),VAR4,0) * VAR1);<br />
C4:=C3;D1:=((((升跌 &gt; REF(升跌,1)) AND VAR7) * 0.2) * VAR1);<br />
中期底部:=LLV(CLOSE,30);<br />
D:(FILTER(((((((升跌 &gt; REF(升跌,1)) AND (LOW &lt;= 中期底部)) AND (CLOSE &gt; 中期底部))AND VAR7) * 0.5) * VAR1),3) * 0.5),LINETHICK2,color0000FF;<br />
DRAWTEXT((D &gt;= 0.25),D,'★铁底'),color00FFFF;<br />
STICKLINE(((CROSS(MACD,DIF) AND (MACD &gt;= (0 - 0.05))) AND (MACD &lt;= 0.02)),MACD,0.23,0,0),LINETHICK2,color00FFFF;<br />
DRAWTEXT(((CROSS(MACD,DIF) AND (MACD &gt;= (0 - 0.05))) AND (MACD &lt;= 0.02)),0.23,'^MACD'),color0000FF;<br />
DRAWTEXT(((CROSS(MACD,DIF) AND (MACD &gt;= (0 - 0.05))) AND (MACD &lt;= 0.02)),0.23,'金叉'),LINETHICK4,colorFFFFFF;<br />
DRAWICON(((CROSS(MACD,DIF) AND (MACD &gt;= (0 - 0.05))) AND (MACD &lt;= 0.02)),0.23,1);<br />
DIFF2:=(EMA(CLOSE,2) - EMA(OPEN,5));<br />
操盘手:=DIFF2;(0.4 * ((CROSS(操盘手,MACD) AND (MACD &lt;= (0 - 0.11))) AND (LOW &lt;= 下))),LINETHICK2,colorFFFFFF;<br />
DRAWTEXT(((CROSS(操盘手,MACD) AND (LOW &lt;= 下)) AND (MACD &lt;= (0 - 0.11))),0.6,'短线5%'),colorB7D16F;<br />
MA1:=MA(CLOSE,5);<br />
MA2:=MA(CLOSE,10);<br />
BB:(0.7 * ((((((CROSS(DIF,DEA) AND (CLOSE &lt; 上)) AND ((下 - REF(下,1)) &gt; 0)) AND CROSS(MACD,0)) AND (MACD &gt;= 0)) AND (DIF &gt; 0)) AND (((HH - REF(HH,1)) &gt; 0) AND (VOL &gt; REF(VOL,1)))));<br />
DRAWTEXT((((BB &gt;= 0.7) AND (CLOSE &lt; 上)) AND ((下 - REF(下,1)) &gt; 0)),0.7,'。量价配合完美'),color00FF00;<br />
DRAWTEXT((((BB &gt;= 0.7) AND (CLOSE &lt; 上)) AND ((下 - REF(下,1)) &gt; 0)),0.7,'。(追)'),color0000FF;<br />
N15HIGH:=REF(HIGH,15);<br />
N1LOW:=REF(LOW,1);<br />
FF:=(((N15HIGH - N1LOW) / N1LOW) &gt; 0.15);<br />
DRAWICON((((((CROSS(MA(CLOSE,P1),MA(CLOSE,P2)) &gt; 0) AND (((N15HIGH - N1LOW) / N1LOW) &lt; 0.15)) AND (OPEN &gt;= MA(CLOSE,P1))) AND (CLOSE &gt;= MA(CLOSE,P1))) AND (LOW &lt;= MA(CLOSE,P1))),0.5,1);<br />
DRAWTEXT((((((CROSS(MA(CLOSE,P1),MA(CLOSE,P2)) &gt; 0) AND      (((N15HIGH - N1LOW) / N1LOW) &lt; 0.15)) AND (OPEN &gt;= MA(CLOSE,P1))) AND (CLOSE &gt;= MA(CLOSE,P1))) AND (LOW &lt;= MA(CLOSE,P1))),0.5,'★^回头望月'),colorFF0000;<br />
VAR10:=(((CLOSE - MA(CLOSE,58)) / MA(CLOSE,58)) * 100);<br />
VAR11:=((((VAR10 &gt; (1 * REF(VAR10,1))) AND (VAR10 &lt; K)) AND (VAR10 &gt; G)) * 1.5);<br />
VAR12:=((VOL / CAPITAL) * 100);<br />
VAR13:=LLVBARS(LOW,50);<br />
VAR14:=SUM(VOL,VAR13);<br />
VAR15:=HHVBARS(HIGH,50);<br />
VAR16:=SUM(VOL,VAR15);<br />
VAR17:=(((CLOSE - REF(OPEN,VAR15)) / REF(OPEN,VAR15)) * 100);<br />
VAR18:=((VAR16 / CAPITAL) * 100);<br />
VAR19:=(((CLOSE - REF(OPEN,VAR13)) / REF(OPEN,VAR13)) * 100);<br />
VAR20:=((VAR14 / CAPITAL) * 100);<br />
VAR21:=MA(CLOSE,3);<br />
VAR22:=(REF(CLOSE,2) * 0.865);<br />
VAR23:=(REF(CLOSE,13) * 0.772);<br />
VAR24:=MIN(VAR22,VAR23);<br />
VAR25:=MA(CLOSE,13);<br />
抄底1:(IF((((((CLOSE - VAR24) / CLOSE) &lt; 0.03) AND (VAR17 &lt; (-35))) AND ((SUM(VAR12,5) / 5) &lt; 1.8)),1,0) * 0.4),LINETHICK3,colorFF0000;<br />
DRAWTEXT((抄底1 &gt; 0),抄底1,'★抄底'),LINETHICK3,colorFFFFFF;<br />
DRAWTEXT((抄底1 &gt; 0),抄底1,'成功90%'),LINETHICK3,color00FF00;<br />
VAR266:=(((CLOSE - REF(CLOSE,1)) / REF(CLOSE,1)) * 100);<br />
VAR277:=((EMA(CLOSE,12) - EMA(CLOSE,26)) * 100);<br />
VAR288:=EMA(VAR277,9);<br />
VAR299:=(2 * (VAR277 - VAR288));<br />
DRAWTEXT((((VAR277 &lt; (-50)) AND (VAR266 &gt; 7)) AND (VAR277 &lt; VAR288)),(-0.08),'★'),colorFFFFFF;<br />
DRAWTEXT((((VAR277 &lt; (-50)) AND (VAR266 &gt; 7)) AND (VAR277 &gt;= VAR288)),(-0.1),'● '),colorFFFFFF;<br />
VAC:=(LOW * 0.9);<br />
VAB:=EMA(LLV(LOW,90),21);<br />
VAD:=(((VAC * VOL) + (VAB * (CAPITAL - VOL))) / CAPITAL);<br />
VAE:=EMA(VAD,30);<br />
VAF:=(CLOSE - REF(CLOSE,1));<br />
VA10:=MAX(VAF,0);<br />
VA11:=ABS(VAF);<br />
VA12:=((SMA(VA10,7,1) / SMA(VA11,7,1)) * 100);<br />
VA13:=((SMA(VA10,13,1) / SMA(VA11,13,1)) * 100);<br />
VA14:=((SMA(MAX(VAF,0),6,1) / SMA(ABS(VAF),6,1)) * 100);<br />
VA15:=((((-200) * (HHV(HIGH,60) - CLOSE)) / (HHV(HIGH,60) - LLV(LOW,60))) + 100);<br />
VA16:=(((CLOSE - LLV(LOW,15)) / (HHV(HIGH,15) - LLV(LOW,15))) * 100);<br />
VA17:=SMA(((SMA(VA16,4,1) - 50) * 2),3,1);<br />
VA18:=(((INDEXC - LLV(INDEXL,14)) / (HHV(INDEXH,14) - LLV(INDEXL,14))) * 100);<br />
VA19:=SMA(VA18,4,1);<br />
VA1A:=SMA(VA19,3,1);<br />
VA1B:=(((HHV(HIGH,30) - CLOSE) / CLOSE) * 100);<br />
VA1C:=((((((((VA14 &lt;= 25) AND (VA15 &lt; (-95))) AND (VA1B &gt; 20)) AND (VA17 &lt; (-30))) AND (VA1A &lt; 30)) AND ((VAE - CLOSE) &gt;= (-0.25)))AND (VA12 &lt; 22)) AND (VA13 &lt; 28));<br />
低买1:=STICKLINE(VA1C,0,0.1,1,1);<br />
发射:STICKLINE(VA1C,0,0.7,2,0),LINETHICK2,color0000FF;<br />
DRAWTEXT((VA1C &gt; 0),0.7,'^★发射'),colorFFFFFF;<br />
A4:=BARSLAST(ref(cross(dif,dea),1));<br />
B1:=ref(c,A4+1)&gt;c and ref(dif,A4+1)&lt;dif and cross(dif,dea);<br />
DRAWTEXT(FILTER(B1&gt;0,5),dif+0.2,'●背离'),COLORyellow;<br />
STICKLINE(MACD&lt;ref(MACD,1)and MACD&gt;0,0,MACD,2,0),colorgreen;<br />
STICKLINE(MACD&lt;ref(MACD,1)and MACD&lt;0,0,MACD,2,0),colorFFCC33;<br />
STICKLINE(MACD&gt;ref(MACD,1)and MACD,0,MACD,2,0),COLORyellow;<br />
STICKLINE(MACD&gt;ref(MACD,1)and MACD&gt;0,0,MACD,2,0),COLOR8899ee;<br />
if(dif&lt;0,dif,0),coloryellow,linethick2;<br />
if(dif&lt;0,0,dif),colorred,linethick2;<br />
if(dif&lt;dea,dif,dea),COLORWHITE,linethick2;<br />
if(dif&gt;dea,dea,dea),{COLORgreen}colorFF937F,linethick2;<br />
缩头:=IF(MACD&gt;0 AND REF(MACD,1)&gt;REF(MACD,2) AND MACD&lt; REF(MACD,1),1,0);<br />
缩脚:=IF(MACD&lt;0 AND REF(MACD,1)&lt; REF(MACD,2) AND MACD&gt;REF(MACD,1),1,0);<br />
阻力:=IF(CROSS(C,MA(C,20)) OR CROSS(C,MA(C,60)),1,0);<br />
支撑:=IF(CROSS(MA(C,20),C) OR CROSS(MA(C,60),C),1,0);<br />
做多:=IF(CROSS(MACD,DIF) AND DIF&gt;0 AND MACD&gt;0,1,0);<br />
放空:=IF(CROSS(DIF,MACD) AND DIF&lt;0 AND MACD&lt;0,1,0);<br />
RAWTEXT(FILTER(缩头,3) AND 缩头,MACD,'▼'),COLORFF00FF;<br />
DRAWTEXT(FILTER(缩头,3) AND 缩头,MACD+0.2,'缩头'),COLORFF00FF;<br />
DRAWTEXT(FILTER(缩脚,3) AND 缩脚,MACD,'△'),COLOR00FF00;<br />
DRAWTEXT(FILTER(缩脚,3) AND 缩脚,MACD-0.2,'缩脚'),COLOR00FF00;<br />
DRAWTEXT(FILTER(阻力,16) AND MACD&gt;=0,MACD+0.01,'&curren;阻力'),COLOR00FFFF;<br />
DRAWTEXT(FILTER(支撑,16) AND MACD&lt;0,MACD,'&curren;支撑'),COLORFFFFFF;<br />
多头趋势:=IF(DIF&gt;=0 AND MACD&gt;=0 OR (DIF&lt;0 AND MACD&gt;=0),1,0);<br />
空头趋势:=DIF&lt;0 AND MACD&lt;0 OR (DIF&gt;=0 AND MACD&lt;0);<br />
up:=FILTER(多头趋势,13);<br />
DRAWTEXT(up,DIF,'&curren;多头'),COLORRED;<br />
pu :=FILTER(空头趋势,13);<br />
DRAWTEXT(PU,DIF,'&curren;空头'),COLORFF8800;<br />
低位金叉:=CROSS(DIF,DEA) AND DIF&lt;-0.1;<br />
STICKLINE(低位金叉,0,0.08,6,0),COLORYELLOW;<br />
DRAWTEXT(低位金叉,低位金叉-1.5,' 低位金叉'),COLORWHITE;<br />
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA&gt;=0));<br />
二次金叉:=CROSS(DIF,DEA) AND DEA&lt;0 AND COUNT(JCCOUNT=2,21)=1;<br />
STICKLINE(二次金叉,0,0.06,6,0),ColorFF00FF;<br />
DRAWICON(二次金叉,dea*1.04,1) ;<br />
DRAWTEXT(二次金叉,0.5,' 二次金叉'),ColorYELLOW;<br />
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));<br />
底背离:=REF(CLOSE,A1+1)&gt;CLOSE AND DIF&gt;REF(DIF,A1+1) AND CROSS(DIF,DEA);<br />
STICKLINE(底背离,0,0.03,6,0),Color00FF00;<br />
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,linethick1;<br />
DRAWTEXT(底背离,0.12,' 底背离'),ColorFF00FF;<br />
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));<br />
顶背离:=REF(CLOSE,A2+1)&lt;CLOSE AND REF(DIF,A2+1)&gt;DIF AND CROSS(DEA,DIF);<br />
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,linethick1;<br />
DRAWTEXT(顶背离,0.2,' ★顶背离'),ColorYELLOW;</p>
<p></p>
<p>&nbsp;</p>
页: [1]
查看完整版本: 大智慧优化MACD精确控盘指标公式