N:=1.5;
M:=3;
P:=64;
DIFF:=EMA((EMA(CLOSE,N*12)-EMA(CLOSE,N*26))/EMA(CLOSE,N*26)*1000,M);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
MACDX:=MACD;
MACD=EMA(MACD,5),COLORFF77FF;
DIFFO:=EMA(DEA,P)*1.8;
B:=MACD-REF(MACD,1);
MACD>0 AND B>0;
发现机构入场:DIFF>=REF(DIFF,1) AND DEA<REF(DEA,1),COLORWHITE;
短线出局:DIFF<REF(DIFF,1) AND DEA>REF(DEA,1),COLORGREEN;
STICKLINE(MACD>0 AND B<0,0,MACD,0,0),COLOR0000CD;
STICKLINE(MACD<0 AND B>0,0,MACD,0,1),COLORCYAN;
STICKLINE(MACD<0 AND B<0,0,MACD,0,0),COLORCYAN;
STICKLINE(DIFF>DEA,DIFF,DEA,12,0),COLOR0089FF;
STICKLINE(DIFF<DEA,DIFF,DEA,12,0),COLORBLUE;
PARTLINE(DIFF,DIFF>=REF(DIFF,1) AND DEA<REF(DEA,1),RGB(250,255,250)),LINETHICK5;
PARTLINE(DIFF,DIFF<REF(DIFF,1) AND DEA>REF(DEA,1),RGB(0,255,0)),LINETHICK5;
PARTLINE(DIFF,DIFF>=REF(DIFF,1) AND DEA>REF(DEA,1),RGB(169,169,169));
PARTLINE(DIFF,DIFF<REF(DIFF,1) AND DEA<REF(DEA,1),RGB(255,0,215));
PARTLINE(DIFFO,DIFFO>=ref(DIFFO,1),RGB(255,0,0));
PARTLINE(DIFFO,DIFFO=ref(DIFFO,1),RGB(0,255,0));
PARTLINE(DIFFO,DIFFO<ref(DIFFO,1),RGB(0,255,250));
DRAWTEXTABS(3 ,5 ,'操作:蓝转白试买;见橙加仓;维持橙持股,' ),COLOR00FFFF,LINETHICK2;
DRAWTEXTABS(3 ,28 ,'橙转绿减仓;蓝色空仓,' ),COLOR00FFFF,LINETHICK2;
ma1:=ma(c,4);
ma2:=ma(c,10);
ma3:=ma(c,17);
aa:=ma1>ma2 and ma3>ref(ma3,1);
可入:=cross(DIFF,DEA)and aa;
DRAWTEXT(FILTER(可入,20),25,'可入'),COLORCYAN ;
STICKLINE(FILTER(可入=1,20) ,50,0,15,0),colorf00ff0;