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

通达信源码精选:精准红绿波段,盯庄跟庄,日周MACD同图

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

1、精准红绿波段

VAR1:=(HHV(HIGH,9)-LLV(LOW,9));

VAR2:=(HHV(HIGH,9)-CLOSE);
VAR3:=(CLOSE-LLV(LOW,9));
VAR4:=VAR2/VAR1*100-70 ;
VAR5:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*100; 
VAR6:=(2*C+H+L)/4;
VAR7:=SMA((VAR3/VAR1*100),3,1);
VAR8:=LLV(LOW,34);
VAR9:=SMA(VAR7,3,1)-SMA(VAR4,9,1);
VAR10:= IF(VAR9>100,VAR9-100,0);
VARA:=HHV(HIGH,34);
防线:=EMA((VAR6-VAR8)/(VARA-VAR8)*100,8);
B1:=EMA(防线,5);
见红建仓:STICKLINE(防线-B1>0,防线,B1,8,1),COLORRED;
绿出离场:STICKLINE(防线-B1<0,防线,B1,8,1),COLOR00FF00;
快乐炒股:STICKLINE(防线>0 AND 防线-B1>=0,2,8,6,0),COLORRED;
离场休息:STICKLINE(防线>0 AND 防线-B1<0,2,8,6,0),COLOR00FF00;
警:88,LINETHICK3,COLORRED;
戒:20,LINETHICK3,COLORGREEN;
Y:0,LINETHICK2,COLORBLUE;


2、盯庄跟庄

{盯庄跟庄}

