DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
DEA:EMA(DIFF,9);
gspt1:=2*(DIFF-DEA);
gspt2:=CROSS(DIFF,DEA) AND DIFF< -0.1;
gspt3:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
gspt4:=CROSS(DIFF,DEA) AND DEA< 0 AND COUNT(gspt3=2,21)=1;
gspt5:=BARSLAST(REF(CROSS(DIFF,DEA),1));
gspt6:=REF(C,gspt5+1)>C AND DIFF>REF(DIFF,gspt5+1) AND CROSS(DIFF,DEA);
gspt26:=BARSLAST(REF(CROSS(DEA,DIFF),1));
gspt28:=REF(C,gspt26+1)< C AND REF(DIFF,gspt26+1)>DIFF AND CROSS(DEA,DIFF);
STICKLINE(gspt1>=0,gspt1,0,2,1),COLORF00FF0;
STICKLINE(gspt1< 0,gspt1,0,2,1),COLORWHITE;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00AAFF;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00BBFF;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00CCFF;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00DDFF;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00EEFF;
STICKLINE(gspt1< REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR00FFFF;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0000AA;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0011BB;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0022CC;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0033DD;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0044EE;
STICKLINE(gspt1>=REF(gspt1,1)AND gspt1>0,0,gspt1,2,0),COLOR0055FF;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORAA00BB;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORBB11BB;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORCC22BB;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORDD33BB;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLOREE44BB;
STICKLINE(gspt1>REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFF55BB;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFAA00;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFBB11;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFCC22;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFDD33;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFEE44;
STICKLINE(gspt1<=REF(gspt1,1)AND gspt1< 0,0,gspt1,2,0),COLORFFFF55;
IF(DIFF< 0,DIFF,0),COLORRED,LINETHICK1;
IF(DIFF< 0,0,DIFF),COLORYELLOW,LINETHICK1;
IF(DIFF< DEA,DIFF,DEA),COLOR00FF00,LINETHICK1;
IF(DIFF>DEA,DEA,DEA),COLORWHITE,LINETHICK1;
STICKLINE(gspt2,0,-0.18,2,0),COLORYELLOW;
DRAWTEXT(gspt2,-0.1,' 低位金叉'),COLORYELLOW;
DRAWTEXT_FIX(C>O,0,0.2,0,'公式平台 公式源码 http://www.gspt.com'),COLOR333333;
STICKLINE(gspt4,0,-0.18,2,0),COLORFF00FF;
DRAWICON(gspt4,DEA*1.04,13);
DRAWTEXT(gspt4,-0.1,' 二次金叉'),COLORFF00FF;
STICKLINE(gspt6,0,0.13,2,0),COLOR00FF00;
DRAWLINE(gspt5=0,DEA,gspt6,DEA,0),COLORRED,LINETHICK2;
DRAWTEXT(gspt6,0.1,' 底背离'),COLOR00FF00;
DRAWLINE(gspt26=0,DEA,gspt28,DEA,0),COLORGREEN,LINETHICK2;