原理解析:
输出DIFF:收盘价的12日指数移动平均-收盘价的27日指数移动平均
输出DEA:DIFF的9日指数移动平均
MACD赋值:2*(DIFF-DEA)
当满足条件MACD>=0时,在MACD和0位置之间画柱状线,宽度为4,1不为0则画空心柱.,COLORF00FF0
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为4,0不为0则画空心柱.,COLOR00AAFF
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为3.3,0不为0则画空心柱.,COLOR00BBFF
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为2.2,0不为0则画空心柱.,COLOR00CCFF
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为1.65,0不为0则画空心柱.,COLOR00DDFF
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为1.1,0不为0则画空心柱.,COLOR00EEFF
当满足条件MACD0时,在0和MACD位置之间画柱状线,宽度为0.55,0不为0则画空心柱.,COLOR00FFFF
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为4,0不为0则画空心柱.,COLOR0000AA
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为3.3,0不为0则画空心柱.,COLOR0011BB
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为2.2,0不为0则画空心柱.,COLOR0022CC
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为1.65,0不为0则画空心柱.,COLOR0033DD
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为1.1,0不为0则画空心柱.,COLOR0044EE
当满足条件MACD>=1日前的MACDANDMACD>0时,在0和MACD位置之间画柱状线,宽度为0.55,0不为0则画空心柱.,COLOR0055FF
当满足条件MACD>1日前的MACDANDMACD1日前的MACDANDMACD1日前的MACDANDMACD1日前的MACDANDMACD1日前的MACDANDMACD1日前的MACDANDMACDDEA,返回DEA,否则返回DEA,画白色,线宽为1
低位金叉赋值:DIFF上穿DEA AND DIFF=0距今天数日中满足DIFF上穿DEA的天数
二次金叉赋值:DIFF上穿DEA AND DEA收盘价 AND DIFF>A1+1日前的DIFF AND DIFF上穿DEA
当满足条件底背离时,在0和0.13位置之间画柱状线,宽度为6,0不为0则画空心柱.,COLOR00FF00
当满足条件A1=0时,在DEA位置画直线起点,当满足条件底背离时,在DEA位置画直线终点,0表示是否延长.,画红色,线宽为2
当满足条件底背离时,在0.2位置书写文字,COLOR00FF00
A2赋值:上次1日前的DEA上穿DIFF距今天数
顶背离赋值:A2+1日前的收盘价DIFF AND DEA上穿DIFF
当满足条件A2=0时,在DEA位置画直线起点,当满足条件顶背离时,在DEA位置画直线终点,0表示是否延长.,画绿色,线宽为2
当满足条件收阳线时,在横轴0.01纵轴0.9位置书写文字,画红色
当满足条件收阳线时,在横轴1纵轴1位置书写文字,画红色
源码:
DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
DEA:EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
STICKLINE(MACD>=0,MACD,0,4,1),COLORF00FF0;
STICKLINE(MACD0,0,MACD,4,0 ),COLOR00AAFF;
STICKLINE(MACD0,0,MACD,3.3,0 ),COLOR00BBFF;
STICKLINE(MACD0,0,MACD,2.2,0 ),COLOR00CCFF;
STICKLINE(MACD0,0,MACD,1.65,0 ),COLOR00DDFF;
STICKLINE(MACD0,0,MACD,1.1,0 ),COLOR00EEFF;
STICKLINE(MACD0,0,MACD,0.55,0 ),COLOR00FFFF;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,4 ,0 ),COLOR0000AA;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,3.3 ,0 ),COLOR0011BB;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,2.2,0 ),COLOR0022CC;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,1.65 ,0 ),COLOR0033DD;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,1.1 ,0 ),COLOR0044EE;
STICKLINE(MACD>=REF(MACD,1)AND MACD>0,0,MACD,0.55 ,0 ),COLOR0055FF;
STICKLINE(MACD>REF(MACD,1)AND MACDREF(MACD,1)AND MACDREF(MACD,1)AND MACDREF(MACD,1)AND MACDREF(MACD,1)AND MACDREF(MACD,1)AND MACDDEA,DEA,DEA),COLORWHITE,LINETHICK1;
低位金叉:=CROSS(DIFF,DEA) AND DIFF=0));
二次金叉:=CROSS(DIFF,DEA) AND DEACLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.13,6,0),COLOR00FF00;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
DRAWTEXT(底背离,0.2, '底背离'),COLOR00FF00;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK2;
DRAWTEXT_FIX(C>O,0.01,0.9,0,' WWW. '),COLORRED;
DRAWTEXT_FIX(C>O,1,1,0,'交易策略'),COLORRED;