通达信MACD强弱指标(源码)

2015-10-07 20:19:00来源:本站整理浏览:272

M :=9;
P1:=5;
P2:=10;
P3:=20;
P4:=30;
LONG:=26;
SHORT:=12;
MA1:= EMA(C,P1);
MA2:= EMA(C,P2);
MA3:= EMA(C,P3);
MA4:= EMA(C,P4);
MA5:= MA(C,120);
换手率:=(VOL*100/FINANCE(7));
N:=26; P:=20;
MID := MA(CLOSE,N);
UPPER:=MID + P/10*STD(CLOSE,N);
LOWER:=MID - P/10*STD(CLOSE,N);
多头排列:=MA1>MA2 AND MA2>MA3 AND MA2>MA4 AND MA4>REF(MA4,5);
空头排列:=MA1<MA2 AND MA2<MA3 AND MA3<MA4;
上升趋势:=MA4>REF(MA4,3) AND MA4>REF(MA4,1) AND MA1>MA4;
下跌趋势:=MA4<REF(MA4,3) AND MA4<REF(MA4,1) AND MA1<MA4;
{【MACD指标分析】}
DIF :EMA(CLOSE,SHORT)-EMA(CLOSE,LONG),COLORCCFFFF;
DEA :EMA(DIF,M),COLOR58FF58;
MACD:=2*(DIF-DEA),COLORFFFF00,LINETHICK0;
STICKLINE(MACD>=0 AND MACD>=REF(MACD,1),0,MACD,2,0),COLOR6058FF;
STICKLINE(MACD>=0 AND MACD< REF(MACD,1),0,MACD,2,1),COLOR6058FF;
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,1),COLORFFFF00;
STICKLINE(MACD<0 AND MACD< REF(MACD,1),0,MACD,2,0),COLORFFFF00;
多头趋势:=IF(DIF>=0 AND DEA>=0 OR (DIF<0 AND DEA>=0),1,0);
空头趋势:=DIF<0 AND DEA<0 OR (DIF>=0 AND DEA<0);
MACD绿柱缩短:=MACD<0 AND ABS(MACD)< REF(ABS(MACD),1) AND REF(MACD,1)<0;
MACD红柱缩短:=MACD>0 AND MACD< REF(MACD,1);
缩头:=IF(MACD>0 AND REF(MACD,1)>REF(MACD,2) AND REF(MACD,2)>REF(MACD,3) AND MACD< REF(MACD,1),1,0) AND REF(MACD,1)>0.150;
缩脚:=IF(MACD<0 AND REF(MACD,1)< REF(MACD,2) AND REF(MACD,2)< REF(MACD,3) AND MACD>REF(MACD,1),1,0) AND REF(MACD,1)<-0.100;
金叉:=CROSS(DIF,DEA);
死叉:=CROSS(DEA,DIF);
轴下死叉:=死叉 AND DEA<0;
轴上死叉:=死叉 AND DEA>0;
轴下金叉:=金叉 AND DEA<0;
轴上金叉:=金叉 AND DEA>0;
轴上二次金叉:=COUNT(CROSS(DIF,DEA) AND DEA>0,20)=2 AND CROSS(DIF,DEA) AND DEA>0;
轴上三次金叉:=COUNT(CROSS(DIF,DEA) AND DEA>0,20)=3 AND CROSS(DIF,DEA) AND DEA>0;
NOTEXT1:DIF,COLORCCFFFF;
NOTEXT2:DEA,COLOR58FF58;
DRAWTEXT_FIX(ISLASTBAR AND 金叉 AND NOT(轴下金叉) AND NOT(轴上金叉) AND NOT(轴上二次金叉),0.6,0,0,"金叉--属强势信号"),COLORYELLOW;
DRAWTEXT_FIX(ISLASTBAR AND 轴下金叉,0.6,0,0,"DEA和DIF在0轴下金叉"),COLORYELLOW;
DRAWTEXT_FIX(ISLASTBAR AND 轴下死叉,0.6,0,0,"DEA和DIF在0轴下死叉"),COLORYELLOW;


股票公式栏目导航

精品指标推荐

最新热门

本类随机推荐

相关公式