MACD金{通达信、主图、源码、贴图、}
DIF1:=WMA(CLOSE,5);
DIF2:=WMA(CLOSE,13);
MACD:WMA((3*DIF1-2*DIF2),2),COLORFF9900,DOTLINE,LINETHICK2;
IF(MACD>REF(MACD,1),MACD,DRAWNULL),COLORYELLOW,LINETHICK2;
BC1E:=IF(L=LLV(L,8*20),L,DRAWNULL);
BC2E:=CONST(BARSLAST(BC1E=L))+1;
E:=CONST(IF(BC2E=1,L,REF(L,BC2E-1)));
DIFFK:=DIF1-DIF2;
DEAK:=WMA(DIFFK,8);
MACDK:=2*(DIFFK-DEAK);
STICKLINE(MACDK>0 AND MACDK>REF(MACDK,1),E+MACDK,E,2,0),COLOR0000FF;
STICKLINE(MACDK>0 AND MACDK<REF(MACDK,1),E+MACDK,E,2,0),COLORFF9900;
STICKLINE(MACDK<0,E+MACDK,E,2,0),COLORFF9900;
{高抛.低吸}
SJ:=WMA((C-LLV(L,5))/(HHV(H,5)-LLV(L,5))*100,2);
ZJ:=WMA(0.667*REF(SJ,1)+0.333*SJ,2);
DRAWTEXT(CROSS(SJ,ZJ) AND SJ<30,L-0.05,'←低吸'),COLOR00FF99,LINETHICK2;
DRAWTEXT(CROSS(ZJ,SJ) AND SJ>70,H+0.05,'←高抛'),COLOR0044FF,LINETHICK2;
TC1:=IF(H=HHV(H,8*14),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,8*20),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位}
HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位};
STICKLINE(LP,L*0.992,L,13,0),COLORFF00FF;
STICKLINE(HP,H,H*1.005,13,0),COLOR00FF00;
X1:IF(CURRBARSCOUNT<=MAX(BC2,TC2),UPPER,DRAWNULL),COLOR89615F;
X2:IF(CURRBARSCOUNT<=MAX(BC2,TC2),LOWER,DRAWNULL),COLOR89615F;
X3:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.146,LOWER+(UPPER-LOWER)*0.146),DRAWNULL),COLOR89615F;
X4:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.191,LOWER+(UPPER-LOWER)*0.191),DRAWNULL),COLOR89615F;
X5:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.236,LOWER+(UPPER-LOWER)*0.236),DRAWNULL),COLOR89615F;
X6:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.382,LOWER+(UPPER-LOWER)*0.382),DRAWNULL),COLOR89615F;
X7:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.5,LOWER+(UPPER-LOWER)*0.5),DRAWNULL),COLOR89615F;
X8:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.618,LOWER+(UPPER-LOWER)*0.618),DRAWNULL),COLOR89615F;
X9:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.764,LOWER+(UPPER-LOWER)*0.764),DRAWNULL),COLOR89615F;
X10:IF(CURRBARSCOUNT<=MAX(BC2,TC2),IF(BC2>TC2,UPPER-(UPPER-LOWER)*0.809,LOWER+(UPPER-LOWER)*0.809),DRAWNULL),COLOR89615F;
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X1,'UPPER');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X2,'LOWER');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X3,'0.146');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X4,'0.191');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X5,'0.236');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X6,'0.382');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X7,'0.5');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X8,'0.618');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X9,'0.764');
DRAWTEXT(CURRBARSCOUNT=MIN(BC2,TC2)+8,X10,'0.809');
STICKLINE(CLOSE>= REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORRED;
STICKLINE(CLOSE>= REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLOR000066;
STICKLINE(CLOSE>= REF(CLOSE,1) ,OPEN,CLOSE,2.6,0 ),COLOR000099;
STICKLINE(CLOSE>= REF(CLOSE,1) ,OPEN,CLOSE,2,0 ),COLOR0000CC;
STICKLINE(CLOSE>= REF(CLOSE,1) ,OPEN,CLOSE,1.2,0 ),COLOR0000FF;
STICKLINE(CLOSE>= REF(CLOSE,1) ,OPEN,CLOSE,0.4,0 ),COLORCC66FF;
STICKLINE(CLOSE< REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORCYAN;
STICKLINE(CLOSE< REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLORCC0000;
STICKLINE(CLOSE< REF(CLOSE,1) ,OPEN,CLOSE,2.6,0 ),COLORFF4400;
STICKLINE(CLOSE< REF(CLOSE,1) ,OPEN,CLOSE,2,0 ),COLORFF8800;
STICKLINE(CLOSE< REF(CLOSE,1) ,OPEN,CLOSE,1.2,0 ),COLORFFCC00;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
DIF1赋值:W收盘价的5日简单移动平均
DIF2赋值:W收盘价的13日简单移动平均
输出
MACD:WMA((3*DIF1-2*DIF2),2),COLORFF9900,DOTLINE, 线宽为2
IF(MACD>1日前的MACD,MACD,DRAWNULL),画黄色, 线宽为2
BC1E赋值:IF(L=8*20日内L最低值,L,DRAWNULL)
BC2E赋值:CONST(上次BC1E=L距今天数)+1
E赋值:CONST(IF(BC2E=1,L,BC2E-1日前的L))
DIFFK赋值:DIF1-DIF2
DEAK赋值:WDIFFK的8日简单移动平均
MACDK:=2*(DIFFK-DEAK)
STICKLINE(MACDK>0 AND MACDK>1日前的MACDK,E+MACDK,E,2,0),COLOR0000FF
STICKLINE(MACDK>0 AND MACDK<1日前的MACDK,E+MACDK,E,2,0),COLORFF9900
当满足条件MACDK<0时,在E+MACDK和E之间画柱状线
{高抛.低吸}
SJ赋值:WMA((C-5日内L最低值)/(5日内H最高值-5日内L最低值)*100,2)
ZJ赋值:W0.667*1日前的SJ+0.333*SJ的2日简单移动平均
DRAWTEXT(SJ上穿ZJ AND SJ<30,L-0.05,'←低吸'),COLOR00FF99, 线宽为2
DRAWTEXT(ZJ上穿SJ AND SJ>70,H+0.05,'←高抛'),COLOR0044FF, 线宽为2
TC1赋值:IF(H=8*14日内H最高值,H,DRAWNULL)
TC2赋值:CONST(上次TC1=H距今天数)+1
UPPER赋值:CONST(IF(TC2=1,H,TC2-1日前的H))
BC1赋值:IF(L=8*20日内L最低值,L,DRAWNULL)
BC2赋值:CONST(上次BC1=L距今天数)+1
LOWER赋值:CONST(IF(BC2=1,L,BC2-1日前的L))
LP赋值: 到最后交易的周期<=BC2 AND L=最低价ER
{低点定位}
HP赋值: 到最后交易的周期<=TC2 AND H=UPPER
{高点定位}
当满足条件LP时,在L*0.992和L之间画柱状线
当满足条件HP时,在H和H*1.005之间画柱状线
输出
X1:IF( 到最后交易的周期<=BC2和TC2较大值,UPPER,DRAWNULL),COLOR89615F
输出
X2:IF( 到最后交易的周期<=BC2和TC2较大值,最低价ER,DRAWNULL),COLOR89615F
输出
X3:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.146,最低价ER+(UPPER-最低价ER)*0.146),DRAWNULL),COLOR89615F
输出
X4:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.191,最低价ER+(UPPER-最低价ER)*0.191),DRAWNULL),COLOR89615F
输出
X5:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.236,最低价ER+(UPPER-最低价ER)*0.236),DRAWNULL),COLOR89615F
输出
X6:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.382,最低价ER+(UPPER-最低价ER)*0.382),DRAWNULL),COLOR89615F
输出
X7:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.5,最低价ER+(UPPER-最低价ER)*0.5),DRAWNULL),COLOR89615F
输出
X8:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.618,最低价ER+(UPPER-最低价ER)*0.618),DRAWNULL),COLOR89615F
输出
X9:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.764,最低价ER+(UPPER-最低价ER)*0.764),DRAWNULL),COLOR89615F
X10:IF( 到最后交易的周期<=BC2和TC2较大值,IF(BC2>TC2,UPPER-(UPPER-最低价ER)*0.809,最低价ER+(UPPER-最低价ER)*0.809),DRAWNULL),COLOR89615F
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X1,'UPPER')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X2,'最低价ER')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X3,'0.146')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X4,'0.191')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X5,'0.236')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X6,'0.382')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X7,'0.5')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X8,'0.618')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X9,'0.764')
DRAWTEXT( 到最后交易的周期=BC2和TC2的较小值+8,X10,'0.809')
STICKLINE(收盘价>= 1日前的收盘价 ,最高价,最低价,0,1 ),画红色
STICKLINE(收盘价>= 1日前的收盘价 ,开盘价,收盘价,3,0 ),COLOR000066
STICKLINE(收盘价>= 1日前的收盘价 ,开盘价,收盘价,2.6,0 ),COLOR000099
STICKLINE(收盘价>= 1日前的收盘价 ,开盘价,收盘价,2,0 ),COLOR0000CC
STICKLINE(收盘价>= 1日前的收盘价 ,开盘价,收盘价,1.2,0 ),COLOR0000FF
STICKLINE(收盘价>= 1日前的收盘价 ,开盘价,收盘价,0.4,0 ),COLORCC66FF
STICKLINE(收盘价< 1日前的收盘价 ,最高价,最低价,0,1 ),画青色
STICKLINE(收盘价< 1日前的收盘价 ,开盘价,收盘价,3,0 ),COLORCC0000
STICKLINE(收盘价< 1日前的收盘价 ,开盘价,收盘价,2.6,0 ),COLORFF4400
STICKLINE(收盘价< 1日前的收盘价 ,开盘价,收盘价,2,0 ),COLORFF8800
STICKLINE(收盘价< 1日前的收盘价 ,开盘价,收盘价,1.2,0 ),COLORFFCC00