分享

通达信主图指标《压力支撑红绿灯》+红绿灯 副图

 星影相随 2017-09-20

 

经过本人整理组合该指标,希望能给你带来收益。
公式源码:
{压力支撑红绿灯 主图}
{进 出}
A0:=(L+H+C*2)/4;
A1:=EMA(A0,3),COLORYELLOW,LINETHICK2,NODRAW;
A2:=EMA(A0,7),COLORLIBLUE,LINETHICK2;
A1X:=(A1-REF(A1,1))/REF(A1,1)*100,NODRAW;
A2X:=(A2-REF(A2,1))/REF(A2,1)*100,NODRAW;
买进:IF(A2X>=0,REF(EMA(C,7),BARSLAST(CROSS(A2X,0))+1),DRAWNULL),COLORRED,POINTDOT,LINETHICK6;
逃顶:IF(A1X<0,REF(EMA(C,3),BARSLAST(CROSS(0,A1X))+1),DRAWNULL),COLORGREEN,POINTDOT,LINETHICK6;
{看多 看空}
A11:=EMA(A0,3),COLORBLUE;
A12:=EMA(A0,7),COLORLIBLUE;
A11X:=(A11-REF(A11,1))/REF(A11,1)*100,NODRAW;
A12X:=(A12-REF(A12,1))/REF(A12,1)*100,NODRAW;
看多:IF(A11X>=0 AND BARSLAST(CROSS(A11X,0))>0,REF((C+O)/2,BARSLAST(CROSS(A11X,0))),DRAWNULL),COLORMAGENTA;
看空:IF(A11X<0 AND BARSLAST(CROSS(0,A11X))>0,REF((C+O)/2,BARSLAST(CROSS(0,A11X))),DRAWNULL),COLORCYAN;
{支撑 压力 蓝柱出 }
A3:=EMA(C,6),COLORWHITE,LINETHICK1;
A3X:=(A3-REF(A3,1))/REF(A3,1)*100,NODRAW;
支撑位:IF(A3X>=0,REF(EMA(C,11),BARSLAST(CROSS(A3X,0))+1),DRAWNULL),COLORRED;
压力位:IF(A3X<0,REF(EMA(C,11),BARSLAST(CROSS(0,A3X))+1),DRAWNULL),COLORGREEN;
STICKLINE(CROSS(A3X,0),C,O,1.5,0),COLORYELLOW;
STICKLINE(CROSS(0,A3X),C,O,1.5,0),COLORBLUE;
{}
买入:IF(A1X>=0,A1,DRAWNULL),COLORRED,NODRAW;
卖出:IF(A1X<0 AND A2X<0,A1,DRAWNULL),COLORGREEN,NODRAW;
STICKLINE(CROSS(A1X,0),C,O,1.5,0),COLORRED;
STICKLINE(CROSS(0,A1X),C,O,0.5,0),COLORLIBLUE;
{STICKLINE(CROSS(A1X,0)OR  CROSS(0,A1X),REF(EMA(C,14),1),REF(EMA(C,14),1)*0.996,2,0),COLORWHITE;
STICKLINE(ISLASTBAR,REF(EMA(C,4),1),REF(EMA(C,4),1)*0.996,3,0),COLORLIMAGENTA;}
{分界线}
T1B:=CONST(LLVBARS(LOW,10));
T1HIGH:=CONST(REF(HIGH,T1B));
CCC:=CONST(CURRBARSCOUNT);
T2B:=CONST(BARSLAST(CURRBARSCOUNT>CCC+T1B AND H>T1HIGH));
T2HIGH:=CONST(REF(HIGH,T2B));
T3B:=CONST(BARSLAST(CURRBARSCOUNT>CCC+T2B AND HIGH>T2HIGH));
T3HIGH:=CONST(REF(HIGH,T3B));
过线:DRAWLINE(CURRBARSCOUNT=T3B+1, T3HIGH, ISLASTBAR, T3HIGH, 1),COLORYELLOW,DOTLINE;
DRAWTEXT(ISLASTBAR, T3HIGH,'    过去线'),LINETHICK1,COLORYELLOW;
过线1:=T3HIGH,NODRAW,COLORYELLOW;

