macd背离公式源码: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背离选股公式一 :diff:=ema(close,12)-ema(close,26);dea:=ema(diff,9);macd:=2*(diff-dea);a1:=barslast(ref(cross(diff,dea),1));底背离:ref(close,a1+1)>close and diff>ref(diff,a1+1) and cross(diff,dea);macd背离选股公式二dif:=ema(close,12)-ema(close,26);dea:=ema(dif,9);macd0:=(dif-dea)*2;mj:=macd0;s05:=sum(mj,0);qst:=barslast(mj<0 and ref(mj,1)>0)+1;qxt:=barslast(mj>0 and ref(mj,1)<0)+1;s5:=if(mj>0,s05-ref(s05,barslast(mj<0)),s05-ref(s05,barslast(mj>0)))/10;st:=if(mj>0,ref(qst,qxt)+qxt,ref(qxt,qst)+qst);rs5:=ref(s5,st);bc:if(mj>0 and s5<rs5,0,if(mj<0 and s5>rs5 and dea<0,1,0));股票背离公式还有cci背离、kkj背离等等,如果需要,我可以再给你发几个。股票公式专家团为你解答,希望能帮到你,祝投资顺利。 20210311