您现在的位置:程序化交易>> 期货公式>> 博易大师>> 博易大师知识>>正文内容

请老师帮忙改一下 [博易POBO]

咨询内容:

请老师帮忙改一下

老师,我要顶/底背离变色,红绿柱不变色
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),NODRAW;
JC:=CROSS(DIFF,DEA);
SC:=CROSS(DEA,DIFF);
N1:=BARSLAST(JC)+1;
N2:=BARSLAST(SC)+1;
HH:=VALUEWHEN(CROSS(DEA,DIFF),HHV(H,N1));//上次MACD红柱期间合约最大值
HH2:=VALUEWHEN(CROSS(DEA,DIFF),REF(HH,1));//上上次MACD红柱期间合约最大值
MHD:=VALUEWHEN(CROSS(DEA,DIFF),HHV(MACD,N1));//上次MACD红柱期间MACD最大值
MHD2:=VALUEWHEN(CROSS(DEA,DIFF),REF(MHD,1));//上上次MACD红柱期间MACD最大值
LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));
LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));
MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));
MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));
A:=MACD<0&&HH>HH2&&MHD<MHD2;//顶背离
B:=MACD>0&&LL<LL2&&MLD>MLD2;
A1:=BACKSET(A,HHVBARS(MACD,N1)+1);
A2:=BACKSET(A,HHVBARS(MACD,SUMBARS(JC,2))+1);
B1:=BACKSET(B,LLVBARS(MACD,N2)+1);
B2:=BACKSET(B,LLVBARS(MACD,SUMBARS(SC,2))+1);
DRAWTEXT(CROSS(A1,0.5),MACD,'顶背离'),VALIGN2,COLORRED;
DRAWTEXT(CROSS(B1,0.5),MACD,'底背离'),VALIGN0,COLORGREEN;
STICKLINE(MACD>0&&MACD>REF(MACD,1),0,MACD,5,0),COLORRED;
STICKLINE(MACD>0&&MACD<REF(MACD,1),0,MACD,5,0),COLORYELLOW;
STICKLINE(MACD<0&&MACD>REF(MACD,1),0,MACD,5,0),COLORGREEN;
STICKLINE(MACD<0&&MACD<REF(MACD,1),0,MACD,5,0),COLORBLUE;
 

 

 来源:程序化99网( WWW.CXH99.COM )

博易技术人员: DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK;
JC:=CROSS(DIFF,DEA);
SC:=CROSS(DEA,DIFF);
N1:=BARSLAST(JC)+1;
N2:=BARSLAST(SC)+1;
HH:=VALUEWHEN(CROSS(DEA,DIFF),HHV(H,N1));//上次MACD红柱期间合约最大值
HH2:=VALUEWHEN(CROSS(DEA,DIFF),REF(HH,1));//上上次MACD红柱期间合约最大值
MHD:=VALUEWHEN(CROSS(DEA,DIFF),HHV(MACD,N1));//上次MACD红柱期间MACD最大值
MHD2:=VALUEWHEN(CROSS(DEA,DIFF),REF(MHD,1));//上上次MACD红柱期间MACD最大值
LL:=VALUEWHEN(CROSS(DIFF,DEA),LLV(L,N2));
LL2:=VALUEWHEN(CROSS(DIFF,DEA),REF(LL,1));
MLD:=VALUEWHEN(CROSS(DIFF,DEA),LLV(MACD,N2));
MLD2:=VALUEWHEN(CROSS(DIFF,DEA),REF(MLD,1));
A:=MACD<0&&HH>HH2&&MHD<MHD2;//顶背离
B:=MACD>0&&LL<LL2&&MLD>MLD2;
A1:=BACKSET(A,HHVBARS(MACD,N1)+1);
A2:=BACKSET(A,HHVBARS(MACD,SUMBARS(JC,2))+1);
B1:=BACKSET(B,LLVBARS(MACD,N2)+1);
B2:=BACKSET(B,LLVBARS(MACD,SUMBARS(SC,2))+1);
DRAWTEXT(CROSS(A1,0.5),MACD,'顶背离'),VALIGN2,COLORRED;
DRAWTEXT(CROSS(B1,0.5),MACD,'底背离'),VALIGN0,COLORGREEN;
STICKLINE(CROSS(A1,0.5),0,MACD,2,0),COLORGREEN;
STICKLINE(CROSS(B1,0.5),0,MACD,2,0),COLORYELLOW; 来源 程序化久久网

 

有思路,想编写各种指标公式,交易模型,选股公式,还原公式的朋友

可联系技术人员 QQ: 262069696  点击在线交流或微信号:cxh99cxh99  进行 有偿收费 编写!

怎么收费,代编流程等详情请点击阅读!

(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,加好友时请简单备注下您的需求,否则无法通过。谢谢您!)


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

相关文章

    没有相关内容