SHORT:=26;LONG:=12;M:=9;
DIF:=((EMA(CLOSE,SHORT)-EMA(CLOSE,LONG)))*-1;
DEA:=EMA(DIF,M);
MACD:=2*(DIF-DEA);
A4:=BARSLAST(REF(CROSS(DIF,DEA),1));
{爱约股-股票公式网站 }
B1:=REF(C,A4+1)>C AND REF(DIF,A4+1)<DIF AND CROSS(DIF,DEA);
DRAWTEXT(FILTER(B1>0,5),DIF+0.2,'背离'),COLORYELLOW;
操盘:STICKLINE(MACD>=0 AND MACD>=REF(MACD,1),0,MACD,4,1),COLORRED{COLOR6058FF};
减仓:STICKLINE(MACD>=0 AND MACD< REF(MACD,1),0,MACD,4,0),COLORRED{COLOR6058FF};
反弹:STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,4,1),COLORYELLOW{COLORFFFF00};
寻底:STICKLINE(MACD<0 AND MACD< REF(MACD,1),0,MACD,4,0),COLORFFFF00;
空仓:0,COLORWHITE;
IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;
IF(DIF<0,0,DIF),COLORRED,LINETHICK2;
IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;
IF(DIF>DEA,DEA,DEA),COLORGREEN{COLORFF00FF},LINETHICK2;