SHORT:=5;LONG:=26;M:=4;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
macd : 2*(DIFF-DEA), COLORSTICK;
partline(diff,diff>=ref(diff,1),rgb(255,0,0),diff<ref(diff,1),rgb(0,255,0)),linethick2;
partline(DEA,DEA>=ref(DEA,1),rgb(255,180,0),DEA<ref(DEA,1),rgb(0,0,255)),linethick1;
DRAWTEXTAbs(3,1,'DIFF翻红,结合增仓及均线多头抓主升。'),linethick1,Colorred;
DRAWTEXTABS(220,1,'DIFF泛绿时持币,宁缺毋滥。'),linethick1,Color00ff00;
0;
aa:= DIFF;
bb:= EMA(aa,M);
STICKLINE((aa>0.5 or bb>0.5),0.9,1,10,0),coloraa22aa;
STICKLINE((aa<-0.5 or bb<-0.5),-0.9,-1,10,0),color22aa22;
STICKLINE((aa>1.5 or bb>1.5),1.9,2,10,0),coloraa22aa;
STICKLINE((aa<-1.5 or bb<-1.5),-1.9,-2,10,0),color22aa22;
STICKLINE((aa>2.5 or bb>2.5),2.9,3,10,0),coloraa22aa;
STICKLINE((aa<-2.5 or bb<-2.5),-2.9,-3,10,0),color22aa22;
STICKLINE((aa>3.5 or bb>3.5),3.9,4,10,0),coloraa22aa;
STICKLINE((aa<-3.5 or bb<-3.5),-3.9,-4,10,0),color22aa22;
STICKLINE((aa>4.5 or bb>4.5),4.9,5,10,0),coloraa22aa;
STICKLINE((aa<-4.5 or bb<-4.5),-4.9,-5,10,0),color22aa22;
FILLRGN(aa,bb,aa>bb,RGB(105,0,105),aa<bb,RGB(0,105,0)),PRECIS0,LAYER6;