注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

天意(专注股票)

对股票一往情深,享受成功与失败

 
 
 

日志

 
 
关于我

对股票一往情深,享受成功与失败。 声明: 本博客只是个人的一些看法,不对任何个人和团体构成投资依据和建议,据此操作,风险自担。

网易考拉推荐

MACD顶底背离公式  

2011-11-09 08:35:31|  分类: 股票编程 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
DIFF : EMA(CLOSE,S) - EMA(CLOSE,P),colorred;//(这句表达的是S天与P天股价指数平滑曲线的差值,用红色表示)
DEA : EMA(DIFF,M),coloryellow;//(这句表达的是第一句M天的指数平滑曲线,用黄色表示)
MACD : 2*(DIFF-DEA), COLORSTICK;//(这句表达的第一句和第二句差值的柱状线)

A4:=BARSLAST(ref(cross(diff,dea),1));
B1:=ref(h,A4+3)>ref(c,3) and ref(diff,A4+3)<ref(diff,3) and cross(diff,dea);
DRAWTEXT(FILTER(B1>0,5),diff,'←底背离'),COLORyellow;
A5:=BARSLAST(ref(cross(dea,diff),1));
B2:=ref(h,A5+3)<ref(h,3) and ref(diff,A5+3)>ref(diff,3) and cross(dea,diff);
DRAWTEXT(FILTER(B2>0,5),diff,'←顶背离'),COLORgreen;

partline(diff<ref(diff,1),diff),colorgreen;//(这句是我自己加的,DIFF上升红色,下降绿色,方便看盘而已,飞狐可用)。


p,26,1,500
s,12,1,500
m,9,1,500



{MACD底背共振选股-通达信 SDCCN}
{选股思路:小周期MACD底背,大周期MACD放大}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=2*(DIF-DEA);
N:=4;
DIF1:=EMA(CLOSE,12*N)-EMA(CLOSE,26*N);
DEA1:=EMA(DIF1,9*N);
MACD1:=2*(DIF1-DEA1);
{小周期MACD底背}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
MACD底背:=L<REF(L,A1+1) AND DEA>REF(DEA,A1+1) AND CROSS(DIF,DEA) AND A1>=5 AND DEA<0;
{大周期MACD放大}
MACD放大:=MACD1>REF(MACD1,1);
XUANGU:MACD底背 && MACD放大;


MACD双回试选股V2.0-通达信 SDCCN}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
N:=4;
DIF1:=EMA(CLOSE,12*N)-EMA(CLOSE,26*N);
A1:=BARSLAST(REF(CROSS(DIF,DEA),1)); 
DIF多头发散:=DIF/REF(DIF,1)>1.03 AND DIF>0;
DIF1多头发散:=DIF1/REF(DIF1,1)>1.03 AND DIF1>0;
XUANGU:A1>5 AND A1<=13 AND CROSS(DIF,DEA) AND DIF多头发散 AND DIF1多头发散;






MACD面积公式

