操盘线:=20;
MID:=ma(C,操盘线);
VART1:=POW((C-MID),2);
VART2:=MA(VART1,操盘线);
VART3:=SQRT(VART2);
UPPER:=MID+2*VART3;
LOWER:=MID-2*VART3;
主力操盘线:REF(MID,1),COLORFFFFFF;
涨:IF(主力操盘线>REF(主力操盘线,1),主力操盘线,DRAWNULL),COLORRED,LINETHICK2;
跌:IF(主力操盘线<REF(主力操盘线,1),主力操盘线,DRAWNULL),COLORGREEN,LINETHICK2;
DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);
DEA:=EMA(DIFF,9);
A1:=BArslAst(REF(crOSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
DRAWTEXT (底背离,主力操盘线+30,'底背离15MIN》6小时'),COLORRED;
DRAWTEXT (底背离,主力操盘线+20,'底背离30MIN》12小时'),COLORRED;
DRAWTEXT (底背离,主力操盘线+10,'底背离60MIN》24小时'),COLORRED;
DRAWTEXT (底背离,主力操盘线-20,'底背离1DAY》96小时'),COLORRED;
STICKLINE(底背离,主力操盘线+20,主力操盘线-20,3,1),COLORRED;
卖出预警:=IF(CROSS(MA(C,5),C)AND C<=REF(C,1) AND (C-REF(C,1))/REF(C,1)*100<-3.2,1,0);
DRAWTEXT(卖出预警,主力操盘线,'清仓!!'),COLORGREEN;
STICKLINE( 卖出预警,主力操盘线+20,主力操盘线-20,3,1),COLORGREEN;