当前位置: 网站首页 > 股票软件公式 > 通达信公式 > 文章 当前位置: 通达信公式 > 文章

通达信源码精选:三种背离提示,抄底启动,区间段涨幅

点击: 次    来源:顶尖财经    作者:股市狙击 - 小 + 大

1、三种背离提示

{三种背离提示}
 
SJ:=1;
{底:=-50;
顶:50;}
上:80*SJ,COLORRED;
下卖:20*SJ,COLOR00FF00;
MACD顶背:0,COLOR00FF00;
MACD底背:0,COLORRED;
KDJ顶背:0,COLORFFCC66;
KDJ底背:0,COLORFF00FF;
RSI顶背:0,COLORFFFFFF;
RSI底背:0,COLORYELLOW;
{DMI顶背:0,COLORBLUE;
DMI底背:0,COLOR0099FF;}
TRR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),14);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
PDM:= SUM(IF(HD>0 AND HD>LD,HD,0),14);
MDM:= SUM(IF(LD>0 AND LD>HD,LD,0),14);
PDI:= PDM*100/TRR;
MDI:= MDM*100/TRR;
A1:=BARSLAST(REF(CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9)),1))*SJ;
B1:=REF(C,A1+1)>C AND REF("MACD.DIF"(12,26,9),A1+1)<"MACD.DIF"(12,26,9) AND CROSS("MACD.DIF"(12,26,9),"MACD.DEA"(12,26,9))*SJ;
A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));
B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3))*SJ;
A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24))*SJ;
C1:=BARSLAST(REF(CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9)),1));
D1:=REF(C,C1+1)<C AND REF("MACD.DIF"(12,26,9),C1+1)>"MACD.DIF"(12,26,9) AND CROSS("MACD.DEA"(12,26,9),"MACD.DIF"(12,26,9))*SJ;
C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3))*SJ;
C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24))*SJ;
C4:=BARSLAST(REF(CROSS(MDI,PDI),1));
D4:=REF(C,C+1)<C AND REF(MDI,C4+1)>MDI AND CROSS(MDI,PDI);
A4:=BARSLAST(REF(CROSS(PDI,MDI),1));
B4:=REF(C,A4+1)>C AND REF(PDI,A4+1)<PDI AND CROSS(PDI,MDI);
 
{DRAWTEXT(B4>0,5,'DMI底背'),COLOR0099FF;}
{DRAWTEXT(D4>0,95,'DMI顶背'),COLORBLUE;}
DRAWTEXT(B1>0,15,'MACD底背'),COLORRED;
DRAWTEXT(B2>0,10,'KDJ底背')*SJ,COLORFF00FF;
DRAWTEXT(B3>0,18,'RSI底背')*SJ,COLORYELLOW;
DRAWTEXT(D1>0,85,'MACD顶背')*SJ,COLOR00FF00;
DRAWTEXT(D2>0,90,'KDJ顶背')*SJ,COLORFFCC66;
DRAWTEXT(D3>0,96,'RSI顶背')*SJ,COLORFFFFFF;
STICKLINE(B1>0,20,0,0,0),COLORRED;
STICKLINE(B2>0,20,0,0,0),COLORFF00FF;
STICKLINE(B3>0,20,0,0,0),COLORYELLOW;
STICKLINE(D1>0,80,100,0,0),COLOR00FF00;
STICKLINE(D2>0,100,80,0,0),COLORFFCC66;
STICKLINE(D3>0,100,80,0,0),COLORWHITE;
{STICKLINE(B4>0,20,0,0,0),COLOR0099FF;
STICKLINE(D4>0,100,80,0,0),COLORBLUE;}
VAR188:=((CLOSE - LLV(LOW,34))/(HHV(HIGH,34) - LLV(LOW,34)))*(100);
VAR288:=REVERSE(VAR188);
VAR388:=SMA(VAR188,9,1);
K88:=SMA(VAR388,3,1)*SJ;
D88:=SMA(K88,3,1)*SJ;
STICKLINE((K88 >= D88),K88,D88,1,0),COLOR0000FF;
STICKLINE((K88 <= D88),K88,D88,1,0),COLOR00FF00;
{股民学院 www.58188.com 整理}



