//摇钱树
//boll上下轨差
a1:=MAX(MIN((((MA(CLOSE,20)+2*STD(CLOSE,20))-(MA(CLOSE,20)-2*STD(CLOSE,20)))/C)*100,100),0);
//a1和昨天的差值
a2:=MAX(MIN((a1-REF(a1,1))*-10,100),0);
//安全线 a1的20均线70%上限30%
a3:=MAX(MIN(MA(a1,20)*0.7,25),0);
//60天内涨停次数
t60:=COUNT(CLOSE/REF(CLOSE,1)>1.095,60);
//今天最高涨幅
toDayH:=(H/REF(C,1)-1)*100;
//5天最低/60最高
s1:=(1-LLV(L,10)/HHV(H,60))*100;
//5日线/10天最低
s2:=(MA(CLOSE,5)/LLV(L,20)-1)*100;
//最低范围 boll差在安全范围 boll必须是变窄 今天涨幅小于6% 近期跌幅大于15% 下跌后涨幅小于10%
x1:=a1<=a3 AND a2>0 AND toDayH<6 AND s1>15 AND s2<10;
STICKLINE(x1 AND s1>25 AND HHV(a2,2)>=35,100,0,10,0),coloryellow;
STICKLINE(x1 AND s1>25 AND t60>=0 AND a1<=22 AND HHV(a2,2)>=40,70,0,10,0),colorred;
STICKLINE(x1 AND s1>25 AND t60>=3 AND a1<=18 AND HHV(a2,2)>=40,85,0,10,0),colorred;
STICKLINE(x1 AND s1>25 AND t60>=3 AND a1<=15 AND a2>=40,100,0,10,0),colorred;
STICKLINE(x1,20,0,10,0),colorred;
P100:100,LINETHICK2,colorred;
风险系数:a1,LINETHICK2,colorgreen;
安全线:a3,LINETHICK2,coloryellow;