一、MACD面积公式(通达信)
DIFF := EMA(CLOSE,12) - EMA(CLOSE,26);
DEA  := EMA(DIFF,9);
MACD := 2*(DIFF-DEA), COLORSTICK;
BV:=SUM(MACD,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:BV-REF(BV,BC),COLORSTICK;

 

二、浩申老师的MACD面积飞狐源码:
p:=26;s:=12;m:=9;
var1:="[email=chzhshch@kxian]chzhshch@kxian[/email]";{处理K线关系}
var2:="[email=chzhshch@bi]chzhshch@bi[/email]";{处理笔关系}
var3:="[email=chzhshch@duan]chzhshch@duan[/email]";{处理段关系}
DIFF : EMA(CLOSE,s) - EMA(CLOSE,p);
DEA : EMA(DIFF,m);
MACD : 2*(DIFF-DEA), COLORSTICK;
var4:"[email=chzhshch@macds]chzhshch@macds"(macd)/20[/email];{图形比例缩小1/20,可自己修改}
var5:="[email=chzhshch@macdsnum]chzhshch@macdsnum[/email]";
drawnumber(ref(var4,1)>0 and var4<=0 ,ref(var4,1),ref(var5,1),0),shift1,colorred;
drawnumber(ref(var4,1)<0 and var4>=0 ,ref(var4,1),ref(abs(var5),1),0),shift1,colorgreen;
drawnumber(islastbar and var4<0,var4,abs(var5),0),align2,colorgreen,pxup25;
drawnumber(islastbar and var4>0,var4,var5,0),align2,colorred,pxdn10;

 

---------------------------------------------------------------------

三、这个比较复杂

{面积MACD}公式

注:调整参数可以自行更改,主要作用是放大或缩小MACD面积倍数,效果是一样的。

input:调整参数(20,0.0001,1000);

p:=26;s:=12;m:=9;
DIFF:EMA(c,s) - EMA(c,p);
DEA:EMA(DIFF,m);
MACD:2*(DIFF-DEA),COLORSTICK;
BV:=SUM(MACD/调整参数,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);

var3:=if(macd>0,HHV(abs(macd),bc),LLV(macd,bc));
var4:=(macd)/20;{图形比例缩小1/20,可修改}
var5:=SMACD*100;

drawnumber(ref(var4,1)>0 and var4<=0 ,ref(var3,1),ref(var5,1),0){,pxup100},colorgreen;
drawnumber(ref(var4,1)<0 and var4>=0 ,ref(var3,1),ref(abs(var5),1),0),{pxdn40,}colorff00ff;
drawnumber(islastbar and var4<0,ref(var3,1),abs(var5),0),align2,colorff00ff{,pxup40};
drawnumber(islastbar and var4>0,ref(var3,1),var5,0),align2,colorgreen{,pxdn100};

M1:=REF(MACD,1);
STICKLINE(macd>0 and macd<=m1,0,macd,3,0),coloryellow;
STICKLINE(macd<0 and macd>=m1,0,macd,3,0),colorwhite;
{DRAWICON(macd<0 and ref(macd,1)>macd and l>ref(l,1) and c>o,macd,10);}
{DRAWICON(ref(macd,2)>0 and ref(macd,1)<0.01 and macd>0.01,macd,10);}
{DRAWICON(diff>ref(diff,1) and macd<0 and c>=o and l<ref(l,1),macd,12);}
{DRAWICON(macd<0 and ref(macd,1)<macd and l<ref(l,1) and c>o,macd,10);}
日线MACD:"macd.macd#day",LINETHICK0,COLORFF0099;
三十分MACD:"MACD.MACD#MIN30",colorred,linethick0;
十五分MACD:"MACD.MACD#MIN15",linethick0;
五分MACD:"MACD.MACD#MIN5",colorff00ff,linethick0;
jc := dea-diff;
绿柱面积:IF (MACD<0,SUM(MACD,BARSLAST(jc<0)),0),linethick0,colorblue;
红柱面积:IF (MACD>0,SUM(MACD,BARSLAST(jc>0)),0),linethick0,colorred;

LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
e:=CROSS(83,RSI);
DRAWICON(e,macd,10);
日RSI:"引用RSI.RSI#day",colorff00ff,linethick0;
六十分RSI:"引用RSI.RSI#MIN60",colorff00ff,linethick0;
三十分RSI:"引用RSI.RSI#MIN30",colorff00ff,linethick0;
十五分RSI:"引用RSI.RSI#MIN15",colorff00ff,linethick0;
五分RSI:"引用RSI.RSI#MIN5",colorff00ff,linethick0;
DRAWICON(CROSS(83,日RSI),macd,1);
STICKLINE(CROSS(83,日RSI),diff,0,6,0),Colorred;
DRAWICON(CROSS(83,六十分RSI),macd,2);
DRAWICON(CROSS(83,三十分RSI),diff,3);
DRAWICON(CROSS(83,十五分RSI),-macd,4);
DRAWICON(CROSS(83,五分RSI),macd,6);

日WR:"引用WR.WR#day",colorff00ff,linethick0;
六十分WR:"引用WR.WR#MIN60",colorff00ff,linethick0;
三十分WR:"引用WR.WR#MIN30",colorff00ff,linethick0;
十五分WR:"引用WR.WR#MIN15",colorff00ff,linethick0;
五分WR:"引用WR.WR#MIN5",colorff00ff,linethick0;
PARTLINE(日WR<=1,diff),colorred,LINETHICK5;
PARTLINE(六十分wr<=1,dea),colorgreen,LINETHICK4;
PARTLINE(三十分wr<=1,diff),colorff00ff,LINETHICK3;
PARTLINE(十五分wr<=1,dea),colorgreen,LINETHICK2;
DRAWICON(五分wr<=1,macd,12);


下面二个是{面积MACD}公式引用的公式,公式名一定要对。

1、公式名称

{引用RSI}

LC:=REF(CLOSE,1);
RSI:SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100,linethick0;
e:CROSS(83,RSI);

2、公式名称

{引用WR}

WR:(C-llv(L,5))/(hhv(H,5)-llv(L,5))*100;

---------------------------------------------------------------------------------------------------- 

 

MACD背驰最好的副图指标[通达信和大智慧1都可用]
DIFF:EMA(CLOSE,12)-EMA(CLOSE,27);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
STICKLINE(低位金叉,0,0.08,6,0),COLORYELLOW;
DRAWTEXT(低位金叉,0.16,' 低位金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,0.06,6,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;
DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,0.25,'三全项'),COLOR0000FF,LINETHICK2;

---------------------------------------------------------------------------------------

MACD(面)积背离公式
{short   2    200    12
long    2     200    26
m        2     200     9}

DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA  : EMA(DIFF,M);
MACD : 2*(DIFF-DEA), COLORSTICK;
JC := DEA-DIFF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0);
红柱面积:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0);
本次最低价:=LLV(L,BARSLAST(JC<0));
本次最高价:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD<0,BARSLAST(CROSS(DIFF,DEA)),0);
前次绿柱面积:=REF(绿柱面积,X1+1);
前次最低价:=REF(本次最低价,X1+1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积)
AND 本次最低价<前次最低价 ),1,0);
RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低价
AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
底背驰:= IF (CROSS(DIFF,DEA),REF(Y1,1),0);
DRAWTEXT(底背驰,0.3,积底背),COLOR00FFFF;
STICKLINE(底背驰,0,0.3,4,0),COLOR0000FF;
DRAWICON(底背驰,0,23),COLORYELLOW;
DRAWBAND(DIFF,RGB(200,50,55),DEA,RGB(50,100,10));
遵:IF(DIFF>=DEA,DIFF,DRAWNULL),COLORRED;  
守:IF(DEA>=DIFF,DEA,DRAWNULL),COLORFF9900;
纪:IF(DIFF>=DEA,DEA,DRAWNULL),COLOR00FFFF;
律:IF(DEA>=DIFF,DIFF,DRAWNULL),COLOR00FF00;

