DRAWBAND(MA(CLOSE,60),RGB(55,0,0),MA(CLOSE,120),RGB(0,91,0));{60.120日线暖气带为棕红色}
MA60:=MA(CLOSE,60); {60日线为洋红色}
生命线:MA60,LINETHICK2,COLORMAGENTA; {60日线为洋红色}
MA120:MA(CLOSE,120),LINETHICK2,COLORGREEN; {120日线为绿色}
五日线:=MA(C,5),COLORWHITE;
十日线:=MA(C,10),COLORGREEN;
三多头后挂单:=MA(C,20),LINETHICK2,COLORRED;
DRAWTEXT(MA(C,5)>MA(C,10) AND MA(C,10)>MA(C,20) AND CURRBARSCOUNT=5,MA(C,20)*0.9,'三多头'),COLORRED;
DRAWKLINE(H,O,L,C);{自带函数};
DRAWICON(crOSS(MA60,MA120),MA60,23); {60日上穿120日做记号?}
DRAWICON(CROSS(MA120,MA60),MA60,15),; {60日下穿120日做记号"跑"};
DRAWTEXT(CROSS(MA120,MA60),MA60+0.08,'熊上岗'),COLORGREEN; { '熊上岗' 字体为绿色};
{ _通达信股票指标公式}
W1:=IF(CROSS(MA(C,60),MA(C,120)),1,0);{60上穿120}
W2:=IF(CROSS(MA(C,120),MA(C,60)),1,0);{120下穿60}
STICKLINE(W1,MA(C,60)*1.05,MA(C,60)*0.95,0.01,0),COLORLIRED;
STICKLINE(W2,MA(C,120)*1.05,MA(C,120)*0.95,0.01,0),COLORGREEN;
DRAWTEXT(W1,MA(C,60)*1.05,'稳健才是王道'),COLORRED;
DRAWTEXT(W1,MA(C,60)*0.95,'牛市'),COLORRED;
DRAWTEXT(W2,MA(C,120)*1.05,'熊市'),COLORGREEN;
DRAWTEXT(W2,MA(C,120)*0.95,'贪婪必死'),COLORGREEN;
KK:=MA60<MA120 AND COUNT(MA60>REF(MA60,1),5)=5;
DRAWTEXT(KK AND COUNT(KK,20)=5,REF(MA60,5),'地板'),COLORRED;
STICKLINE(KK AND COUNT(KK,20)=5,REF(MA60,5),REF(MA60,5),10,1),COLORRED;
KK2:=MA60>MA120 AND COUNT(MA60<REF(MA60,1),5)=5;
DRAWTEXT(KK2 AND COUNT(KK2,20)=5,REF(MA60,5),'天灵盖'),COLORRED;
STICKLINE(KK2 AND COUNT(KK2,20)=5,REF(MA60,5),REF(MA60,5),10,1),COLORRED;
TY:=C;
A1:=REF(TY,10)=HHV(TY,2*10+1); {取第11天前的收盘和21天内最高收盘价相等,满足为1,不满足则为0---条件语句,图上均无动作}
B1:=FILTER(A1,10); {如果满足A1,则过滤往后10个周期的信号,如果不满足则不做任何动作-图上有动作}
C1:=BacKSET(B1,10+1); {如果满足B1,则将之前11个周期的信号置为1,即保留之前11个周期的信号不删除,如果不满足则为0-条件语句,图上有动作??}
HD:=FILTER(C1,10); {如果满足C1=1,则过滤往后10个周期的信号,如果不满足则为0条件语句-图上有动作}
MA(C,5),COLORYELLOW,LINETHICK2;
MA(C,5)*0.9,COLORRED,DOTLINE;
前期高位:REF(C,BArslAST(HD)),COLOR00FF00,POINTDOT;{除了今天,从不满足HD开始的收盘价,都用小圆点表示}
STICKLINE(C,前期高位,前期高位,8,0),COLORYELLOW; { STICKLINE 是画柱状线的,这里巧妙的用两个相同的点和,画出了横线,宽度为8,实心线};
CM:=REF(C,1);
涨停:=IF((C-CM)*100/CM>=9.9,1,0);
STICKLINE(涨停,OPEN,CLOSE,3.8,0),COLORMAGENTA; {k线实体部分画洋红色,宽度为2,画实线实心柱}
STICKLINE(涨停,H,L,0,0),COLORLIRED; {K线影线部分画紫红色,宽度为0?,画实线实心柱};
跌停:=IF((C-CM)*100/CM<=-9.9,1,0);
STICKLINE(跌停,OPEN,CLOSE,3.8,0),COLORGREEN; {K线实体部分画绿色,宽度为2,画实线实心柱}
STICKLINE(跌停,H,L,0,0),COLORGREEN;{K线影线部分画绿色,宽度为0?,画实线实心柱};
大盘涨幅:=("999999$C"-LLV("999999$L",40))/LLV("999999$L",40);
DRAWTEXT(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅),' 1倍以下很安全');
DRAWTEXT(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅*2),' 2倍以下高抛低吸');
DRAWTEXT(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅*3),' 3倍以上要抛出');
STICKLINE(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅),LLV(L,40)*(1+大盘涨幅),1,0),LINETHICK8,COLORCYAN;
STICKLINE(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅*2),LLV(L,40)*(1+大盘涨幅*2),1,0),LINETHICK8,COLORCYAN;
STICKLINE(CURRBARSCOUNT<2,LLV(L,40)*(1+大盘涨幅*3),LLV(L,40)*(1+大盘涨幅*3),1,0),LINETHICK8,COLORCYAN;
六天涨幅:=C/REF(C,5)<1.06;
DRAWTEXT(CURRBARSCOUNT=1 AND 六天涨幅,C,'价满足ddx');
DRAWTEXT(CURRBARSCOUNT=1 AND 六天涨幅=0,C,'卖出');