2、抄底启动,抄底类公式

{抄底启动}

X_1:=59-59+66-44+20+2+24*100000000+5-5+1700000+1580+3-3-44;
X_2:=6*100000000+23578500+92+3;
 
X_3:=REF(LOW,1);
X_4:=SMA(ABS(LOW-X_3),3,1)/SMA(MAX(LOW-X_3,0),3,1)*100;
X_5:=EMA(IF(CLOSE*1.3,X_4*10,X_4/10),3);
X_6:=LLV(LOW,30);
X_7:=HHV(X_5,30);
X_8:=IF(MA(CLOSE,58),1,0);
X_9:=EMA(IF(LOW<=X_6,(X_5+X_7*2)/2,0),3)/618*X_8;
X_10:=IF(X_9>100,100,X_9);
X_11:=X_10>(-150);
X_12:=(CLOSE-MA(CLOSE,20))/MA(CLOSE,20)*100;
IF(X_12<0 AND X_1,X_12*4,0),COLORGREEN,LINETHICK2;
X_13:=IF(CROSS(X_12,-24),1,0);
X_14:=(CLOSE-MA(CLOSE,5))/MA(CLOSE,5)*100;
X_15:=0;
STICKLINE(X_10>REF(X_10,1) AND X_10>(-150) AND X_1,0,X_10,2,0),COLORBLUE;
STICKLINE(X_10=REF(X_10,1) AND X_10>(-150) AND X_9>100 AND X_1,0,X_10,2,0),COLORBLUE;
STICKLINE(X_10<REF(X_10,1) AND X_10>(-150) AND X_1,0,X_10,2,0),COLORGREEN;
STICKLINE(CROSS(X_12,-24),100,0,2,0),COLORGREEN;
X_16:=3;
X_17:=3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1);
启动:CROSS(X_17,X_16),NODRAW,COLORRED;
DRAWTEXT(启动>0,(-15),3),COLORRED;
顶部:CROSS(97,X_17),NODRAW,COLORGREEN;
DRAWTEXT(顶部>0,15,'买'),COLORGREEN;



3、区间段涨幅,显示时间段内的涨幅大小

{标注,画出柱子}
起点标注:=YEAR=起点年 AND MONTH=起点月 AND DAY=起点日;  {前面时间}
STICKLINE(起点标注,O,C*2.05,0.01,-1),COLORRED;
终点标注:=YEAR=终点年 AND MONTH=终点月 AND DAY=终点日;  {前面时间}
STICKLINE(终点标注,O,C*2.05,0.01,-1),COLORRED;
{计算条件成立的周期数位置}
起点位置:=BARSLAST(YEAR=起点年 AND MONTH=起点月 AND DAY=起点日);
终点位置:=BARSLAST(YEAR=终点年 AND MONTH=终点月 AND DAY=终点日);
中间位置:=(起点位置-终点位置)/2+终点位置;
{涨幅计算}
起点价:=REF(L,起点位置);
终点价:=REF(H,终点位置);
起点价1:=REF(H,起点位置);
终点价1:=REF(L,终点位置);
时段收盘涨幅:=(终点价/起点价-1)*100;
时段收盘涨幅1:=(起点价1/终点价1-1)*100;
DRAWNUMBER_FIX(终点价>起点价,0.75,0.3,0,时段收盘涨幅),COLORYELLOW;
DRAWNUMBER_FIX(终点价<起点价,0.75,0.3,0,时段收盘涨幅1),COLORCYAN;
DRAWTEXT_FIX(1,0.8,0.3,0,'%'),COLORYELLOW;

上一篇:通达信公式下载:经传旗舰版全套指标(没导入密码)79个

下一篇:通达信源码精选:主力建仓量,多空MACD,精确波段