X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIFF)),0);
前次红柱面积:=REF(红柱面积,X2+1);
前次最高价:=REF(本次最高价,X2+1);
Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
RS2:= MACD>0 AND REF(MACD,1)>0 AND C>前次最高价 AND ABS(红柱面积)<ABS(前次红柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
顶背驰:= IF (CROSS(DEA,DIFF),REF(Y2,1),0);
DRAWICON(顶背驰,0,19),COLOR00FF00;
STICKLINE(顶背驰,0,-0.3,4,0),COLOR00FF00;
DRAWTEXT(顶背驰,-0.3,积顶背),COLORFF0000; 
 

 -------------------------------------------------------------------------------------

MACD积背离  大智慧

DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA  : EMA(DIFF,M);
MACD : 2*(DIFF-DEA), COLORSTICK;
jc := dea-diff;
绿柱面积:IF (MACD<0,SUM(MACD,BARSLAST(jc<0)),0),linethick0,colorblue;
红柱面积:IF (MACD>0,SUM(MACD,BARSLAST(jc>0)),0),linethick0,colorred;
本次最低价:LLV(L,BARSLAST(jc<0)),linethick0;
本次最高价:HHV(H,BARSLAST(jc>0)),linethick0;
x1:=IF (MACD<0,BARSLAST(CROSS(diff,dea)),0);
前次绿柱面积:=REF(绿柱面积,x1+1);
前次最低价:=REF(本次最低价,x1+1);
y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积) AND 本次最低价<前次最低价 ),1,0);
RS1:= MACD<0 AND REF(MACD,1)<0 AND C<前次最低价 AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
底背驰:= IF (CROSS(diff,dea),REF(y1,1),0);
DRAWICON(底背驰,0,7),coloryellow;
FILLRGN(diff,dea,rs1),colorred;
x2:=IF (MACD>0,BARSLAST(CROSS(dea,diff)),0);
前次红柱面积:=REF(红柱面积,x2+1);
前次最高价:=REF(本次最高价,x2+1);
y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
RS2:= MACD>0 AND REF(MACD,1)>0 AND C>前次最高价 AND ABS(红柱面积)<ABS(前次红柱面积) AND ABS(MACD)<ABS(REF(MACD,1));
顶背驰:= IF (CROSS(dea,diff),REF(y2,1),0);
DRAWICON(顶背驰,0,8),coloryellow;
FILLRGN(dea,diff,rs2),colorgreen;

 