VAR4:=3*SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH, 75)-LLV(LOW,75))*100, 20, 1)-2*SMA(SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100, 20, 1), 15, 1);
VAR5:=3*SMA((OPEN-LLV(LOW,75))/(HHV(HIGH, 75)-LLV(LOW,75))*100, 20, 1)-2*SMA(SMA((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100, 20, 1), 15, 1);
VAR6:=100-VAR5;
VAR7:=100-VAR4;
A1:=REF(C,1);
A2:=100*V/CAPITAL*10; 
AA:=CROSS(VAR6,VAR7) AND VAR4<25 ;
AAB:=CROSS(VAR6,VAR7) AND VAR4>30 AND  VAR4<50 ;
ABC:=CROSS(VAR6,VAR7) AND VAR4>50 AND  VAR4<65;
STICKLINE(VAR7<REF(VAR6, 1), -1*VAR7, -1*VAR6, A2,1), COLORRED;
VA1:=MA(VAR6,3);
STICKLINE(-1*VAR7>VA1, -1*VAR7, -1*VAR6,A2,1);
STICKLINE(VAR7>=REF(VAR6, 1), -1*VAR7, -1*VAR6, A2,1),COLORBLUE;
FORCAST(-1*VAR6,21);
百万:=MA(WINNER(C),9)*100;
BB:=CROSS(百万,2.5) ;
BB*-85,LINETHICK4,STICK;
DRAWTEXT(BB,-40,'..新庄介入');
DRAWTEXT(AAB,-80,'叮庄');
{DRAWTEXT(ABC,-50,'梅开二度');}
DRAWTEXT(AA,-70,'跟庄'),COLORRED;
{股民学院 www.58188.com 整理}



3、日周MACD同图

日周KDJ 日周MACD,两个副图公式

 {日周MACD同图}
DRAWTEXT_FIX(1,0.01,0.01,0,'1、在日线观察周MACD,与它在周线的样子是一样的'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.06,0,'2、在日线分析周MACD时,注意对应的最右边一根K线是最近的这周'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.11,0,'3、相应的,往左数第二根K线对应上周,接着是上上周...'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.16,0,'4、周线MACD的具体数值看上方,这才是是正确的'),COLORWHITE;
{MACD}
DDATE:DATE,NODRAW,COLORRED;
DIF:EMA(C,12)-EMA(C,26),COLORWHITE;
DEA:EMA(DIF,9),COLORYELLOW;
MACD:(DIF-DEA)*2,NODRAW,COLORMAGENTA;
{显示MACD柱}
STICKLINE(MACD>0,MACD,0,1,1),COLORRED;
STICKLINE(MACD<0,0,MACD,1,1),COLORGREEN;
TESTSKIP(PERIOD!=5);
{周MACD}
D1:=DATE;
DIF1:=MACD.DIF#WEEK;
DEA1:=MACD.DEA#WEEK;
WEK:=REFX(WEEKDAY<REF(WEEKDAY,1) OR
DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7,1) OR ISLASTBAR;
D2:=IF(WEK,D1,DRAWNULL);
DIF2:=IF(WEK,DIF1,DRAWNULL);
DEA2:=IF(WEK,DEA1,DRAWNULL);
周日期:ALIGNRIGHT(D2),NODRAW,COLORRED;
周DIF:ALIGNRIGHT(DIF2),NODRAW,COLORWHITE;
周DEA:ALIGNRIGHT(DEA2),NODRAW,COLORYELLOW;
周MACD:(周DIF-周DEA)*2,NODRAW,COLORMAGENTA;
A1:=CONST(LLV(MACD,150))*2;
Q:=0.6;
NOTEXTA1:A1,COLOR336699,DOTLINE;
{显示周MACD柱}
STICKLINE(周MACD>0,A1,周MACD*Q+A1,1,1),COLOR0099FF;
STICKLINE(周MACD<0,A1,周MACD*Q+A1,1,1),COLOR999900;
{显示周MACD均线}
NOTEXT周DIF:周DIF*Q+A1,DOTLINE,COLORLIRED;
NOTEXT周DEA:周DEA*Q+A1,DOTLINE,COLORCYAN;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{日周KDJ同图}
DRAWTEXT_FIX(1,0.01,0.01,0,'1、在日线观察周KDJ,与它在周线的样子是一样的'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.06,0,'2、在日线分析周KDJ时,注意对应的最右边一根K线是最近的这周'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.11,0,'3、相应的,往左数第二根K线对应上周,接着是上上周...'),COLORWHITE;
DRAWTEXT_FIX(1,0.01,0.16,0,'4、周线KDJ的具体数值看上方,这才是是正确的'),COLORWHITE;
{KDJ}
DDATE:DATE,NODRAW,COLORRED;
RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
K:SMA(RSV,3,1),COLORFFFFFF;
D:SMA(K,3,1),COLOR00FFFF;
J:3*K-2*D,COLORFF00FF;
TESTSKIP(PERIOD!=5);
{周KDJ}
D1:=DATE;
K01:=KDJ.K#WEEK;
D01:=KDJ.D#WEEK;
J01:=KDJ.J#WEEK;
WEK:=REFX(WEEKDAY<REF(WEEKDAY,1) OR DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7,1)
  OR ISLASTBAR;
D2:=IF(WEK,D1,DRAWNULL);
K02:=IF(WEK,K01,DRAWNULL);
D02:=IF(WEK,D01,DRAWNULL);
J02:=IF(WEK,J01,DRAWNULL);
周日期:ALIGNRIGHT(D2),NODRAW,COLORRED;
周K:ALIGNRIGHT(K02),NODRAW,COLORFFFFFF;
周D:ALIGNRIGHT(D02),NODRAW,COLOR00FFFF;
周J:ALIGNRIGHT(J02),NODRAW,COLORFF00FF;
A1:=CONST(LLV(J,150))*5;
Q:=0.6;
{NOTEXTA1:A1,COLOR336699,DOTLINE;}
{显示周KDJ}
NOTEXT周K:周K*Q+A1,COLORFFFFFF,DOTLINE;
NOTEXT周D:周D*Q+A1,COLOR00FFFF,DOTLINE;
NOTEXT周J:周J*Q+A1,COLORFF00FF,DOTLINE;

 
KDJ和MACD是我们经常用到的公式,特别是它们在周线下的形态我们会特别关注,因此免不了经常在日周两个周期内切换。本公式免去了这种切换的麻烦,同时又不像有些周线公式日显时需要不断缩小才能窥见全貌。
使用中需要注意的问题我已经在公式内做了说明,不需要可自行编辑删除。

上一篇:通达信源码精选:动量买卖,风险评测,顶和底

下一篇:通达信源码精选:趋势线,小散盯盘,精准短波