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

麻烦老师修改一下错误 [博易POBO]

咨询内容:

麻烦老师修改一下错误

RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;

K:=SMA(RSV,3,1);

D:=SMA(K,3,1);

J:=3*K-2*D;

DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);

DEA:=EMA(DIFF,9);

MACD:=2*(DIFF-DEA);

RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;

KK:=SMA(RSV1,3,1);

DD:=SMA(KK,3,1);

JJ:=3*KK-2*DD;

KX:=250;

KH:=HHV(K,KX);

DH:=HHV(D,KX);

JH:=HHV(J,KX);

KL:=LLV(K,KX);

DL:=LLV(D,KX);

JL:=LLV(J,KX);

HKMAX:=MAX(KH,MAX(DH,JH));

LKMIN:=MIN(KL,MIN(DL,JL));

KHLB:=(HKMAX+LKMIN)/2;

KHLC:=HKMAX-LKMIN;

MHF:=HHV(DIFF,KX);

MHD:=HHV(DEA,KX);

MHM:=HHV(MACD,KX);

MLF:=LLV(DIFF,KX);

MLD:=LLV(DEA,KX);

MLM:=LLV(MACD,KX);

HMAX:=MAX(MHF,MAX(MHD,MHM));

LMIN:=MIN(MLF,MIN(MLD,MLM));

FHLB:=(HMAX-LMIN)/100;

FHLC:=HMAX-LMIN;

SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;

DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;

DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;

DRAWBAND(DIFFA,RGB(255,64,64),DEAA,RGB(64,255,64));

MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;

CDA:=MACD<REF(MACD,1) AND MACD>0;

CDB:=MACD>=REF(MACD,1) AND MACD>0;

CDC:=MACD>REF(MACD,1) AND MACD<0;

CDD:=MACD<=REF(MACD,1) AND MACD<0;

STICKLINE(CDA,SH,MACDA,0.1,0),COLORLIBLUE;{0上蓝柱}

STICKLINE(CDB,SH,MACDA,0.1,0),COLORRED; {0上红柱}

STICKLINE(CDC,SH,MACDA,0.1,0),COLORRED;{0下红柱}

STICKLINE(CDD,SH,MACDA,0.1,0),COLORLIBLUE;{0下蓝柱}

DRAWTEXT(BARSTATUS=2,SH,' 0轴'),COLORWHITE;

{-------------------------------------------------------------}

{传统KDJ}

KKK:SMA(RSV,3,1),COLORWHITE,LINETHICK2;

DDD:SMA(KKK,3,1),COLORYELLOW,LINETHICK2;

JJJ:3*KKK-2*DDD,COLORMAGENTA,LINETHICK2;

DRAWTEXT(ISLASTBAR,KKK,'  ←K'),COLORWHITE;

DRAWTEXT(ISLASTBAR,DDD,'  ←D'),COLORYELLOW;

DRAWTEXT(ISLASTBAR,JJJ,'  ←J'),COLORMAGENTA;

{MACD KDJ 金叉共振 信号}

A:=CROSS(DIFF,DEA) AND CROSS(KKK,DDD) AND CROSS(JJJ,DDD);

{共振出现时图标}

DRAWICON(A,20,25);

DRAWTEXT(A,20,'  MACD&KDJ金叉共振'),COLORYELLOW;

{低位金叉标识}

低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;

DRAWICON(低位金叉,10,41);

DRAWTEXT(低位金叉,10,'  MACD低位金叉'),COLORWHITE;

{二次金叉}

JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));

二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;

DRAWICON(二次金叉,0,41);

DRAWTEXT(二次金叉,0,'  MACD二次金叉'),COLORYELLOW;

{MACD,KDJ,RSI顶底背离}

{MACD底背}

A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));

B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);

{MACD顶背}

C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));

D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);

{MACD底背信号}

DRAWICON((B1>0),-10,41);

DRAWTEXT((B1>0),-10,'  MACD底背离'),COLORRED;

{MACD顶背信号}

DRAWICON((D1>0),-10,37);

DRAWTEXT((D1>0),-10,'  MACD顶背离'),COLORGREEN;

{KDJ底背}

A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));

B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS

("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));

{KDJ顶背}

C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));

D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS

("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));

{KDJ底背信号}

DRAWICON((B2>0),85,41);

DRAWTEXT((B2>0),85,'  KDJ底背离'),COLORWHITE;

{KDJ顶背信号}

DRAWICON((D2>0),85,37);

DRAWTEXT((D2>0),85,'  KDJ顶背离'),COLORGREEN;

{RSI底背}

A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));

B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS

("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));

{RSI顶背}

C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));

D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS

("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));

{RSI顶背信号}

DRAWICON((D3>0),-20,37);

DRAWTEXT((D3>0),-20,'  RSI顶背离'),COLORGREEN;

{RSI底背信号}

DRAWICON((B3>0),-20,41);

DRAWTEXT((B3>0),-20,'  RSI底背离'),COLORRED;

{KDJ日周共振}

N:=1;

日K:=KDJ.K;

日D:=KDJ.D;

日J:=KDJ.J;

周K:=KDJ.K#WEEK,NODRAW;

周D:=KDJ.D#WEEK,NODRAW;

周J:=KDJ.J#WEEK,NODRAW;

日金叉:=CROSS(日K,日D) AND (日D<40 OR 日D>60);

周金叉:=CROSS(周K,周D) AND (周D<40 OR 周D>60);

{}

共振:=(周金叉 AND 日金叉);

DRAWTEXT((周金叉 AND 日金叉),75,'  KDJ日周共振'),COLORYELLOW;

DRAWICON((周金叉 AND 日金叉),75,25);

 

 

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

博易技术人员: 路过
不会编程。
 
简单扫视一遍,不知这程序是为长线、中线,还是短线编制的?似乎都不适用,短线设置周期太长,中长线又太短。
选4小时以下【2小时】做短线,月线【周线】为中线,更能捕捉市场的真实状态。
 
正研究
  RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;

K:=SMA(RSV,3,1);

D:=SMA(K,3,1);

J:=3*K-2*D;

DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);

DEA:=EMA(DIFF,9);

MACD:=2*(DIFF-DEA);

RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;

KK:=SMA(RSV1,3,1);

DD:=SMA(KK,3,1);

JJ:=3*KK-2*DD;

KX:=250;

KH:=HHV(K,KX);

DH:=HHV(D,KX);

JH:=HHV(J,KX);

KL:=LLV(K,KX);

DL:=LLV(D,KX);

JL:=LLV(J,KX);

HKMAX:=MAX(KH,MAX(DH,JH));

LKMIN:=MIN(KL,MIN(DL,JL));

KHLB:=(HKMAX+LKMIN)/2;

KHLC:=HKMAX-LKMIN;

MHF:=HHV(DIFF,KX);

MHD:=HHV(DEA,KX);

MHM:=HHV(MACD,KX);

MLF:=LLV(DIFF,KX);

MLD:=LLV(DEA,KX);

MLM:=LLV(MACD,KX);

HMAX:=MAX(MHF,MAX(MHD,MHM));

LMIN:=MIN(MLF,MIN(MLD,MLM));

FHLB:=(HMAX-LMIN)/100;

FHLC:=HMAX-LMIN;

SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;

DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;

DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;

{DRAWBAND(DIFFA,RGB(255,64,64),DEAA,RGB(64,255,64));}

MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;

CDA:=MACD<REF(MACD,1)ANDMACD>0;

CDB:=MACD>=REF(MACD,1)ANDMACD>0;

CDC:=MACD>REF(MACD,1)ANDMACD<0;

CDD:=MACD<=REF(MACD,1)ANDMACD<0;

STICKLINE(CDA,SH,MACDA,0.1,0),COLORFFFF00;{0上蓝柱}

STICKLINE(CDB,SH,MACDA,0.1,0),COLORRED;{0上红柱}

STICKLINE(CDC,SH,MACDA,0.1,0),COLORRED;{0下红柱}

STICKLINE(CDD,SH,MACDA,0.1,0),COLORFFFF00;{0下蓝柱}

DRAWTEXT(BARSTATUS=2,SH,'0轴'),COLORWHITE;

{-------------------------------------------------------------}

{传统KDJ}

KKK:SMA(RSV,3,1),COLORWHITE,LINETHICK2;

DDD:SMA(KKK,3,1),COLORYELLOW,LINETHICK2;

JJJ:3*KKK-2*DDD,COLORMAGENTA,LINETHICK2;

DRAWTEXT(ISLASTBAR,KKK,' ←K'),COLORWHITE;

DRAWTEXT(ISLASTBAR,DDD,' ←D'),COLORYELLOW;

DRAWTEXT(ISLASTBAR,JJJ,' ←J'),COLORMAGENTA;

{MACDKDJ金叉共振信号}

A:=CROSS(DIFF,DEA)ANDCROSS(KKK,DDD)ANDCROSS(JJJ,DDD);

{共振出现时图标}

DRAWICON(A,20,25);

DRAWTEXT(A,20,' MACD&KDJ金叉共振'),COLORYELLOW;

{低位金叉标识}

低位金叉:=CROSS(DIFF,DEA)ANDDIFF<-0.1;

DRAWICON(低位金叉,10,41);

DRAWTEXT(低位金叉,10,' MACD低位金叉'),COLORWHITE;

{二次金叉}

JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));