-----------------------

你好:
我非常理解你求助心切,但指标区版规中有规定,版主是不能回复短信求助的。
请你谅解!

你试试这个,能否满足你的思路?
运行平台----飞狐交易师

DIFF:= EMA(CLOSE,12) - EMA(CLOSE,26);
DEA := EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
macd红柱:=if(macd>0,macd,0);
macd绿柱:=if(macd<0,macd,0);
D:=DATACOUNT;
GB:=SYSPARAM(1);
ZH:=BARSCOUNT(C)+1;
bb:=D-GB+1;
光标前红柱:SUM(macd红柱,0),LINETHICK0,COLORRED;
HGS:=COUNT(macd>0,0),LINETHICK0;
ZHZ:=STRTONUM(NUMTOSTR(光标前红柱,2)),LINETHICK0;
ZHGS:=STRTONUM(NUMTOSTR(HGS,0)),LINETHICK0;
光标后红柱:ZHZ-光标前红柱,LINETHICK0,COLORAA99EE;
STICKLINE(ZH>GB,0,光标后红柱/(ZHGS-HGS+1),10,0),COLORAA99EE;
光标前绿柱:SUM(macd绿柱,0),LINETHICK0,COLORGREEN;
LGS:=COUNT(macd<0,0),LINETHICK0;
ZLZ:=STRTONUM(NUMTOSTR(光标前绿柱,2)),LINETHICK0;
ZLGS:=STRTONUM(NUMTOSTR(LGS,0)),LINETHICK0;
光标后绿柱:ZLZ-光标前绿柱,LINETHICK0,COLOR99AA66;
STICKLINE(ZH>GB,0,光标后绿柱/(ZLGS-LGS+1),10,0),COLOR99AA66;
STICKLINE(MACD>0,0,MACD,3,0),COLOR0000FF;
STICKLINE(MACD<0,0,MACD,3,0),COLOR00FF00;

----------------------------------------------------------

 

面积公式


DIF:10*(EMA(CLOSE,12)-EMA(CLOSE,26)),POINTDOT;
DEA:EMA(DIF,9);
MACD:2*(DIF-DEA),COLORYELLOW;
BV:=SUM(MACD/13,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) OR MIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:BV-REF(BV,BC),COLORSTICK;