N1:=10;
TK:=CONST(HHVBARS(V,10)),COLOR0000FF,LINETHICK1;
量能平台:IF(CURRBARSCOUNT<=N1+0,CONST(IF(TK=0,C,REF(C,TK))),DRAWNULL),COLORGRAY,LINETHICK1;
NOTEXT_新量能点:IF(CURRBARSCOUNT=TK+1,量能平台,DRAWNULL),CIRCLEDOT,COLORFFFFFF,LINETHICK5;
DRAWTEXT(ISLASTBAR,量能平台,'   量能平台'),COLORGRAY;

{突破线}
STICKLINE(ISLASTBAR,REF(EMA(C,14),1),REF(EMA(C,14),1),50,0),COLORWHITE;
DRAWTEXT(ISLASTBAR,REF(EMA(C,14),0),'  突破线'),COLORWHITE;
{前高 前低}
{VAR31:=BACKSET(REF(HIGH,2)=HHV(HIGH,5),3);
VAR41:=CROSS(VAR31,0.9);
VAR51:=BACKSET(REF(LOW,2)=LLV(LOW,5),3);
VAR61:=CROSS(VAR51,0.1);
前高:REF(HIGH,BARSLAST(VAR41)),NODRAW,COLORYELLOW;
STICKLINE(C,REF(HIGH,BARSLAST(VAR41)),REF(HIGH,BARSLAST(VAR41)),2,1),COLOR00FFFF;
前低:REF(LOW,BARSLAST(VAR61)),NODRAW,COLORLIGRAY;
STICKLINE(C,REF(LOW,BARSLAST(VAR61)),REF(LOW,BARSLAST(VAR61)),2,1),COLORLIGRAY;
近日高:=HHV(H,5),NODRAW,COLORLIGREEN;
STICKLINE(ISLASTBAR,HHV(H,5),HHV(H,5),40,-1),COLORLIGREEN;
近日低:=HHV(L,5),NODRAW,COLORLICYAN;
STICKLINE(ISLASTBAR,LLV(L,5),LLV(L,5),30,-1),COLORLICYAN;}
{MA3 5 7 13 止损 休息}
趋势线:=EMA(C,3);
生命线:=EMA(C,7);
工作线:=EMA(C,5);
止损线:=EMA(C,13);
DRAWBAND(趋势线-0.001,RGB(150,10,10),工作线+0.001,RGB(240,255,255));
B11:=EMA(C,11);
趋势:IF(C>=趋势线 AND EMA(C,3)>=EMA(C,5),趋势线,DRAWNULL),COLOR000099,LINETHICK1;
生命:IF(C>=生命线 AND EMA(C,7)>=EMA(C,11),生命线,DRAWNULL),COLORFF7F00;
工作:IF(C>=工作线 AND EMA(C,5)>=EMA(C,7),工作线,DRAWNULL),COLOR663399,LINETHICK1;
止损:IF(C>=止损线 AND EMA(C,11)>=EMA(C,14),止损线,DRAWNULL),COLORYELLOW;
准备区:IF(C>=工作线 AND EMA(C,14)<EMA(C,25),工作线,DRAWNULL), COLORMAGENTA;
休息:IF(C<B11,B11,DRAWNULL),LINETHICK1,COLORGREEN;
DRAWICON((ZIG(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2)) AND (REF(ZIG(3,5),2)<=REF(ZIG(3,5),3)),LOW*0.992,1);
DRAWICON((ZIG(3,5)<REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)>=REF(ZIG(3,5),2)) AND (REF(ZIG(3,5),2)>=REF(ZIG(3,5),3)),HIGH*1.006,2);
{倍量 启动}
V2:=IF(CURRBARSCOUNT=1,VOL*240/FROMOPEN/REF(VOL,1)-1,VOL/REF(VOL,1)-1);
STICKLINE(V2>=1,O,C,1.5,0),COLORYELLOW;
MA13:=MA(CLOSE,13);
X1:=(C+L+H)/3;
BB13:=ATAN(EMA(X1,13)-REF(EMA(X1,13),1))*3.1416*10;
EMA8:=EMA(C,8);
B0:=MIN(O,C);
B1:=ABS(O-C);
T1:=FILTER(BB13>1 AND EMA(X1,13)>REF(EMA(X1,8),1),10);
STICKLINE(T1,B0,B0+B1/4,1,0),COLOR007575;
STICKLINE(T1,B0+B1/4,B0+B1/2,1,0),COLORFF0000;
STICKLINE(T1,B0+B1/2,B0+B1*3/4,1,0),COLOR007575;
STICKLINE(T1,B0+B1*3/4,B0+B1,1,0),COLORFF0000;

