通达信股市一根筋指标公式的优化
DRAWTEXT_FIX(ISLASTBAR,0,0,0,'滔滔江水,吾只独饮一瓢亦!'),COLORYELLOW;
{高抛低吸}
A:=(L+H+C*2)/4;
MA5:=EMA(A,5),COLORWHITE,LINETHICK1,DOTLINE;
MA10:EMA(A,10),COLORBLUE,LINETHICK1,DOTLINE;
MA20:MA(CLOSE,20),COLORMAGENTA,LINETHICK1,DOTLINE;
A2:=EMA(A,20),COLORLIBLUE,LINETHICK1;
A1X:=(MA5-REF(MA5,1))/REF(MA5,1)*100,NODRAW;
A2X:=(A2-REF(A2,1))/REF(A2,1)*100,NODRAW;
IF(MA20/REF(MA20,1)>=1,MA20,DRAWNULL),COLOR008888,LINETHICK1;
IF(MA20/REF(MA20,1)<1,MA20,DRAWNULL),COLORFF9150,LINETHICK1,DOTLINE;
买入持股:IF(A1X>=0,MA10,DRAWNULL),COLORRED,LINETHICK1;
卖出空仓:IF(A1X<0 AND A2X<0,MA10,DRAWNULL),COLORGREEN,LINETHICK1,DOTLINE;
看多:=IF(A1X>=0 AND BARSLAST(CROSS(A1X,0))>0,REF((C+O)/2,BARSLAST(CROSS(A1X,0))),DRAWNULL),COLORMAGENTA,LINETHICK1,DOTLINE;
逃顶:=IF(A1X<0 AND BARSLAST(CROSS(0,A1X))>0,REF((C+O)/2,BARSLAST(CROSS(0,A1X))),DRAWNULL),COLORBLUE,LINETHICK1,DOTLINE;
{DRAWTEXT(CURRBARSCOUNT=1,MA5,'__5日均线'),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=1,MA13,'__13日均线'),COLORBLUE;
DRAWTEXT(CURRBARSCOUNT=1,MA24,'__24日均线'),COLORGREEN;}
DRAWICON(CROSS(MA10,MA20),MA10,23);
DRAWICON((A1X>=0 && REF(A1X,1)<0),MA10,16);{首发}
DRAWICON((A2X>=0 && REF(A2X,1)<0),MA20,17);{二发}
DRAWTEXT(CROSS(MA10,MA20),MA10,'__金叉'),COLORMAGENTA;
DRAWICON((A1X<0 && REF(A1X,1)>=0),MA10,2);