以上是从网络找的

 

==============================================

求助哪位高人 会 macd 红绿柱面积公式(通达信)

[转载]MACD面积公式 悬赏分:50 - 提问时间2010-1-23 10:31 问题为何被关闭
描述:macd红柱时在旁边有个数值(计算出的面积)表示红柱面积。绿柱时旁边有个数值表示绿柱面积。 
提问者: 1522920620 - 四级
答复    1
MACD:=MACD.MACD; 红柱面积:SUM(MACD,BARSLAST(MACD<0))*(MACD>0),NODRAW; 绿柱面积:SUM(MACD,BARSLAST(MACD>0))*(MACD<0),NODRAW;  
原文地址:W底公式(通达信)作者:RunRunRun
 W底公式

参数:
N:   缺省:10    最小:1    最大:100
GATE1:   缺省:25    最小:1    最大:100
GATE2:   缺省:55    最小:1    最大:100
GATE3:   缺省:20    最小:1    最大:100

首先要想编出W底的指标是一定要用之子转向函数的,因为用其他的函数无法准确表达W底。
这点要有心理准备!


N1:=10;
GATE1:=25;
GATE2:=55;
GATE3:=20;
p1:=peak(3,N,2);
p3:=peak(3,N,1);
p2:=trough(3,N,2);
p4:=trough(3,N,1);
t1:=troughbars(3,N,2)-peakbars(3,N,1);
t2:=peakbars(3,N,1)-troughbars(3,N,1);
b12:=p1-p2;
bpt:=max(p3-p2,p3-p4);
b24:=abs(p2-p4);
min(t1,t2)>20
{左右底周期跨度均大于20}
and abs(t1-t2)/min(t1,t2)*100<gate1
{左右底跨度之差与左(或右)底跨度的比值小于gate1}
and bpt/b12*100<gate2
{底部反弹幅度与前期深度跌幅的比值小于gate2}
and  b24/bpt*100<gate3
{左右底股价的差与底不凡弹高度的比值小于gate3}
and cross(close,1.05*p3)
{最新收盘价向上突破颈线的1.05倍}
{注:未加入成交量放大限制条件}2:中线M头卖W底买 指标源码(大智慧)
中线: 1-100*(HHV(HIGH,40)-CLOSE)/(HHV(HIGH,40)-LLV(LOW,40)),
短线: 1-100*(HHV(HIGH,10)-CLOSE)/(HHV(HIGH,10)-LLV(LOW,10)),
!警戒线!: -15;
↓逃顶线↓: -5;
↑抄底线↑: -90,
 

---------------------------------------

求:选股公式。条件:双底突破,且右底比左底高。

一品老师W底:

MA5 :=EMA(CLOSE,5);
趋势:=MA5-EMA(MA5,2);
JCSJ1:=BARSLAST(CROSS(趋势,0))+1;
JCSJ2:=JCSJ1+REF(JCSJ1,JCSJ1);
双底:IF(JCSJ1=1 AND MA5>REF(MA5,JCSJ2) AND COUNT(趋势<0,4)>=2,1,0);

==============
下面的可放在主图提示,大智慧L2版本用:
MA5 :EMA(CLOSE,5);
趋势:=MA5-EMA(MA5,2);
JCSJ1:=BARSLAST(CROSS(趋势,0))+1;
JCSJ2:=JCSJ1+REF(JCSJ1,JCSJ1);
双底:IF(JCSJ1=1 AND MA5>REF(MA5,JCSJ2) AND COUNT(趋势<0,4)>=2,1,0),LINETHICK0;
DRAWICON(双底,L,6),ALIGN1;

下面的可放在主图提示,通达信版本用:

