通达信突出实用性的《多空止损止盈》主图指标 源码
《多空止损止盈》主图指标源码;
{买价:1 99 8.6 止损系数: 0.01 1 0.95 止赢系数:1 2 1.1}
多头:(SUM(((2*CLOSE+OPEN+HIGH+LOW)/5)*(VOL),8))/(SUM(VOL,8)),COLOR00FFFF,LINETHICK0;
空头:LLV(多头,8),LINETHICK0,COLORFFFF00;
DKT:=多头
DRAWBAND(多头,RGB(0,160,150),空头,RGB(0,0,0));
DRAWKLINE(H,O,L,C);
DRAWICON(REF(多头,1)=REF(空头,1) AND 多头 空头,LOW*0.98,13);
DRAWTEXT(REF(多头,1)=REF(空头,1) AND 多头 空头,LOW*0.97,'*关注'),COLORRED;
C11:=C =多头 AND 多头 REF(多头,1);
C21:=C
AA:=C11 =C21 ;
BB:=C21 C11 ;
STICKLINE(AA,C,O,3.4,0),COLORAA00AA;
STICKLINE(AA,C,O,3.0,0),COLORBB00BB ;
STICKLINE(AA,C,O,2.4,0),COLORCC00CC;
STICKLINE(AA,C,O,2.0,0),COLORDD00DD ;
STICKLINE(AA,C,O,1.6,0),COLOREE00EE;
STICKLINE(AA,C,O,1.2,0),COLORFF00FF;
STICKLINE(AA,C,O,0.6,0),COLORFF00FF;
STICKLINE(AA,H,L,0,0),COLORFF00FF;
STICKLINE(BB,C,O,3.4,0),COLORAAAA00;
STICKLINE(BB,C,O,3.0,0),COLORBBBB00;
STICKLINE(BB,C,O,2.4,0),COLORCCCC00;
STICKLINE(BB,C,O,1.6,0),COLOREEEE00;
STICKLINE(BB,C,O,1.2,0),COLORFFFF00;
STICKLINE(BB,C,O,0.6,0),COLORFFFF00;
STICKLINE(BB,H,L,0,0),COLORFFFF00;
STICKLINE(CURRBARSCOUNT=1,买价*1.0015,买价,100,0),COLOR00FFFF;
止损价:买价*止损系数,COLOR00FFFF,LINETHICK0;
止赢价:买价*止赢系数,COLOR00FF00,LINETHICK0;
STICKLINE(CURRBARSCOUNT=1,止损价*1.0015,止损价,80,0),COLOR0000FF;
STICKLINE(CURRBARSCOUNT=1,止赢价*1.0015,止赢价,80,0),COLORFF00FF;
DRAWTEXT(ISLASTBAR,止损价*1.005,'止损价'),COLOR00FFFF;
DRAWTEXT(ISLASTBAR,止赢价*1.005,'止赢价'),COLOR00FFFF;
DRAWTEXT(ISLASTBAR,买价*1.005,'买入价'), COLORFFFF00;
GJSZ:=(CURRBARSCOUNT=5-4);
DRAWNUMBER(GJSZ AND 止损价,止损价,止损价),COLOR00FFFF;
DRAWNUMBER(GJSZ AND 止赢价,止赢价,止赢价),COLORFFFF00;
DRAWNUMBER(GJSZ AND 买价,买价,买价),COLOR00FFFF;
N2:=5;
A1:=REF(H,N2)=HHV(H,2*N2+1);
B1:=FILTER(A1,N2);
C1:=BACKSET(B1,N2+1);
HD:= FILTER(C1,N2);
RH:=BACKSET(CURRBARSCOUNT=2,BARSLAST(HD)+1);
SH:=RH REF(RH,1);
H1:=REF(H ,BARSLAST(SH));
STICKLINE(H1,H1,H1,5,0),LINETHICK2,COLOR00FFFF;
DRAWTEXT(ISLASTBAR,H1*1.005,'近期高点'),COLORFFFF00;
TTP:=(CURRBARSCOUNT=5-4);
DRAWNUMBER(TTP AND H1,H1,H1),COLORFFFF00;
A2:=REF(L,N2)=LLV(L,2*N2+1);
B2:=FILTER(A2,N2);
C2:=BACKSET(B2,N2+1);
LD:=FILTER(C2,N2);
RL:=BACKSET(CURRBARSCOUNT=2,BARSLAST(LD)+1);
SL:=RL REF(RL,1);
L1:=REF(L ,BARSLAST(SL));
STICKLINE(L1,L1,L1,5,0),COLORFFFF00,LINETHICK5;
DRAWTEXT(ISLASTBAR,L1*1.005,'近期低点'),COLORFFFF00;
DRAWNUMBER(TTP AND L1,L1,L1),COLOR00FFFF;
AHX:=MA(C,3);
BHX:=MA(C,14);
EHX:=(AHX+BHX)/2;
当前价:=C,COLORFFFFFF;
市盈率:=IF(FINANCE(33) 0,DYNAINFO(39),0)*0.35;
每股收益:=IF(FINANCE(33) 0.01,FINANCE(33)*0.65,0);
CKMJ:=每股收益*市盈率*4;
参考买价:STICKLINE(1,CKMJ,CKMJ,2,0),COLORFFFFFF,LINETHICK1;
DRAWICON(EHX CKMJ AND CROSS(当前价,EHX),L*0.98,34);
DRAWICON(EHX CKMJ AND CROSS(当前价,EHX),L*0.98,23);
DRAWTEXT(ISLASTBAR,CKMJ*1.0054,'参考买价'),COLOR00FFFF;
TTP123:=(CURRBARSCOUNT=5-4);
DRAWNUMBER(TTP123 AND CKMJ,CKMJ,CKMJ),COLORFFFF00;
LC5:=REF(CLOSE,1);
RSI5:=SMA(MAX(CLOSE-LC5,0),6,1)/SMA(ABS(CLOSE-LC5),6,1)*100;
R:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
A:=SMA(R,3,1);
B:=SMA(A,3,1);
CCC:=(B/2+40)*1.1;
DA:=SMA(CCC,3,1);
短逃:DRAWICON(CROSS(DA,RSI5),H*1.02,12);
逃顶:DRAWICON(CROSS(80,RSI5),H*1.04,14);
DRAWTEXT(短逃,H*1.03, '短逃'), COLOR00FFFF;
DRAWTEXT(逃顶,H*1.05, '逃顶'), COLOR00FF00;
SJ:=WMA((C-LLV(L,5))/(HHV(H,5)-LLV(L,5))*100,2);
ZJ:=WMA(0.667*REF(SJ,1)+0.333*SJ,2);
DRAWTEXT(CROSS(SJ,ZJ) AND SJ 30,L-0.05,' 低吸'),COLOR00FF99,LINETHICK2;
{DRAWTEXT(CROSS(ZJ,SJ) AND SJ 70,H+0.05,' 高抛'),COLOR00FF00,LINETHICK2;}
DRAWTEXT_FIX(1,0.05,0.0,0,'【操作须知】★★及时调整买价★★
根据自己习惯确定止损系数及止赢系数 ★★ 参考买价线下大胆买★★ '),COLOR00FFFF;