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

麻烦老师整合公式 [文华财经]

  • 咨询内容:  麻烦老师去掉公式一中的MA21/MA60的两根均线,然后把公式一和公式二整合成一个公式,谢谢!  公式一:
    //MA5:MA(C,5),COLORWHITE;


    STEP1:=2/100;
    MVALUE1:=120/100;//20
    SARLINE:SAR(4,STEP1,MVALUE1),NODRAW;
    IF(SARLINE<0,ABS(SARLINE),NULL),CIRCLEDOT,COLORCYAN;
    IF(SARLINE>0,SARLINE,NULL),CIRCLEDOT,COLORRED;




    MA60:MA(C,60),LINETHICK1,COLORMAGENTA;
    XCLOSE2:=EMA((OPEN+HIGH+LOW+CLOSE)/4,3);
    //PARTLINE1((MA60>=XCLOSE2),MA60),LINETHICK3,COLORBLUE;
    //PARTLINE1((MA60<XCLOSE2),MA60),LINETHICK3,COLORMAGENTA;
    //DRAWCOLORLINE(MA60>REF(MA60,1),MA60,COLORRED,COLORGREEN),LINETHICK3;




    //--飘带变色
    DIFF1:=(EMA(CLOSE,12) - EMA(CLOSE,26))*4.1;
    DEA1:=EMA(DIFF1,9); 
    DKB:MA60+DIFF1;
    DKA:MA60+DEA1;
    FILLRGN(DKB>DKA,DKB,DKA,RGB(81,18,2)); 
    FILLRGN(DKB<DKA,DKB,DKA, COLOR007300);


    DRAWCOLORKLINE(DKB>DKA&&ISDOWN,COLORMAGENTA,0);
    DRAWCOLORKLINE(DKB>DKA&&ISDOWN=0,COLORMAGENTA,1);
    CROSS(DKB>DKA,0.5),SOUND('';
    DRAWCOLORKLINE(DKB<DKA&&ISDOWN,COLORCYAN,0);
    DRAWCOLORKLINE(DKB<DKA&&ISDOWN=0,COLORCYAN,1);
    CROSS(DKB<DKA,0.5),SOUND('';
       DRAWCOLORLINE(DKB>DKA,DKB,COLORRED,COLORGREEN);DRAWCOLORLINE(DKB>DKA,DKA,COLORRED,COLORGREEN);
    X:=PERIOD=1||PERIOD=3||PERIOD=5||PERIOD=7||PERIOD=8;
    Q:=BACKSET(ISLASTBAR,SUMBARS(DAYBARPOS=1,5));
    DRAWSL(CROSS(C,MA60)&&DKB>DKA&&X&&Q,C,0,10,0,COLORYELLOW);
    DRAWSL(CROSSDOWN(C,MA60)&&DKB<DKA&&X&&Q,C,0,10,0,COLORYELLOW);


    DRAWTEXT(CROSS(SARLINE>0&&DKB>DKA,0.5),L,'#39),VALIGN0;
    DRAWTEXT(CROSS(SARLINE<0&&DKB<DKA,0.5),H,'#39);
    DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
    DEA:=EMA(DIFF,9);
    MACD:=2*(DIFF-DEA),COLORSTICK;
    MA21:MA(C,21),COLORYELLOW,LINETHICK2;
    DRAWCOLORKLINE(CROSS(DIFF>0&&MACD>0&&MA21>REF(MA21,1),0.5),COLORYELLOW,0);
    DRAWCOLORKLINE(CROSS(DIFF<0&&MACD<0&&MA21<REF(MA21,1),0.5),COLORGREEN,0);
    DRAWCOLORKLINE(CROSSDOWN(DIFF,DEA)&&DIFF>0,RGB(0,128,255),0);
    DRAWCOLORKLINE(CROSS(DIFF,DEA)&&DIFF<0,COLORWHITE,0);
    //DRAWTEXT(CROSS(DIFF>0&&MACD>0&&MA21>REF(MA21,1),0.5),H,'',COLORYELLOW,FONTSIZE25;
    //DRAWTEXT(CROSS(DIFF<0&&MACD<0&&MA21<REF(MA21,1),0.5),H,'',COLORGREEN,FONTSIZE25;
    DRAWTEXT(CROSSDOWN(DIFF,DEA)&&DIFF>0,H,'',RGB(128,128,255),FONTSIZE25;
    DRAWTEXT(CROSS(DIFF,DEA)&&DIFF<0,H,'',COLORWHITE,FONTSIZE25;
    //MA20:MA(C,20),COLORRED,NODRAW;
    //DRAWCOLORLINE(MA20>REF(MA20,1),MA21,COLORYELLOW,COLORCYAN),LINETHICK2;
    公式二: //MA5:MA(C,5),LINETHICK2,COLORWHITE;//MA10:MA(C,10);//MA20:MA(C,20),LINETHICK2;//MA30:MA(C,30);//MA60:MA(C,60);//MA120:MA(C,120);//MA250:MA(C,250),LINETHICK2;
    TOWERC:=FORCAST(EMA((3*CLOSE+2*OPEN+HIGH+LOW)/7,3),6);//WWW.CHNMONEY.COMDIRECTIONMAX:=MAX(REF(TOWERC,1),REF(TOWERC,1));DIRECTIONMIN:=MIN(REF(TOWERC,1),REF(TOWERC,1));
    DRAWCOLORKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN,COLORLIGHTRED,1);DRAWCOLORKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN=0,COLORLIGHTRED,1);DRAWCOLORKLINE(TOWERC<REF(TOWERC,1)&&ISDOWN,COLORCYAN,0);DRAWCOLORKLINE(TOWERC<REF(TOWERC,1)&&ISDOWN=0,COLORCYAN,1);//MA120:MA(C,120);//MA250:MA(C,250);//DRAWCOLORLINE(MA60>REF(MA60,1),MA60,COLORMAGENTA,COLORGREEN);//DRAWCOLORLINE(MA120>REF(MA120,1),MA120,COLORRED,COLORGREEN);//DRAWCOLORLINE(MA250>REF(MA250,1),MA250,COLORWHITE,COLORGREEN);STICKLINE1(TOWERC>=REF(TOWERC,1)&&ISDOWN,C,O,3,0),COLORCYAN;STICKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN,C,O,COLORRED,1);//DRAWCOLORLINE(MA20>REF(MA20,1),MA20,COLORYELLOW,COLORGREEN);TY:=C;
    X:=8;
    A1:=REF(TY,X)=HHV(TY,2*X+1);
    B3:=FILTER(A1,X);
    C1E:=BACKSET(B3,X+1);
    HD:=FILTER(C1E,X);
    A2:=REF(TY,X)=LLV(TY,2*X+1);
    B4:=FILTER(A2,X);
    C2:=BACKSET(B4,X+1);
    LD:=FILTER(C2,X);
    AQ:=REF(C,BARSLAST(HD)),COLORFFFFFF,LINETHICK3,PRECIS1;
    BQ:=REF(C,BARSLAST(LD)),COLORFFFFFF,LINETHICK3,PRECIS1;
    T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD);T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);上:IF(T1,AQ,AQ),COLORGREEN,DOT,PRECIS0;STICKLINE1(T1,AQ,AQ,7,0),COLORGREEN,PRECIS1;
    DRAWSL(T1,AQ,0,1,0,COLORGREEN),LINETHICK3;下:IF(T2,BQ,BQ),COLORRED,DOT,PRECIS1;STICKLINE1(T2,BQ,BQ-3*MINPRICE,7,0),COLORWHITE,PRECIS1;H>=上&&L<=上||H>=下&&L<=下,SOUND('';

     

     来源:程序化99

  • 文华技术人员:   参考:

    STEP1:=2/100;MVALUE1:=120/100;//20SARLINE:SAR(4,STEP1,MVALUE1),NODRAW;IF(SARLINE<0,ABS(SARLINE),NULL),CIRCLEDOT,COLORCYAN;IF(SARLINE>0,SARLINE,NULL),CIRCLEDOT,COLORRED;MA60:=MA(C,60),LINETHICK1,COLORMAGENTA;XCLOSE2:=EMA((OPEN+HIGH+LOW+CLOSE)/4,3);
    DIFF1:=(EMA(CLOSE,12) - EMA(CLOSE,26))*4.1;DEA1:=EMA(DIFF1,9); DKB:MA60+DIFF1;DKA:MA60+DEA1;FILLRGN(DKB>DKA,DKB,DKA,RGB(81,18,2)); FILLRGN(DKB<DKA,DKB,DKA, COLOR007300);
    DRAWCOLORKLINE(DKB>DKA&&ISDOWN,COLORMAGENTA,0);DRAWCOLORKLINE(DKB>DKA&&ISDOWN=0,COLORMAGENTA,1);CROSS(DKB>DKA,0.5),SOUND('';DRAWCOLORKLINE(DKB<DKA&&ISDOWN,COLORCYAN,0);DRAWCOLORKLINE(DKB<DKA&&ISDOWN=0,COLORCYAN,1);CROSS(DKB<DKA,0.5),SOUND('';DRAWCOLORLINE(DKB>DKA,DKB,COLORRED,COLORGREEN);DRAWCOLORLINE(DKB>DKA,DKA,COLORRED,COLORGREEN);
    X:=PERIOD=1||PERIOD=3||PERIOD=5||PERIOD=7||PERIOD=8;Q:=BACKSET(ISLASTBAR,SUMBARS(DAYBARPOS=1,5));DRAWSL(CROSS(C,MA60)&&DKB>DKA&&X&&Q,C,0,10,0,COLORYELLOW);DRAWSL(CROSSDOWN(C,MA60)&&DKB<DKA&&X&&Q,C,0,10,0,COLORYELLOW);DRAWTEXT(CROSS(SARLINE>0&&DKB>DKA,0.5),L,'#39),VALIGN0;DRAWTEXT(CROSS(SARLINE<0&&DKB<DKA,0.5),H,'#39);
    DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);DEA:=EMA(DIFF,9);MACD:=2*(DIFF-DEA),COLORSTICK;MA21:=MA(C,21),COLORYELLOW,LINETHICK2;DRAWCOLORKLINE(CROSS(DIFF>0&&MACD>0&&MA21>REF(MA21,1),0.5),COLORYELLOW,0);DRAWCOLORKLINE(CROSS(DIFF<0&&MACD<0&&MA21<REF(MA21,1),0.5),COLORGREEN,0);DRAWCOLORKLINE(CROSSDOWN(DIFF,DEA)&&DIFF>0,RGB(0,128,255),0);DRAWCOLORKLINE(CROSS(DIFF,DEA)&&DIFF<0,COLORWHITE,0);DRAWTEXT(CROSSDOWN(DIFF,DEA)&&DIFF>0,H,'',RGB(128,128,255),FONTSIZE25;DRAWTEXT(CROSS(DIFF,DEA)&&DIFF<0,H,'',COLORWHITE,FONTSIZE25;
    TOWERC:=FORCAST(EMA((3*CLOSE+2*OPEN+HIGH+LOW)/7,3),6);//WWW.CHNMONEY.COMDIRECTIONMAX:=MAX(REF(TOWERC,1),REF(TOWERC,1));DIRECTIONMIN:=MIN(REF(TOWERC,1),REF(TOWERC,1));
    DRAWCOLORKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN,COLORLIGHTRED,1);DRAWCOLORKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN=0,COLORLIGHTRED,1);DRAWCOLORKLINE(TOWERC<REF(TOWERC,1)&&ISDOWN,COLORCYAN,0);DRAWCOLORKLINE(TOWERC<REF(TOWERC,1)&&ISDOWN=0,COLORCYAN,1);
    STICKLINE1(TOWERC>=REF(TOWERC,1)&&ISDOWN,C,O,3,0),COLORCYAN;STICKLINE(TOWERC>=REF(TOWERC,1)&&ISDOWN,C,O,COLORRED,1);
    TY:=C;XX:=8;A1:=REF(TY,XX)=HHV(TY,2*XX+1);B3:=FILTER(A1,XX);C1E:=BACKSET(B3,XX+1);HD:=FILTER(C1E,XX);A2:=REF(TY,XX)=LLV(TY,2*XX+1);B4:=FILTER(A2,XX);C2:=BACKSET(B4,XX+1);LD:=FILTER(C2,XX);AQ:=REF(C,BARSLAST(HD)),COLORFFFFFF,LINETHICK3,PRECIS1;BQ:=REF(C,BARSLAST(LD)),COLORFFFFFF,LINETHICK3,PRECIS1;T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD);T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);上:IF(T1,AQ,AQ),COLORGREEN,DOT,PRECIS0;STICKLINE1(T1,AQ,AQ,7,0),COLORGREEN,PRECIS1;
    DRAWSL(T1,AQ,0,1,0,COLORGREEN),LINETHICK3;下:IF(T2,BQ,BQ),COLORRED,DOT,PRECIS1;STICKLINE1(T2,BQ,BQ-3*MINPRICE,7,0),COLORWHITE,PRECIS1;H>=上&&L<=上||H>=下&&L<=下,SOUND('';

     

     来源: WWW.CXH99.COM

  • 文华客服:  23行: Q:=BACKSET(ISLASTBAR,SUMBARS(DAYBARPOS=1,5)); 老师,在文华8上加载时,2楼公式中的23行显示“第23行 非法的逗号,可能漏写了函数名!”,改改,谢谢。

     

  • 网友回复:   您的源码中含有未来函数,需要加载到wh6或wh7看盘软件中使用,
    wh8是量化交易软件,不支持未来函数的。

     

  • 网友回复:  老师,那如何改成量化可用呢?    再麻烦老师 
  • 网友回复:把2楼公式中的K线颜色恢复成正常K线,其他不变,谢谢!

 

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

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

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

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


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

相关文章

    没有相关内容