{黑柱出逃}
LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
STICKLINE(CROSS(FF,MA15),B0,B0+B1/2,1,0),COLOR7F017F;
STICKLINE(CROSS(88,RSI),B0+B1,B0+B1/2,1.5,0),COLORBLACK;
T2:=COUNT(CROSS(BBI,3),3)=1 AND CROSS(C,BBI);
DRAWTEXT(T2,H*1.05,'反转'),COLORWHITE;
STICKLINE(T2,O,C,1,0),COLORRED;
{涨 跌 震幅%线 };
T12:=V2>=1;
T0:=BARSLAST(T12);
L1:=REF(L,T0);
H1:=REF(H,T0);
STICKLINE(REF(T12,1) OR REF(T12,2) OR REF(T12,3),H1,H1,3,-1),COLORWHITE;
STICKLINE(REF(T12,1) OR REF(T12,2) OR REF(T12,3),L1,L1,3,-1),COLORWHITE;
T13:=REF(T12,3) AND COUNT(L<L1,4)=0 AND COUNT(L>H1,4)>1;
L11:=MIN(REF(L,1),L);
L10:=MIN(L11,REF(L,2));
L21:=MAX(REF(L,1),L);
L20:=MAX(L21,REF(L,2));
T111:=(REF(V2>=1,3) OR REF(V2>=1,2) OR REF(V2>=1,1)) AND
((L10>L1 AND L20>H1) OR (L11>L1 AND L21>H1));
T11:=T111 AND REF(T111,1)=0;
STICKLINE(T11,O,C,1,0),COLORFF00FF;
STICKLINE(T1,B0,B0+B1/2,1,0),COLOR007575;
STICKLINE(T1,B0+B1/2,B0+B1,1,0),COLORBLUE;
STICKLINE(T11 AND T12,B0,B0+B1/2,1,0),COLORFF00FF;
STICKLINE(T11 AND T12,B0+B1/2,B0+B1,2,0),COLORYELLOW;
STICKLINE(T1 AND T12,B0+B1/3,B0+B1,2,0),COLORYELLOW;
STICKLINE(T1 AND T12,B0,B0+B1/3,1,0),COLOR007575;
STICKLINE(T1 AND T12,B0+B1/3,B0+B1*2/3,1,0),COLORBLUE;
{STICKLINE(T2 AND T12,B0+B1/2,B0+B1,1,0),COLORRED;};
STICKLINE(T2 AND T12,B0,B0+B1/2,1,0),COLORYELLOW;

