MID:=MA(C,20);
VART1:=POW((C-MID),2);
VART2:=MA(VART1,20);
VART3:=SQRT(VART2);
UPPER:=MID+2*VART3;
LOWER:=MID-2*VART3;
BOLL:=REF(MID,1);
UB:=REF(UPPER,1);
LB:=REF(LOWER,1);
买一:=UB>REF(UB,1) AND LB<REF(LB,1) AND CROSS(LB,CLOSE) AND UB-REF(UB,1)>=0.01;
买二:=UB>REF(UB,1) AND LB<REF(LB,1) AND C<LB;
卖一:=UB>REF(UB,1) AND C>UB AND LB>REF(LB,1) AND REF(LB,1)<REF(LB,2);
卖二:=CROSS(UB,C);
{多头买入(买开)} ENTERLONG:买一 OR 买二;
{多头卖出(卖平)} EXITLONG:卖一 OR 卖二;