分享

文华公式 附图MACD

 一名津人 2018-09-07
  
 
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK;
JC:=CROSS(DIFF,DEA);
SC:=CROSSDOWN(DIFF,DEA);
N1:=BARSLAST(JC)+1;
N2:=BARSLAST(SC)+1;
HH:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(H,N1));//上次MACD红柱期间合约最大值
HH2:=VALUEWHEN(CROSSDOWN(DIFF,DEA),REF(HH,1));//上上次MACD红柱期间合约最大值
MHD:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(MACD,N1));//上次MACD红柱期间MACD最大值
MHD2:=VALUEWHEN(CROSSDOWN(DIFF,DEA),REF(MHD,1));//上上次MACD红柱期间MACD最大值
LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));//上次MACD绿柱期间合约最小值
LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));//上上次MACD绿柱期间合约最小值
MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));//上次MACD绿柱期间MACD最小值
MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));//上上次MACD绿柱期间MACD最小值
A:=CROSSDOWN(DIFF,DEA)&&HH>HH2&&MHD<MHD2;//顶背离
B:=CROSS(DIFF,DEA)&&LL<LL2&&MLD>MLD2;//底背离
DRAWICON(A,MACD,'ICO2');
DRAWICON(B,MACD,'ICO1');
A,SOUND('ICO1');
B,SOUND('ICO2');
COUNT(MACD>0,20)<=2;//20周期内红柱数量小于等于2
STICKLINE(MACD>0,MACD,0,3,1),COLORRED;
STICKLINE(MACD<0,MACD,0,3,1),COLORGREEN;//
DRAWTEXT(A,DIFF,'底背离');
DRAWTEXT(B,DIFF,'底抬升');
PLAYSOUND(C>A&&CROSS(A,B),'B');
PLAYSOUND(C>A&&CROSS(B,A),'B');
A1:=CROSS(BACKSET(A,SUMBARS(A,1)),0.5);
B1:=CROSS(BACKSET(B,SUMBARS(B,1)),0.5);
DRAWLINE1(B1,DIFF,B,DIFF,0);
DRAWLINE1(A1,DIFF,A,DIFF,0);

 
  
 
 
  
 

DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),NODRAW;
DRAWICON(MACD>0&&MACD<REF(MACD,1)&&REF(MACD,1)>REF(MACD,2),MACD,5),VALIGN2;
DRAWICON(MACD<0&&MACD>REF(MACD,1)&&REF(MACD,1)<REF(MACD,2),MACD,4),VALIGN0;
STICKLINE1(MACD>=0,0,MACD,0.5,1),COLORRED;
STICKLINE1(MACD<0,0,MACD,0.5,1),COLORCYAN;
STICKLINE1(MACD>0&&MACD<REF(MACD,1)&&REF(MACD,1)>REF(MACD,2),0,MACD,1,1),COLORYELLOW;
STICKLINE1(MACD<0&&MACD>REF(MACD,1)&&REF(MACD,1)<REF(MACD,2),0,MACD,1,1),COLORYELLOW;
IF(DIFF<=DEA,DEA,NULL),RGB(0,255,128);
IF(DEA>=DIFF,DIFF,NULL),RGB(0,255,128);
IF(DIFF>DEA,DEA,NULL),RGB(255,128,192);
IF(DEA<DIFF,DIFF,NULL),RGB(255,128,192);

 

  

X_1:=MA(CLOSE,1);

DIF:EMA(X_1,6)-EMA(X_1,13),COLORWHITE;

DEA:EMA(DIF,4),COLORWHITE;

MACD:(DIF-DEA)*2,COLORSTICK;

IF(DIF>=REF(DIF,1),DIF,NULL),COLORRED;

IF(DEA>=REF(DEA,1),DEA,NULL),COLORRED;

IF(DIF>=REF(DIF,1) AND DIF>0 AND DIF<MACD AND MACD>=REF(MACD,1),DIF,NULL),COLORYELLOW;

散户出逃系数:IF(DEA>=REF(DEA,1) AND DEA>0,DEA,NULL),COLORGREEN,LINETHICK2;

X_2:=MA(CLOSE,1);

X_3:=EMA(X_2,12)-EMA(X_2,26)-0.01;

X_4:=EMA(X_3,9);

X_5:=(X_3-X_4)*2;

X_6:=MA(CLOSE,5);

X_7:=MA(CLOSE,13);

X_8:=MA(CLOSE,21);

机构抢筹系数:IF(CLOSE>X_8 AND X_3<X_5,DIF,NULL),COLORYELLOW,LINETHICK2;

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多