MACD顺天通达信副图指标源码
{MACD顺天}
{INPUT:SHORT(12),LONG(26),M(9),N(55);}DIFF:(EMA(CLOSE,3)-EMA(CLOSE,8)),LINETHICK2,COLORGREEN;IF(DIFF>=REF(DIFF,1),DIFF,DRAWNULL),LINETHICK2,COLORRED;DEA:EMA(DIFF,9),COLORWHITE;MACD:DIFF-DEA,NODRAW,COLORMAGENTA;IF(DIFF>0 AND DIFF>DEA AND DIFF>REF(DIFF,1),DIFF,DRAWNULL),LINETHICK2,COLORRED;IF(DIFF<0 AND DIFF>DEA AND DIFF>REF(DIFF,1),DIFF,DRAWNULL),LINETHICK2,COLORYELLOW;
STICKLINE(MACD<=0 AND MACD<=REF(MACD,1),0,MACD,2,0),COLORGREEN;STICKLINE(MACD<=0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLORMAGENTA;STICKLINE(MACD>=0 AND MACD<=REF(MACD,1),0,MACD,2,0),COLORCYAN;STICKLINE(MACD>=0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLORRED;建仓:DIFF<0 AND REF(DIFF,1)<REF(DIFF,2) AND (DIFF>REF(DIFF,1)),COLORRED,NODRAW;买点:DIFF<0 AND CROSS(DIFF,DEA),COLORYELLOW,NODRAW;IF(买点,0.3,0),COLORYELLOW;加仓:DIFF<0 AND DIFF>DEA AND MACD>REF(MACD,1){DIFF>REF(DIFF,1)},NODRAW,COLORYELLOW;持股:DIFF>0 AND DIFF>DEA AND MACD>REF(MACD,1){DIFF>REF(DIFF,1)},NODRAW,COLORRED;卖点:DIFF>0 AND REF(DIFF,1)>REF(DIFF,2) AND {MACD<REF(MACD,1)}DIFF<REF(DIFF,1),COLORGREEN,NODRAW;持币:DIFF<DEA AND MACD<REF(MACD,1){DIFF<REF(DIFF,1)},NODRAW,COLORFFFF00;清仓:=DIFF>0 AND CROSS(DEA,DIFF);DRAWICON(建仓,DIFF*1.15,1);DRAWTEXT(建仓,DIFF*1.25,'建仓'),COLORRED;DRAWTEXT(买点,DEA*1.050,'买点'),COLORYELLOW;DRAWICON(卖点,DIFF*1.10,2);DRAWTEXT(卖点,DEA*1.30,'卖点'),COLORGREEN;DRAWTEXT(DIFF>0 AND CROSS(DEA,DIFF),DIFF*1.200,'清仓'),COLORGREEN;零线:0,COLORWHITE;T6:=IF(FINDSTR(EXTERNSTR(0,1),','),STRCAT('千股千评:',EXTERNSTR(0,1)),'');DRAWTEXT_FIX(1,0.30,0.00,0,T6),COLOR00FFFF;底背离:=LLV(LOW,60)=LOW AND NOT(LLV(MACD,55)=MACD);{大智慧讲师原设55天,LCY改为60天}顶背离:=HHV(HIGH,60)=HIGH AND NOT(HHV(MACD,55)=MACD);DRAWTEXT(底背离=1,DIFF*0.98,'底背离'),COLORMAGENTA;DRAWTEXT(顶背离=1,DEA*1.098,'顶背离'),COLORCCFF00;{主力潜伏}主力潜伏:COUNT(MACD<0,10)=10,COLORMAGENTA,NODRAW;IF(主力潜伏,0.3,0),COLORMAGENTA;{GX:REF(主力潜伏,1)=1 AND 主力潜伏<1 AND DIFF>0,COLORRED;};量:=EMA(VOL,13);资金:=EMA(AMOUNT,13);过滤:=((资金 /量) / 100);提纯:=(((CLOSE -过滤) / 过滤) * 100);黄金:=((提纯<(0)) AND ZXNH),COLORRED;粪土:=((提纯>(0)) AND ZXNH);低买:IF(黄金 AND (持股 OR 加仓),0.3,0),COLORYELLOW,LINETHICK2;高卖:IF(粪土 AND (持币 OR 清仓),0.3,0),COLORBLUE,LINETHICK2;{上涨分界:25;}STICKLINE(低买,0,0.3,2,0),COLORYELLOW;STICKLINE(高卖,0,0.3,2,0),COLORBLUE;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
输出{MACD顺天}{INPUT:SHORT(12),LONG(26),M(9),N(55)
输出}DIFF:(收盘价的3日指数移动平均-收盘价的8日指数移动平均), 线宽为2,画绿色
IF(DIFF>=1日前的DIFF,DIFF,DRAWNULL), 线宽为2,画红色
输出DEA:DIFF的9日指数移动平均,画白色
输出MACD:DIFF-DEA,NODRAW,画洋红色
IF(DIFF>0 AND DIFF>DEA AND DIFF>1日前的DIFF,DIFF,DRAWNULL), 线宽为2,画红色
IF(DIFF<0 AND DIFF>DEA AND DIFF>1日前的DIFF,DIFF,DRAWNULL), 线宽为2,画黄色
STICKLINE(MACD<=0 AND MACD<=1日前的MACD,0,MACD,2,0),画绿色
STICKLINE(MACD<=0 AND MACD>=1日前的MACD,0,MACD,2,0),画洋红色
STICKLINE(MACD>=0 AND MACD<=1日前的MACD,0,MACD,2,0),画青色
STICKLINE(MACD>=0 AND MACD>=1日前的MACD,0,MACD,2,0),画红色
输出建仓:DIFF<0 AND 1日前的DIFF<2日前的DIFF AND (DIFF>1日前的DIFF),画红色,NODRAW
输出买点:DIFF<0 AND DIFF上穿DEA,画黄色,NODRAW
如果买点返回0.3否则返回0
输出加仓:DIFF<0 AND DIFF>DEA AND MACD>1日前的MACD{DIFF>1日前的DIFF},NODRAW,画黄色
输出持股:DIFF>0 AND DIFF>DEA AND MACD>1日前的MACD{DIFF>1日前的DIFF},NODRAW,画红色
输出卖点:DIFF>0 AND 1日前的DIFF>2日前的DIFF AND {MACD<1日前的MACD}DIFF<1日前的DIFF,画绿色,NODRAW
输出持币:DIFF清仓赋值:DIFF>0 AND DEA上穿DIFF
当满足条件建仓时,在DIFF*1.15和1之间画图标
当满足条件建仓时,在DIFF*1.25和'建仓'位置书写文字
当满足条件买点时,在DEA*1.050和'买点'位置书写文字
当满足条件卖点时,在DIFF*1.10和2之间画图标
当满足条件卖点时,在DEA*1.30和'卖点'位置书写文字
DRAWTEXT(DIFF>0 AND DEA上穿DIFF,DIFF*1.200,'清仓'),画绿色
输出零线:0,画白色
T6赋值:IF(FINDSTR(EXTERNSTR(0,1),','),STRCAT('千股千评:',EXTERNSTR(0,1)),'')
当满足条件1时,在横轴0.30纵轴0.00位置书写文字
底背离赋值:60日内最低价最低值=最低价 AND NOT(55日内MACD最低值=MACD)
{大智慧讲师原设55天,LCY改为60天}顶背离赋值:60日内最高价最高值=最高价 AND NOT(55日内MACD最高值=MACD)
当满足条件底背离=1时,在DIFF*0.98和'底背离'位置书写文字
当满足条件顶背离=1时,在DEA*1.098和'顶背离'位置书写文字
输出{主力潜伏}主力潜伏:统计10日满足MACD<0的天数=10,画洋红色,NODRAW
如果主力潜伏返回0.3否则返回0
输出{GX:1日前的主力潜伏=1 AND 主力潜伏<1 AND DIFF>0,画红色
}
量赋值:成交量的13日指数移动平均
资金赋值:成交额的13日指数移动平均
过滤赋值:((资金 /量) / 100)
提纯赋值:(((收盘价 -过滤) / 过滤) * 100)
黄金赋值:((提纯<(0)) AND ZXNH),画红色
粪土赋值:((提纯>(0)) AND ZXNH)
输出低买:IF(黄金 AND (持股 OR 加仓),0.3,0),画黄色, 线宽为2
输出高卖:IF(粪土 AND (持币 OR 清仓),0.3,0), 画蓝色, 线宽为2
输出{上涨分界:25
当满足条件低买时,在0和0.3之间画柱状线
当满足条件高卖时,在0和0.3之间画柱状线