二次金叉:=CROSS(DIFF,DEA)ANDDEA<0ANDCOUNT(JCCOUNT=2,21)=1;

DRAWICON(二次金叉,0,41);

DRAWTEXT(二次金叉,0,' MACD二次金叉'),COLORYELLOW;

{MACD,KDJ,RSI顶底背离}

{MACD底背}

A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));

B1:=REF(C,A1+1)>CANDREF(DIFF,A1+1)<DIFFANDCROSS(DIFF,DEA);

{MACD顶背}

C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));

D1:=REF(C,C1+1)<CANDREF(DIFF,C1+1)>DIFFANDCROSS(DEA,DIFF);

{MACD底背信号}

DRAWICON((B1>0),-10,41);

DRAWTEXT((B1>0),-10,' MACD底背离'),COLORRED;

{MACD顶背信号}

DRAWICON((D1>0),-10,37);

DRAWTEXT((D1>0),-10,' MACD顶背离'),COLORGREEN;

{KDJ底背}

A2:=BARSLAST(REF(CROSS(STKINDI('',0,'KDJ.K',9,3,3),STKINDI('',0,'KDJ.D',9,3,3)),1));

B2:=REF(C,A2+1)>CANDREF(STKINDI('',0,'KDJ.K',9,3,3),A2+1)<STKINDI('',0,'KDJ.K',9,3,3)ANDCROSS

(STKINDI('',0,'KDJ.K',9,3,3),STKINDI('',0,'KDJ.D',9,3,3));

{KDJ顶背}

C2:=BARSLAST(REF(CROSS(STKINDI('',0,'KDJ.D',9,3,3),STKINDI('',0,'KDJ.K',9,3,3)),1));

D2:=REF(C,C2+1)<CANDREF(STKINDI('',0,'KDJ.K',9,3,3),C2+1)>STKINDI('',0,'KDJ.K',9,3,3)ANDCROSS

(STKINDI('',0,'KDJ.D',9,3,3),STKINDI('',0,'KDJ.K',9,3,3));

{KDJ底背信号}

DRAWICON((B2>0),85,41);

DRAWTEXT((B2>0),85,' KDJ底背离'),COLORWHITE;

{KDJ顶背信号}

DRAWICON((D2>0),85,37);

DRAWTEXT((D2>0),85,' KDJ顶背离'),COLORGREEN;

{RSI底背}

A3:=BARSLAST(REF(CROSS(STKINDI('',0,'RSI.RSI1',6,12,24),STKINDI('',0,'RSI.RSI2',6,12,24)),1));

B3:=REF(C,A3+1)>CANDREF(STKINDI('',0,'RSI.RSI1',6,12,24),A3+1)<STKINDI('',0,'RSI.RSI1',6,12,24)ANDCROSS

(STKINDI('',0,'RSI.RSI1',6,12,24),STKINDI('',0,'RSI.RSI2',6,12,24));

{RSI顶背}

C3:=BARSLAST(REF(CROSS(STKINDI('',0,'RSI.RSI2',6,12,24),STKINDI('',0,'RSI.RSI1',6,12,24)),1));

D3:=REF(C,C3+1)<CANDREF(STKINDI('',0,'RSI.RSI1',6,12,24),C3+1)>STKINDI('',0,'RSI.RSI1',6,12,24)ANDCROSS

(STKINDI('',0,'RSI.RSI2',6,12,24),STKINDI('',0,'RSI.RSI1',6,12,24));

{RSI顶背信号}

DRAWICON((D3>0),-20,37);

DRAWTEXT((D3>0),-20,' RSI顶背离'),COLORGREEN;

{RSI底背信号}

DRAWICON((B3>0),-20,41);

DRAWTEXT((B3>0),-20,' RSI底背离'),COLORRED;

{KDJ日周共振}

N:=1;

日金叉:=CROSS(STKINDI('',6,'KDJ.K'),STKINDI('',6,'KDJ.D'))AND(STKINDI('',6,'KDJ.D')<40ORSTKINDI('',6,'KDJ.D')>60);

周金叉:=CROSS(STKINDI('',7,'KDJ.K'),STKINDI('',7,'KDJ.K'))AND(STKINDI('',7,'KDJ.D')<40ORSTKINDI('',7,'KDJ.D')>60);

{}

共振:=(周金叉AND日金叉);

DRAWTEXT((周金叉AND日金叉),75,' KDJ日周共振'),COLORYELLOW;

DRAWICON((周金叉AND日金叉),75,25); 来源 程序化久久网

 

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

可联系技术人员 QQ: 511411198  有需要帮忙请点击这里留言!!!或微信:cxhjy888 进行 有偿 编写!

怎么收费,代编流程等详情请点击阅读,或QQ微信联系我们!


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

相关文章

    没有相关内容