从MACD的红色起点做个选股源码
2020/4/22 18:54:01
公式编写说明:
请老师从MACD的红色起点和紫线上穿白线和趋势为先白线上穿黄线时做一个选股源码MACD源码如下:CD:="MACD.MACD"(6,13,4);CD1:="MACD.MACD"(12,26,9);标准MACD:CD1,LINESTICK;综合MACD:CD+CD1;红34天统计:SUM(IF(CD >0 ,CD,0),34),COLORRED,NODRAW;绿34天统计:SUM(IF(CD <=0 ,CD,0),34),COLORGREEN,NODRAW;STICKLINE(CD1 > REF(CD1,1),0,CD1,0,0),COLORRED;STICKLINE(CD1 < REF(CD1,1),0,CD1,0,0),COLORGREEN;STICKLINE(CD > 0,CD1,CD+CD1,2.3,0),COLORRED;STICKLINE(CD <=0,CD1,CD+CD1,2.3,0),COLORGREEN;DIF标准:"MACD.DIF"(12,26,9),COLORMAGENTA,LINETHICK3,NODRAW;DEA标准:"MACD.DEA"(12,26,9),COLORWHITE,LINETHICK2,NODRAW;DIF6_13短:="MACD.DIF"(6,13,4);DEA6_13短:="MACD.DEA"(6,13,4);BL1:=0.618;DIF综合:(DIF标准+DIF6_13短)*BL1,COLORMAGENTA,LINETHICK3{NODRAW};DEA综合:(DEA标准+DEA6_13短)*BL1,COLORWHITE,LINETHICK2{NODRAW};BL2:=HHV(ABS(综合MACD),250);STICKLINE(CD > 0,0,0.02*BL2,4,0),COLORRED;STICKLINE(CD <=0,0,0.02*BL2,4,0),COLORGREEN;{以下属附加的,可去掉};TYP:= AMOUNT/VOL/100;V1:=SUM(IF(TYP>REF(TYP,1),TYP*VOL,0),21)/SUM(IF(TYP<REF(TYP,1),TYP*VOL,0),21);MFI:=100-(100/(1+V1));资金相对流向:=EMA(MFI,5)/50,COLORLIRED,LINETHICK1;{副图图名 F.MACD_JIP , TDX 通过};{针状线为标准MACD(12,26,9),柱状红绿帽子是叠加的半周期MACD(6,13,4)};{本式一定程度克服了标准MACD的滞后性。见红晕可考虑加仓,见绿晕可考虑减仓};{连续暴跌后,还须看DIF与DEA金叉后的稳定性。横标尺色与晕色同步};{DIF标准、DEA标准的显、闭,只要将 NODRAW 函数 去或留或将“=”去留即可};趋势为先源码:N:=5;QJ0:=(HIGH+LOW+CLOSE)/3;QJ1:=IF(HIGH=LOW,1,HIGH-MAX(OPEN,CLOSE));QJ2:=IF(HIGH=LOW,1,MAX(CLOSE,OPEN)-QJ0);QJ3:=IF(HIGH=LOW,1,MIN(OPEN,CLOSE)-LOW);QJ4:=IF(HIGH=LOW,1,QJ0-MIN(CLOSE,OPEN));QJ5:=VOL/(IF(HIGH=LOW,4,HIGH-LOW));QJ6:="MACD.DIF">"MACD.DEA" AND "MACD.DEA"<0;QJ7:="KDJ.K">"KDJ.D" AND "KDJ.D"<30;QJ8:="MACD.DIF"<"MACD.DEA";QJ9:="KDJ.K"<"KDJ.D" AND "KDJ.K">80;特大:QJ4*QJ5,NODRAW;大单:QJ3*QJ5,NODRAW;中单:QJ1*QJ5,NODRAW;小单:QJ2*QJ5,NODRAW;W1:=SUM(大单,N)+SUM(特大,N);W2:=SUM(小单,N)+SUM(中单,N);量振1:=特大>大单 AND 大单>小单;量振2:=特大<小单 AND 大单<小单;标振1:=QJ6 AND QJ7;标振2:=QJ8 AND QJ9;A:=W1-W2;A0:=IF(A>0,A,0);B0:=IF(A<0,A,0);STICKLINE(A0,0,A0,3,0),COLOR000044;STICKLINE(A0,0,A0,2.5,0),COLOR000088;STICKLINE(A0,0,A0,1.5,0),COLOR0000AA;STICKLINE(A0,0,A0,1,0),COLOR0000CC;STICKLINE(B0,0,-B0,3,0),COLOR004400;STICKLINE(B0,0,-B0,2.5,0),COLOR008800;STICKLINE(B0,0,-B0,1.5,0),COLOR00AA00;STICKLINE(B0,0,-B0,1,0),COLOR00CC00;周趋势:MA(A,5),COLORFFFFFF;平滑值:EMA(周趋势,5),COLOR00FFFF;STICKLINE(标振1 AND 量振1 AND 周趋势>平滑值,0,A0,3,0),COLORYELLOW; DRAWTEXT(标振1 AND 量振1 AND 周趋势>平滑值,A0,'振'),COLORYELLOW;
公式源码回答:
红柱在0位置, 这个没看懂楼主的意思, 是否指第一根跨越0轴的红柱子? 或者楼主用图来指示
CD:="MACD.MACD"(6,13,4);
CD1:="MACD.MACD"(12,26,9);
CD>0 and max(cd1,cd+cd1)>0;
紫上穿白
DIF标准:="MACD.DIF"(12,26,9);
DEA标准:="MACD.DEA"(12,26,9);
DIF6_13短:="MACD.DIF"(6,13,4);
DEA6_13短:="MACD.DEA"(6,13,4);
DIF综合:=(DIF标准+DIF6_13短)*0.618;
DEA综合:=(DEA标准+DEA6_13短)*0.618;
cross(DIF综合,DEA综合);
白上穿黄
cross(MA(A,5),EMA(MA(A,5),5));
投 股票网 www .tou18.cn
股市公式下载推荐