以下是通达信磊哥炒股票综合指标源码,实战系列一。后续陆续发布
通达信磊哥炒股票综合指标源码,实战系列一。后续陆续发布
源码
LC:=REF(CLOSE,1);
RSI6:SMA(MAX(CLOSE-LC,0),4,1)/SMA(ABS(CLOSE-LC),4,1)*100;
MA6 :MA(RSI6,4),COLORGREEN;
IF(MA6>REF(MA6,1) OR RSI6>MA6,MA6,DRAWNULL),COLORRED;
DRAWTEXT(ISLASTBAR,20,'高安全区'),COLORRED;
DRAWTEXT(ISLASTBAR,50,'安 全 区'),COLORLIMAGENTA;
DRAWTEXT(ISLASTBAR,80,'风 险 区'),COLORBLUE;
OBV:=RSI6;
P:=12;
A1:=REF(OBV,P)=HHV(OBV,2*P+1);
B1:=FILTER(A1,P);
C1:=BACKSET(B1,P+1);
D1:=FILTER(C1,P);{高点1}
R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1); S11:=R11>REF(R11,1);
DRAWLINE(D1,OBV,S11,OBV,1),COLORLIRED,LINETHICK2;
A2:=REF(OBV,P)=LLV(OBV,2*P+1);
B2:=FILTER(A2,P);
C2:=BACKSET(B2,P+1);
D2:=FILTER(C2,P);{低点1}
T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1); U11:=T11>REF(T11,1);
DRAWLINE(D2,OBV,U11,OBV,1),COLORLIBLUE;
Q1:=INTPART(3*8/18);
A12:=REF(OBV,Q1)=HHV(OBV,2*Q1+1);
B12:=FILTER(A12,Q1);
C12:=BACKSET(B12,Q1+1);
D12:=FILTER(C12,Q1);{高点2}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1); S112:=R112>REF(R112,1);
DRAWLINE(S11,OBV,S112,OBV,1),COLORLIRED;
Q2:=INTPART(3*8/18);
A22:=REF(OBV,Q2)=LLV(OBV,2*Q2+1);
B22:=FILTER(A22,Q2);
C22:=BACKSET(B22,Q2+1);
D22:=FILTER(C22,Q2);{低点2}
T112:=BACKSET(ISLASTBAR,BARSLAST(D22)+1); U112:=T112>REF(T112,1);
DRAWLINE(U11,OBV,U112,OBV,1),COLORBLUE;
DRAWICON(D2,OBV,26);
DRAWICON(D1,OBV,27);
压力:REF(OBV,BARSLAST(D1)),NODRAW;
支撑:REF(OBV,BARSLAST(D2)),NODRAW;
向上:CROSS(OBV,压力*1.01),NODRAW;
相对能量:(OBV-支撑)/(压力-支撑)*100,COLORYELLOW,NODRAW;
STICKLINE(C>0,支撑,支撑,1,0),COLORGREEN;
STICKLINE(C>0,压力,压力,1,0),COLORRED;
DRAWTEXT(CROSS(OBV,压力*1.01),压力,'压力线'),COLORLIRED;
DRAWTEXT(CROSS(支撑*0.99,OBV),支撑,'支撑线'),COLORLIGREEN;
{www.guziyuan.cn}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=(3*K-2*D);
{D2:=SMA(J,3,1)*0.82;}
JOBV:=J;
JA2:=REF(JOBV,P)=LLV(JOBV,2*P+1);
JB2:=FILTER(JA2,P);
JC2:=BACKSET(JB2,P+1);
JD2B:=FILTER(JC2,P);{低点1}
JT11:=BACKSET(ISLASTBAR,BARSLAST(JD2B)+1);
JU11:=JT11>REF(JT11,1);
JQ2:=INTPART(3*8/18);
JA22:=REF(JOBV,JQ2)=LLV(JOBV,2*JQ2+1);
JB22:=FILTER(JA22,JQ2);
JC22:=BACKSET(JB22,JQ2+1);
JD22:=FILTER(JC22,JQ2);{低点2}
JT112:=BACKSET(ISLASTBAR,BARSLAST(JD22)+1);
JU112:=JT112>REF(JT112,1);
蓝线:=DRAWLINE(JU11,JOBV,JU112,JOBV,1);
XX:((CROSS(蓝线,J) OR J=蓝线) AND NOT(JU11) AND NOT(JU112))*25,STICK,COLORFF00FF;