MA5 :EMA(CLOSE,5);
趋势:=MA5-EMA(MA5,2);
JCSJ1:=BARSLAST(CROSS(趋势,0))+1;
JCSJ2:=JCSJ1+REF(JCSJ1,JCSJ1);
双底:IF(JCSJ1=1 AND MA5>REF(MA5,JCSJ2) AND COUNT(趋势<0,4)>=2,1,0),NODRAW;
DRAWICON(双底,L,13);




MACD背离(直观图)(通达信副图指标)

{MACD背离公式1}

DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORRED,LINETHICK2;
DEA:EMA(DIF,9),COLORWHITE,LINETHICK2;
持仓段:=0,COLOR00CFFF;
空仓段:=0,COLORFFCCFF;
STICKLINE(DIF>DEA,-0.5,-0.6,10,1),COLOR00CFFF;
STICKLINE(DIF<DEA,-0.5,-0.6,10,1),COLORFFCCFF;
MACD:(DIF-DEA)*2,COLORSTICK;
STICKLINE(((MACD<REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),COLORLIBLUE,LINETHICK2;
STICKLINE(((MACD>REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),COLORFF00FF,LINETHICK2;
建仓:IF(DIF<0,DIF,0),COLORYELLOW,LINETHICK2;
加仓:IF(DIF<0,0,DIF),COLORRED,LINETHICK2;
白线破仓:IF(DIF<DEA,DIF,DEA),COLORWHITE,LINETHICK2;
趋势强弱:IF(DIF>DEA,DEA,DEA),COLORFF937F,LINETHICK2;
AA:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
DRAWTEXT(二次金叉,0.2,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
DRAWTEXT(底背离,0.12,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;


 {MACD背离公式2}

DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
MACD:=EMA(DIF,9),COLOR33CCFF;
DEF:2*(DIF-MACD),COLORFFFF00,LINETHICK0;
STICKLINE(DEF>=0 AND DEF>=REF(DEF,1),0,DEF,0,0),COLORRED;
STICKLINE(DEF>=0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORRED;
STICKLINE(DEF<0 AND DEF>=REF(DEF,1),0,DEF,0.0,0),COLORCYAN;
STICKLINE(DEF<0 AND DEF< REF(DEF,1),0,DEF,0.0,0),COLORCYAN;
IF(DIF<1000,0,DRAWNULL),COLORBROWN;
K1:=BACKSET(DIF>REF(DIF,1),2);
强DIF:IF(K1,DIF,DRAWNULL),COLORRED;
K2:=BACKSET(DIF<REF(DIF,1),2);
弱DIF:IF(K2,DIF,DRAWNULL),COLORFF8B80;
K3:=BACKSET(MACD>REF(MACD,1),2);
强MACD:IF(K3,MACD,DRAWNULL),COLORLIRED;
K4:=BACKSET(MACD<REF(MACD,1),2);
弱MACD:IF(K4,MACD,DRAWNULL),COLORFF8B80;
底拐: DRAWLINE(DIF>=HHV(DIF,21),DIF,DIF<=LLV(DIF,21),DIF,1),COLORWHITE,POINTDOT;
DRAWICON(强DIF>底拐 AND REF(DIF,1)=REF(底拐,1) AND REF(DIF,2)>REF(DIF,1),0,1);
A1:=BARSLAST(REF(CROSS(DIF,MACD),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,MACD);
DRAWLINE(A1=0,MACD,底背离,MACD,0),COLORYELLOW,LINETHICK2;
A2:=BARSLAST(REF(CROSS(MACD,DIF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(MACD,DIF);
DRAWLINE(A2=0,MACD,顶背离,MACD,0),COLORGREEN,LINETHICK2;
AA1:=IF(DEF>0,1,-1);
AA2:=REF(AA1,1);
AA3:=AA1*AA2;
AA4:=BARSLAST(AA3<0);
AA5:=AA4+1;
面积:SUM(DEF,AA5)/10,COLORGREEN;



  评论这张
 
阅读(4193)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017