macd背离建仓
short:=12;long:=26;n:=5;m:=9;n1:=21;m1:=10;m2:=80;m3:=20;
diff := ma(ema(close,short) - ema(close,long),n);
dea : =ema(diff,m);
macdx : 2*(diff-dea),colorwhite;
zero : =0;
gj:=max(c,o);
stickline(macdx>0 and macdx>=ref(macdx,1),0,macdx,2,0),color0000ff;
stickline(macdx>0 and macdx<ref(macdx,1),0,macdx,2,0),colorffff00;
stickline(macdx<0 and macdx>=ref(macdx,1),0,macdx,2,0),colorff00ff;///
stickline(macdx<0 and macdx<ref(macdx,1),0,macdx,2,0),color00ff00;
l4:=llv(gj,4);//www.goodgongshi.com
jl:=(hhv(diff,55)-llv(diff,55))/5;
gt:=dea>ref(dea,1) and ref(dea,1)<ref(dea,2);
a1:=barslast(ref(gt,1));
//底背离:=ref(l4,a1+1)>close and diff>ref(diff,a1+1) and gt;
//drawline(a1=0,dea,底背离,ref(dea,a1),0),colorred,linethick2;
//drawline(底背离,dea,底背离,ref(dea,a1),0),colorred,linethick2;
//drawtext(底背离,ref(dea,a1)*1.18,' 底背离'),colorff00ff;
h4:=hhv(gj,4);
gt2:=dea<ref(dea,1) and ref(dea,1)>ref(dea,2);
a2:=barslast(ref(gt2,1));
//顶背离:= ref(h4,a2+1)<h4 and diff<ref(diff,a2+1) and gt2;
//drawline(a2=0 ,dea,顶背离,ref(dea,a2),0),colorgreen,linethick2;
//drawline(顶背离,dea,顶背离,ref(dea,a2),0),colorgreen,linethick2;
//drawtext(顶背离,ref(dea,a2)*1.18,' 顶背离'),colorgreen;
////////////////////////////////////////////////////////////////////////////
diffy : =ma(ema(close,short) - ema(close,long),n1);
deay : =ema(diffy,m);
macdy : 2*(diffy-deay),coloryellow;
zeroy : 0;
gjy:=max(c,o);
stickline(macdy>0 and macdx>=ref(macdy,1),0,macdy,2,0),color0000ff;
stickline(macdy>0 and macdx<ref(macdy,1),0,macdy,2,0),colorffff00;
stickline(macdy<0 and macdx>=ref(macdy,1),0,macdy,2,0),colorff00ff;
stickline(macdy<0 and macdx<ref(macdy,1),0,macdy,2,0),color00ff00;
l4y:=llv(gjy,4);
jly:=(hhv(diff,55)-llv(diff,55))/5;
gty:=dea>ref(dea,1) and ref(dea,1)<ref(dea,2);
a1y:=barslast(ref(gty,1));
//底背离y:=ref(l4y,a1y+1)>close and diff>ref(diff,a1y+1) and gty;
//drawline(a1y=0,deay,底背离y,ref(deay,a1y),0),colorred,linethick2;
//drawline(底背离y,deay,底背离y,ref(deay,a1y),0),colorred,linethick2;
//drawtext(底背离y,ref(deay,a1y)*1.18,' 底背离'),colorff00ff;
h4y:=hhv(gjy,4);
gt2y:=dea<ref(dea,1) and ref(dea,1)>ref(dea,2);
a2y:=barslast(ref(gt2y,1));
顶背离y:= ref(h4y,a2y+1)<h4y and diff<ref(diff,a2y+1) and gt2y;
//drawline(a2y=0 ,deay,顶背离y,ref(deay,a2y),0),colorgreen,linethick2;
//drawline(顶背离y,deay,顶背离y,ref(deay,a2y),0),colorgreen,linethick2;
//drawtext(顶背离y,ref(deay,a2y)*1.18,' 顶背离'),colorgreen;
/////////////////////////////////////////////////////////////////////////////
//21日线
drawicon(cross(macdy,0) and c<o,0,6);
drawicon(cross(macdy,0) and c<o,0,2);
drawicon(cross(macdy,0) and c>=o,0,5);
drawicon(cross(macdy,0) and c>=o,0,1);
//5日线
drawicon(cross(macd,0) and c<o,0,6);
drawicon(cross(macd,0) and c<o,0,2);
drawicon(cross(macd,0) and c>=o,0,5);
drawicon(cross(macd,0) and c>=o,0,1);
//////////////////////////////////////////////////////////////////////////////////////////////////////
//必进清仓
ema1:=ema(close,13);
ema2:=ema(close,34),colorred;
ema3:=ema(close,55),colorcyan;
var11:=zig(3,6)>ref(zig(3,6),1) and ref(zig(3,6),1)<=ref(zig(3,6),2) and ref(zig(3,6),2)<=ref(zig(3,6),3);
var12:=zig(3,6)<ref(zig(3,6),1) and ref(zig(3,6),1)>=ref(zig(3,6),2) and ref(zig(3,6),2)>=ref(zig(3,6),3);
var13:=zig(3,22)>ref(zig(3,22),1) and ref(zig(3,22),1)<=ref(zig(3,22),2) and ref(zig(3,22),2)<=ref(zig(3,22),3);
var14:=zig(3,22)<ref(zig(3,22),1) and ref(zig(3,22),1)>=ref(zig(3,22),2) and ref(zig(3,22),2)>=ref(zig(3,22),3);
var15:=zig(3,51)>ref(zig(3,51),1) and ref(zig(3,51),1)<=ref(zig(3,51),2) and ref(zig(3,51),2)<=ref(zig(3,51),3);
var16:=zig(3,51)<ref(zig(3,51),1) and ref(zig(3,51),1)>=ref(zig(3,51),2) and ref(zig(3,51),2)>=ref(zig(3,51),3);
var17:=zig(3,72)>ref(zig(3,72),1) and ref(zig(3,72),1)<=ref(zig(3,72),2) and ref(zig(3,72),2)<=ref(zig(3,72),3);
var18:=zig(3,72)<ref(zig(3,72),1) and ref(zig(3,72),1)>=ref(zig(3,72),2) and ref(zig(3,72),2)>=ref(zig(3,72),3);
买:=(var11+var13+var15+var17);
卖:=(var12+var14+var16+var18);
//威廉指标
wr:=100*(hhv(high,m1)-close)/(hhv(high,m1)-llv(low,m1));
b:=cross(m2,wr);
s:=(cross(wr,m2)) or (cross(wr,m3));
bm:=barslast(b);
sm:=barslast(s);
bm1:=if(bm[1]=-1 and b,1,if(bm[1]!=-1 and sm[1]!=-1 and bm[1]>sm[1] and b and b[1]=0,1,0));
sm1:=if(sm[1]=-1 and bm[1]!=-1 and s,1,if( sm[1]!=-1 and bm[1]!=-1 and sm[1]>bm[1] and s and s[1]=0,1,0));
//大盘金叉
d1:=cross(indexc,ma(indexc,5));
//kqy指标
v1:=ma(c,3)=hhv(ma(c,3),7);
v2:=ma(c,3)>ma(c,5);
v3:=ma(v,5)>ma(v,10)*1.01;
v4:=count(ma(c,1)>ref(c,1),2)=2;
lc20:=ref(close,1);
rsi20:=sma(max(close-lc20,0),4.1,1)/sma(abs(close-lc20),4.1,1)*100;
var3a:=3;//www.goodgongshi.com
var2a:=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);
mtm:=c-ref(c,1);
dx:=100*ema(ema(mtm,6),6)/ema(ema(abs(mtm),6),6);
yxf:=if(llv(dx,2)=llv(dx,7) and count(dx<0,2) and cross(dx,ma(dx,2)),1,0);
加仓:=if(filter(yxf=1,5),5,0),colorliblue,linethick1;
a51:=3*sma((c-llv(l,55))/(hhv(h,55)-llv(l,55))*100,5,1)-2*sma((c-llv(l,55))/(hhv(h,55)-llv(l,55))*100,5,1);
fy:=ema(a51,5);
a54:=((c-llv(l,21))/(hhv(h,21)-llv(l,21)))*100;
var1:=(close-llv(low,9))/(hhv(high,9)-llv(low,9))*50;
kqy1:=(ema(var1,3))*2;
kqy2:=ma(kqy1,3);
买2:=zig(3,10)>ref(zig(3,10),1) and ref(zig(3,10),1)<ref(zig(3,10),2),colorred,linethick2;
卖2:=zig(3,10)<ref(zig(3,10),1) and ref(zig(3,10),1)>ref(zig(3,10),2),colorwhite,linethick1;
//股票均线金叉
jc:=cross(close,ma(close,ma(close,5)));
close_1:=close,colorwhite;
ma5:=ma(close,5),coloryellow;
m5:=ma(close,m),coloryellow;//
m10:=ma(close,10),colormagenta;//
close1:=close,colorwhite;
low1:=low,colorwhite;
low144:=llv(low,144),coloryellow;
low144_1:=low144*0.95,coloryellow;
//stickline(indexc>indexo,low144_1,low144,1,0),colorred;//柱线
//stickline(indexc<indexo,low144_1,low144,1,0),colorgreen;//柱线
//stickline(cross(indexc,ma(indexc,5)),low144_1,low144,8,0),colorred;//柱线
//stickline(cross(ma(indexc,5),indexc),low144_1,low144,8,0),colorgreen;//柱线
//stickline(close>=m5,c,m5,2,0),colorred;//柱线
//stickline(close<m5,c,m5,2,0),colorcyan;//柱线
drawicon(买>0,macd*0.9,5);//
drawicon((bm1>0 and 买>0) or (d1 and 买>0) or (买2=1 and 买>0) or (jc and 买>0),macd*0.9,1);
//drawnumber((bm1>0 and 买>0) or (d1 and 买>0) or (买2=1 and 买>0) or (jc and 买>0),low144_1*0.95,tostring(macd,2));
drawicon(卖>0,macd*1.2,6);//
drawicon(卖>0,macd*1.2,2);
//drawnumber(卖>0,macd,tostring(h,2));
drawnumber(卖>0,macd*1.3,tostring(卖,2)),colorgreen;//
drawnumber(买>0,macd*1.3,tostring(买,2)),coloryellow;//
//鬼谷神算简化的公式:
bb:=zig(3,50/5)*100,coloryellow;
bb_1:=zig(3,10),nodraw;
gg:=ma(bb,2),colorred;
dd:=cross(bb,gg)*1000,colorred;
ww:=cross(gg,bb)*1000,colorblue;
drawtext(dd=1000,macd*1.2,'建仓'),colorred;//
drawtext(ww=1000,macd*1.2,'清仓' ),colorgreen;//
y1:=fallcount,nodraw;
y2:=risecount,nodraw;
x:=strleft(code,1),nodraw;
//二金叉
verline(cross(ma(close,5),ma(close,13)) and cross(macdx,macdy),1),colormagenta;////画加仓建仓垂线
上一指标公式:主力KD趋势雷达 副图指标下载 同花顺趋势KD
下一指标公式:四色花仙花仙子指标下载 同花顺四色
☉ 好公式网发布的指标公式主要用于软件技术面分析,仅供参考,勿用于实际操作,据此操作风险自负!
☉ 解压密码:www.goodgongshi.com 就是好公式网域名,希望大家看清楚,切勿输错。
☉ tnc和tni格式指标公式,仅可以用通达信软件引入使用,例如可以用通达信软件引入使用指标公式;
☉ tne格式指标公式,仅可以用通达信软件公式编辑器5.0版导入,高版本兼容低版本;
☉ fnc格式指标公式,可以用大智慧软件新一代高速行情分析系统股票软件使用,少部分可以用分析家软件引入使用;
☉ alg格式指标公式,仅仅可以用飞狐交易师软件引入使用;exp格式指标公式,仅可以用大智慧经典版软件引入使用;
☉ hxf格式指标公式,仅可以用同花顺软件引入使用。
☉ 如果您发现下载软件链接错误,请联系管理员报告错误。
☉ 好公式网欢迎各位网友帮忙宣传转发本站网址,有您的支持,我们会做得更好!
☉ 本文MACD背离建仓 指标源码下载 同花顺建仓MACD仅供学习研究。