r:=((ZDMR[-1]+BDMR[-1])-(ZDMC[-1]+BDMC[-1]))/SHGZG*100;
红柱:IF(r<0,0,r),colorred,LINETHICK2;
绿柱:IF(r>0,0,r),colorgreen,LINETHICK3;
r0:=((IF(ISNULL(ZDMR[-1]),0,ZDMR)+IF(ISNULL(BDMR[-1]),0,BDMR))
-(IF(ISNULL(ZDMC[-1]),0,ZDMC)+IF(ISNULL(BDMC[-1]),0,BDMC)))
/SHGZG*100;
MA1:r,NODRAW;
MA5:MA(r0,5),NODRAW;
VAR1:MA5;
MA10:MA(r0,10),NODRAW;
MA20:MA(r0,20),NODRAW;
买入:IF(MA5>0.01 AND MA5>MA10 AND MA10>MA20 ,VAR1,DRAWNULL),coloryellow,LINETHICK3;
卖出:IF(MA5<=0.01 AND MA5<MA10 OR MA1<0,VAR1,DRAWNULL),colorblack,LINETHICK3;
RETURN r0;