dif:=Ema(CLOSE,12)-ema(CLOSE,26);
DEA:=EMA(DIF,9);
MacD0:=(DIF-DEA)*2;
MJ:=macd0;
S05:=SUM(MJ,0);
QST:=BArslAST(MJ<0 AND REF(MJ,1)>0)+1;
QXT:=BARSLAST(MJ>0 AND REF(MJ,1)<0)+1;
S5:=IF(MJ>0,S05-REF(S05,BARSLAST(MJ<0)),S05-REF(S05,BARSLAST(MJ>0)))/10;
ST:=IF(MJ>0,REF(QST,QXT)+QXT,REF(QXT,QST)+QST);
RS5:=REF(S5,ST);
BC:IF(MJ>0 AND S5<RS5,0,IF(MJ<0 AND S5>RS5 AND DEA<0,1,0));
;