MID:MA(CLOSE,21),COLORWHITE;
UPPER:MID + 1.96*STD(CLOSE,21),COLORYELLOW;
LOWER:MID - 1.96*STD(CLOSE,21),COLORYELLOW;
UP:MID + 2.58*STD(CLOSE,21),COLORFF00FF;
LOOW:MID - 2.58*STD(CLOSE,21),COLORFF00FF;
{需要编写选股公式关注公众号:程序化指标}
单边上升:=(C>MID);
单边下降:=(C<MID);
布林线开口:=UP-LOOW;
多头行情:=C>MA(C,5) AND MA(C,5)>MA(C,10);
股价在高位:=((C-LLV(C,30))/(HHV(C,30)-LLV(C,30))>0.6);
股价在低位:=((C-LLV(C,30))/(HHV(C,30)-LLV(C,30))<0.4);
布林线缩口:=((UPPER-MID)/MID<0.05);
STICKLINE(单边上升,MID,UP,6,0),COLOR330066;
STICKLINE(单边下降,LOOW,MID,6,0),COLOR545454;
DRAWTEXT(布林线缩口,MID,'▲'),COLORWHITE;
STICKLINE((OPEN >= CLOSE),OPEN,CLOSE,3,0),COLORCYAN;
STICKLINE((OPEN >= CLOSE),HIGH,LOW,0,0),COLORCYAN;
STICKLINE((OPEN < CLOSE),OPEN,CLOSE,3,0),COLORRED;
STICKLINE((OPEN < CLOSE),HIGH,LOW,0,0),COLORRED;
MID,COLORWHITE;
UPPER,COLORYELLOW;
LOWER,COLORYELLOW;
UP,COLORFF00FF;
LOOW,COLORFF00FF;
DRAWTEXT(单边上升 AND REF(C,1)>REF(UP,1) AND C < UP ,UP*1.08,'减仓'),COLOR00FF00;
DRAWTEXT(REF(布林线开口,1)=HHV(布林线开口,20) AND 单边上升,UP*1.08,'卖出'),COLORWHITE;
空仓:=(CROSS(MID,AMOUNT/V/100));
DRAWTEXT(空仓,UP*1.05,'空仓'),COLORYELLOW;
DRAWTEXT(BARSLAST(布林线缩口)=1 AND C<MA(C,10),UP*1.08,'一轮跌势起'),COLOR00FF00;
适当建仓:=(单边上升 AND FILTER(多头行情,20) AND V>MA(V,3));
DRAWTEXT(适当建仓,LOOW,'适当建仓'),COLORRED;
加仓:=(单边上升 AND REF(C-MID,1)=LLV(C-MID,5));
DRAWTEXT(加仓 AND BARSLAST(适当建仓)<BARSLAST(空仓),LOOW,'加仓'),COLORFF00FF;
一波行情起:=(BARSLAST(布林线缩口)<=3 AND V>MA(V,3) AND 股价在低位 AND C>REF(C,1) AND C>MA(C,10));
DRAWTEXT(FILTER(一波行情起,5),LOWER,'一波行情起'),COLORRED;
一波跌势完:=(单边下降 AND BARSLAST(REF(布林线开口,1)=HHV(布林线开口,50))<=5 AND LOOW>REF(LOOW,1) AND C <MID) AND 股价在低位;
DRAWTEXT(FILTER(一波跌势完,5),LOWER,'抢反弹');