C2:=REF(C,1);
非ST涨停:=IF((C-C2)*100/C2>=(10-0.01*100/C2),1,0);
涨停:=非ST涨停;
NUMBER:=COUNT(非ST涨停,BARSSINCE(非ST涨停)+1);
DRAWNUMBER(非ST涨停,HIGH*1.04,NUMBER),COLORWHITE;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.10,0.02,0,NUMBER),COLORWHITE;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.02,0.02,0,'上市以来共涨停'),COLORYELLOW;
 

 
​{红绿灯 副图}
DRAWTEXT_FIX(ISLASTBAR=1,0.01,0.75,0,STKNAME),COLORWHITE;
DRAWTEXT_FIX(ISLASTBAR=1,0.06,0.75,0,CODE),COLORYELLOW;
SBL:= STRCAT(STRCAT(STRCAT(HYBLOCK, DYBLOCK),GNBLOCK),ZDBLOCK);
DRAWTEXT_FIX(1,0.01,0,0, SBL),COLORLIGRAY;
{主力活跃度}
TMP:=LARGEINTRDVOL-LARGEOUTTRDVOL;
主力活跃度SUPH:(LARGEINTRDVOL+LARGEOUTTRDVOL)*10000/(2*FINANCE(7)),NODRAW,COLORLIRED;
STICKLINE(TMP>0,1,1.5,2.5,0),COLORLIRED;
STICKLINE(TMP<0,1,1.5,2.5,0),COLORLIGREEN;
DRAWTEXT(TMP>0,1.25,'  SUPH'),COLORLIRED;
DRAWTEXT(TMP<0,1.25,'  SUPH'),COLORLIGREEN;
大单动向:=(LARGEINTRDVOL-LARGEOUTTRDVOL)*10000/FINANCE(7),NODRAW,COLORMAGENTA;
大单动向DDX:(LARGEINTRDVOL-LARGEOUTTRDVOL)*10000/FINANCE(7),NODRAW,COLORMAGENTA;
NOTEXT1:=MA(大单动向,10)*3;
STICKLINE(大单动向>0,1.5,2,1.7,0),COLORMAGENTA;
STICKLINE(大单动向<0,1.5,2,1.7,0),COLORLICYAN;
DRAWTEXT(大单动向>0,1.75,'  DDX'),COLORMAGENTA;
DRAWTEXT(大单动向<0,1.75,'  DDX'),COLORLICYAN;
{资金流向}
超B:=L2_AMO(0,2)/10000.0;
大B:=L2_AMO(1,2)/10000.0;
中B:=L2_AMO(2,2)/10000.0;
小B:=L2_AMO(3,2)/10000.0;
超S:=L2_AMO(0,3)/10000.0;
大S:=L2_AMO(1,3)/10000.0;
中S:=L2_AMO(2,3)/10000.0;
小S:=L2_AMO(3,3)/10000.0;
资金流向:=(超B+大B+中B+小B)-(超S+大S+中S+小S),NODRAW,COLORRED;
资金流向ZJLX:(超B+大B+中B+小B)-(超S+大S+中S+小S),NODRAW,COLORRED;
STICKLINE(资金流向>0,2,2.5,1.4,0),COLORRED;
STICKLINE(资金流向<0,2,2.5,1.4,0),COLORLIBLUE;
DRAWTEXT(资金流向<0,2.25,'  ZJLX'),COLORRED;
DRAWTEXT(资金流向<0,2.25,'  ZJLX'),COLORLIBLUE;
{涨跌动因}
涨跌动因:=IF(TRADENUM>0,(TRADEOUTNUM-TRADEINNUM)*100/TRADENUM,0),NODRAW,COLORGREEN;
涨跌动因DDY:IF(TRADENUM>0,(TRADEOUTNUM-TRADEINNUM)*100/TRADENUM,0),NODRAW,COLORGREEN;
NOTEXT2:=MA(涨跌动因,10)*3;
STICKLINE(涨跌动因>0,2.5,3,0.5,0),COLORRED;
STICKLINE(涨跌动因<0,2.5,3,0.5,0),COLORGREEN;
DRAWTEXT(涨跌动因>0,2.75,'  DDY'),COLORRED;
DRAWTEXT(涨跌动因<0,2.75,'  DDY'),COLORGREEN;
{红绿灯 }
DIFF:=(EMA(C,3)-EMA(C,26))*10,COLORRED,NODRAW;
红灯:IF(DIFF>=REF(DIFF,1),2,DRAWNULL),COLORRED,LINETHICK7;
{IF(DIFF>=REF(DIFF,1),2,DRAWNULL),COLOR000055,LINETHICK8;
IF(DIFF>=REF(DIFF,1),2,DRAWNULL),COLOR0000DD,LINETHICK5;
IF(DIFF>=REF(DIFF,1),2,DRAWNULL),COLOR0000FF,LINETHICK2;}
绿灯:IF(DIFF<REF(DIFF,1),2,DRAWNULL),COLOR00FF00,LINETHICK7;
{IF(DIFF<=REF(DIFF,1),2,DRAWNULL),COLOR00BB00,LINETHICK6;
IF(DIFF<=REF(DIFF,1),2,DRAWNULL),COLOR00DD00,LINETHICK4;
IF(DIFF<=REF(DIFF,1),2,DRAWNULL),COLOR00FF00,LINETHICK2;}
{红球进,有ZIG}
DRAWICON(CROSS(ZIG(3,10) ,REF(ZIG(3 ,10),1)),2,34);
{绿球出,有ZIG}
DRAWICON(CROSS(REF(ZIG(3,10),1),ZIG(3,10)),2,35);
VAR1:=LLV(LOW,10);
VAR2:=HHV(HIGH,25);
趋势线:EMA((CLOSE-VAR1)/(VAR2-VAR1)*4,9),COLORYELLOW;
IF(趋势线>REF(趋势线,1),趋势线,DRAWNULL),COLORRED;
IF(趋势线=REF(趋势线,1),趋势线,DRAWNULL),COLORYELLOW;
IF(趋势线<REF(趋势线,1),趋势线,DRAWNULL),COLORLIGREEN;
短底:IF(TROUGHBARS(2,5,1)=1 AND HIGH>LOW+0,1.5,0.9),COLORLIRED;
大顶:IF(PEAKBARS(1,6,1)<1,2.6,3.2),COLORGREEN;
 

 

 


​ 


 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约