DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);DEA:EMA(DIFF,9);MACD:2*(DIFF-DEA),NODRAW;STICKLINE1(MACD<REF(MACD,1)ANDMACD>0,0,MACD,0,0),COLORYELLOW;STICKLINE1(MACD>=REF(MACD,1)ANDMACD>0,0,MACD,0,0),RGB(217,47,11);STICKLINE1(MACD>REF(MACD,1)ANDMACD<0,0,MACD,0,0),RGB(255,77,255);STICKLINE1(MACD<=REF(MACD,1)ANDMACD<0,0,MACD,0,0),COLOR00FFFF;DRAWGBK(C>0,RGB(0,50,9),RGB(0,0,0),0);JC:=CROSS(DIFF,DEA);SC:=CROSSDOWN(DIFF,DEA);N1:=BARSLAST(JC)+1;N2:=BARSLAST(SC)+1;HH:=REF(HHV(H,N1),N2);//上次MACD红柱期间合约最大值HH2:=REF(REF(HH,1),N2);//上上次MACD红柱期间合约最大值MHD:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(DIFF,N1));//上次MACD红柱期间DIFF最大值MHD2:=VALUEWHEN(CROSSDOWN(DIFF,DEA),REF(MHD,1));//上上次MACD红柱期间DIFF最大值LL:=REF(LLV(L,N2),N1);LL2:=REF(REF(LL,1),N1);MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(DIFF,N2));MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));A:MACD<0&&HH>HH2&&MHD<MHD2;//顶背离B:MACD>0&&LL<LL2&&MLD>MLD2;DRAWTEXT(CROSS(A,),DIFF,'顶背离');DRAWTEXT(CROSS(B,),DIFF,'底背离');CROSS(A,),SOUND('A');CROSS(B,),SOUND('A');IF(DIFF>0&&DIFF>REF(DIFF,1),DIFF,NULL),COLORRED,HICK2;IF(DIFF>0&&DIFF<REF(DIFF,1),DIFF,NULL),COLORCYAN,HICK1;IF(DIFF<0&&DIFF>REF(DIFF,1),DIFF,NULL),COLORMAGENTA,HICK1;IF(DIFF<0&&DIFF<REF(DIFF,1),DIFF,NULL),COLORYELLOW,HICK2;HH4:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(H,N1));//上次MACD红柱期间合约最大值HH5:=VALUEWHEN(CROSSDOWN(DIFF,DEA),REF(HH4,1));//上上次MACD红柱期间合约最大值MHD4:=VALUEWHEN(CROSSDOWN(DIFF,DEA),HHV(MACD,N1));//上次MACD红柱期间MACD最大值MHD5:=V
文华财经指标公式源码 买卖提示指标公式 来自淘豆网m.daumloan.com转载请标明出处.