您现在的位置:程序化交易>> 期货公式>> 文华财经>> 文华财经知识>>正文内容

老师MACD改下背离 [文华财经]

  • 咨询内容: 第一种:白线背离,移动平均线两个高位白线在黄线上方,价格创新高移动平均线没创新高。要求:后面白线低于前面白线,白线勾头并且K线收阴线同时满足,收盘后指标立刻标注顶背离 第二种:红柱背离(中间夹有蓝柱),价格创新高红柱没创新高,要求:后面区域最高柱体比前面区域最高柱体低,后面的那部分柱体缩小并且K线收阴线同时满足,收盘后立刻标注顶背离 第三种:红柱背离(中间无蓝柱),价格创新高红柱没创新高,要求:后面区域最高柱体比前面区域最高柱体低,后面的那部分柱体缩小并且K线收阴线同时满足,收盘后立刻标注顶背离
    顶背离用蓝色字体,底背离用红色字体,字体标注在指标上,上面3种顶背离对应3种底背离,共6种背离,麻烦老师了

     

     来源:程序化99

  • 文华技术人员: 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;//底背离 DRAWTEXT(A,MACD,'顶2'); DRAWTEXT(B,MACD,'底2');

    Q:=CROSSDOWN(MACD,REF(MACD,1)); W:=CROSS(MACD,REF(MACD,1)); C1:=VALUEWHEN(Q,REF(C,1)); C2:= VALUEWHEN(Q,REF(C1,1)); M1:=VALUEWHEN(Q,REF(MACD,1)); M2:=VALUEWHEN(Q,REF(M1,1)); A1:=Q&&SUMBARS(Q,2)<N1&&M1<M2&&MACD>0&&C1>C2;
    C11:=VALUEWHEN(W,REF(C,1)); C22:= VALUEWHEN(W,REF(C11,1)); M11:=VALUEWHEN(W,REF(MACD,1)); M22:=VALUEWHEN(W,REF(M1,1)); B1:=W&&SUMBARS(W,2)<N2&&M11>M22&&MACD<0&&C1<C2; DRAWTEXT(A1,MACD,'顶3'); DRAWTEXT(B1,MACD,'底3');
    D1:=VALUEWHEN(CROSSDOWN(DIFF,REF(DIFF,1)),REF(DIFF,1)); D2:=VALUEWHEN(CROSSDOWN(DIFF,REF(DIFF,1)),REF(D1,1)); DC1:=VALUEWHEN(CROSSDOWN(DIFF,REF(DIFF,1)),REF(C,1)); DC2:=VALUEWHEN(CROSSDOWN(DIFF,REF(DIFF,1)),REF(DC1,1)); A3:=CROSSDOWN(DIFF,REF(DIFF,1))&&SUMBARS(CROSSDOWN(DIFF,REF(DIFF,1)),2)<N1&&D1<D2&&DC1>DC2&&ISDOWN;

    DD1:=VALUEWHEN(CROSS(DIFF,REF(DIFF,1)),REF(DIFF,1)); DD2:=VALUEWHEN(CROSS(DIFF,REF(DIFF,1)),REF(DD1,1)); DDC1:=VALUEWHEN(CROSS(DIFF,REF(DIFF,1)),REF(C,1)); DDC2:=VALUEWHEN(CROSS(DIFF,REF(DIFF,1)),REF(DDC1,1)); B3:=CROSS(DIFF,REF(DIFF,1))&&SUMBARS(CROSS(DIFF,REF(DIFF,1)),2)<N2&&DD1>DD2&&DDC1<DDC2&&ISUP;
    DRAWTEXT(A3,DIFF,'顶3'); DRAWTEXT(B3,DIFF,'底3');

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息或微信:cxhjy888 进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容