BIAS20:=(CLOSE-MA(CLOSE,20))/MA(CLOSE,20)*100;
Q7:=(CLOSE-REF(CLOSE,1))/REF(CLOSE,1)*100;
持股天数:=BARSLAST((BARSLAST(BIAS20>0 AND REF(BIAS20,1)>0))>0);
持币天数:=BARSLAST((BARSLAST(BIAS20<0 AND REF(BIAS20,1)<0))>0);
利润:IF(持股天数>0,SUM(Q7,持股天数),0),STICK;
买入:IF(REF(持币天数,1)>0 AND 持币天数=0,5,0),STICK,colorFF00FF;
卖出:IF(REF(持股天数,1)>0 AND 持股天数=0,5,0),STICK,colorFFFF00;
持币:IF(持币天数>0,-5,0),STICK,colorFFFF;
STICKLINE(利润>0,利润,0,5,0),colorFF;
STICKLINE(利润<=0,利润,0,5,0),colorFF00;
STICKLINE(持币天数>0,-5,0,5,0),colorFFFF;
STICKLINE(买入>0,5,0,5,0),colorFF00FF;
STICKLINE(卖出>0,5,0,5,0),colorFFFF00;