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

请老师改写公式 [文华财经]

  • 咨询内容: 请老师帮忙改写下面的公式:
    EMA13:EMA(C,13),COLORWHITE,LINETHICK2;
    EMA34:EMA(C,34),COLORYELLOW;
    EMA55:EMA(C,55),COLORFF00FF;
    EMA120:EMA(C,120),COLORFFCC66;
    AR1:=EMA55>EMA34 AND EMA34>EMA13;
    AR2:=BARSLAST((C-EMA13)/EMA13*100<-6);
    AR3:=EMA13>=REF(EMA13,2);
    AR4:=COUNT(CROSS(C,EMA13),AR2)=1;
    AR5:=AR1 AND AR2 AND AR3 AND AR4;
    AR6:=AR5 AND FILTER(AR5,10);
    DRAWTEXT(AR6,L-0.09,'红杏出墙'),COLORYELLOW;
    STICKLINE(AR6,H,L,0.5,1),COLORYELLOW;
    STICKLINE(AR6,O,C,6,1),LINETHICK2,COLORYELLOW;
    BR1:=COUNT(BETWEEN((C-REF(C,1))/REF(C,1)*100,0,5) ,5)=5;
    BR2:=ABS((EMA13-EMA34)+(EMA34-EMA55))/C<0.2;
    BR3:=C>EMA55 AND (REF(C,1)<REF(EMA55,1) OR REF(C,2)<REF(EMA55,2) OR REF(C,3)<REF(EMA55,3) OR REF(C,4)<REF(EMA55,4) OR REF(C,5)<REF(EMA55,5));
    BR4:=BR1 AND BR2 AND BR3;
    DRAWTEXT(BR4 AND FILTER(BR4,10),L-0.09,'蚂蚁上树'),COLOR00C5FF;
    STICKLINE(BR4 AND FILTER(BR4,10),H,L,0.5,1),COLOR00C5FF;
    STICKLINE(BR4 AND FILTER(BR4,10),O,C,6,1),LINETHICK2,COLOR00C5FF;
    CR1:=(C-REF(C,1))/REF(C,1)*100>0.5;
    CR2:=V>MA(V,5)*0.6;
    CR3:=COUNT(CROSS(EMA13,EMA55),3)=1;
    CR4:=ABS(EMA34-EMA55)/EMA55<0.03;
    CR5:=EMA55<=EMA120 AND EMA55>=REF(EMA55,1);
    CR6:=FILTER(CR1 AND CR2 AND CR3 AND CR4 AND CR5,2);
    STICKLINE(CR6,H,L,0.5,1),COLORF00FF0;
    STICKLINE(CR6,O,C,6,1),LINETHICK2,COLORF00FF0;
    DRAWTEXT(CR6,L-0.09,'红衣侠女'),COLORF00FF0;
    DR1:=EMA13>EMA34 AND EMA34<EMA55;
    DR2:=BARSLAST(CROSS(C,EMA55) );
    DR3:=H=HHV(H,DR2);
    DR4:=BARSLAST(DR3);
    DR5:=COUNT(O>C AND C<REF(C,1) AND C>EMA55 AND BETWEEN((C-EMA55)/EMA55,0,0.02),DR4)=1;
    DR6:=C>REF(C,1) ;
    DR7:= DR1 AND DR5 AND DR6 ;
    DR8:=DR7 AND FILTER(DR7 ,10);
    DRAWTEXT(DR8,L-0.09,'黑客点击'),COLORD6BA63;
    STICKLINE(DR8,H,L,0.5,1),COLORD6BA63;
    STICKLINE(DR8,O,C,6,1),LINETHICK2,COLORD6BA63;
    ER:=BARSLAST(REF(CROSS(EMA55,EMA34),1)) AND CROSS(EMA34,EMA55);
    DRAWTEXT(ER,L-0.09,'均线互换'),COLOR0099FF;
    STICKLINE(ER,H,L,0.5,1),COLOR0099FF;
    STICKLINE(ER,O,C,6,1),LINETHICK2,COLOR0099FF;
    FR:=BARSLAST(REF(CROSS(EMA34,EMA13),1)) AND CROSS(EMA13,EMA34);
    DRAWTEXT(FR,L-0.09,'梅开二度'),COLORWHITE;
    STICKLINE(FR,H,L,0.5,1),COLORWHITE;
    STICKLINE(FR,O,C,6,1),LINETHICK2,COLORWHITE;
    GR1:=BARSLAST(BETWEEN("BIAS.BIAS2"(6,13,24),0,5) );
    GR2:=EMA13>EMA34 AND EMA34>EMA55 AND EMA13>REF(EMA13,1);
    GR3:=COUNT("BIAS.BIAS2"(6,13,24)>10 AND H=HHV(H,GR1),GR1);
    GR4:=H=HHV(H,GR1);
    GR5:="MACD.MACD"(12,26,9)<REF("MACD.MACD"(12,26,9),1);
    GR6:=GR2 AND GR3 AND GR4;
    GR7:=GR2 AND GR3 AND GR4 AND GR5;
    DRAWTEXT(GR6 AND GR7,H+0.13,'见好就收!'),COLOR00FF00;
    STICKLINE(GR6 AND GR7,H,H+0.09,4,0),COLOR00FF00;
    HR2:=EMA13>=REF(EMA13,3) AND EMA34>=REF(EMA34,1) AND EMA55>=REF(EMA55,1) AND CROSS(C,EMA13) AND CROSS(C,EMA34) AND CROSS(C,EMA55);
    DRAWTEXT(HR2 AND FILTER(HR2,10),L-0.09,'三线推进'),COLORFFC8FF;
    STICKLINE(HR2 AND FILTER(HR2,10),H,L,0.5,1),COLORFFC8FF;
    STICKLINE(HR2 AND FILTER(HR2,10),O,C,6,1),LINETHICK2,COLORFFC8FF;
    这个公式应该只有做多,能加上做空吗?另外参数为5、15、30、60日均线。谢谢

     

  • 文华技术人员:  

     您的源码中缺少

    "BIAS.BIAS2"(6,13,24)的定义,请您确认一下该变量是如何定义的。

    另外,该语句本身不含有交易指令,您的具体的交易策略是怎样的?

     

  • 文华客服: BIAS是乖离律,参数是6、13、24。
    我想要的是在出现文字提示的时候同时有声音提示,这个公式是股票的,只适合做多,没有做空,您能帮我修改一下,既能多又能空,至于交易指令就不要了,只要有提示就行。

     

  • 网友回复:

    代码修改如下:

    BIAS1:=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100;//收盘价减去收盘价在L1周期内的简单移动平均,除以收盘价在L1周期内的简单移动平均乘以100;
    BIAS2:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;//同上
    BIAS3:=(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100;//同上
    DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
    DEA  := EMA(DIFF,9);
    MACD:=2*(DIFF-DEA),COLORSTICK;
    EMA13:EMA(C,13),COLORWHITE;
    EMA34:EMA(C,34),COLORYELLOW;
    EMA55:EMA(C,55),COLORGREEN;
    EMA120:EMA(C,120),COLORRED;
    AR1:=EMA55>EMA34 AND EMA34>EMA13;
    AR2:=BARSLAST((C-EMA13)/EMA13*100<-6);
    AR3:=EMA13>=REF(EMA13,2);
    AR4:=COUNT(CROSS(C,EMA13),AR2)=1;
    AR5:=AR1 AND AR2 AND AR3 AND AR4;
    AR6:=AR5 AND FILTER(AR5,10);
    DRAWTEXT(AR6,L-0.09,'红杏出墙');
    DRAWLINE(AR6 ,H , AR6,L ,COLORYELLOW );
    STICKLINE(AR6,O,C,COLORYELLOW,0);
    BR1:=COUNT(BETWEEN((C-REF(C,1))/REF(C,1)*100,0,5) ,5)=5;
    BR2:=ABS((EMA13-EMA34)+(EMA34-EMA55))/C<0.2;
    BR3:=C>EMA55 AND (REF(C,1)<REF(EMA55,1) OR REF(C,2)<REF(EMA55,2) OR REF(C,3)<REF(EMA55,3) OR REF(C,4)<REF(EMA55,4) OR REF(C,5)<REF(EMA55,5));
    BR4:=BR1 AND BR2 AND BR3;
    DRAWTEXT(BR4 AND FILTER(BR4,10),L-0.09,'蚂蚁上树');
    DRAWLINE(BR4 AND FILTER(BR4,10) ,H , BR4 AND FILTER(BR4,10),L ,COLORGREEN );
    STICKLINE(BR4 AND FILTER(BR4,10),O,C,COLORGREEN,0);
    CR1:=(C-REF(C,1))/REF(C,1)*100>0.5;
    CR2:=V>MA(V,5)*0.6;
    CR3:=COUNT(CROSS(EMA13,EMA55),3)=1;
    CR4:=ABS(EMA34-EMA55)/EMA55<0.03;
    CR5:=EMA55<=EMA120 AND EMA55>=REF(EMA55,1);
    CR6:=FILTER(CR1 AND CR2 AND CR3 AND CR4 AND CR5,2);
    DRAWLINE(CR6,H,CR6,L,COLORRED);
    STICKLINE(CR6,O,C,COLORRED,0);
    DRAWTEXT(CR6,L-0.09,'红衣侠女');
    DR1:=EMA13>EMA34 AND EMA34<EMA55;
    DR2:=BARSLAST(CROSS(C,EMA55) );
    DR3:=H=HHV(H,DR2);
    DR4:=BARSLAST(DR3);
    DR5:=COUNT(O>C AND C<REF(C,1) AND C>EMA55 AND BETWEEN((C-EMA55)/EMA55,0,0.02),DR4)=1;
    DR6:=C>REF(C,1) ;
    DR7:= DR1 AND DR5 AND DR6 ;
    DR8:=DR7 AND FILTER(DR7 ,10);
    DRAWTEXT(DR8,L-0.09,'黑客点击');
    DRAWLINE(DR8,H,DR8,L,COLORBLUE);
    STICKLINE(DR8,O,C,COLORBLUE,0);
    ER:=BARSLAST(REF(CROSS(EMA55,EMA34),1)) AND CROSS(EMA34,EMA55);
    DRAWTEXT(ER,L-0.09,'均线互换');
    DRAWLINE(ER,H,ER,L,COLORCYAN);
    STICKLINE(ER,O,C,COLORCYAN,0);
    FR:=BARSLAST(REF(CROSS(EMA34,EMA13),1)) AND CROSS(EMA13,EMA34);
    DRAWTEXT(FR,L-0.09,'梅开二度');
    DRAWLINE(FR,H,FR,L,COLORWHITE);
    STICKLINE(FR,O,C,COLORWHITE,0);
    GR1:=BARSLAST(BETWEEN(BIAS2,0,5) );
    GR2:=EMA13>EMA34 AND EMA34>EMA55 AND EMA13>REF(EMA13,1);
    GR3:=COUNT(BIAS2>10 AND H=HHV(H,GR1),GR1);
    GR4:=H=HHV(H,GR1);
    GR5:=MACD<REF(MACD,1);
    GR6:=GR2 AND GR3 AND GR4;
    GR7:=GR2 AND GR3 AND GR4 AND GR5;
    DRAWTEXT(GR6 AND GR7,H+0.13,'见好就收!');
    STICKLINE(GR6 AND GR7,H,H+0.09,COLORLIGHTBLUE,0);
    HR2:=EMA13>=REF(EMA13,3) AND EMA34>=REF(EMA34,1) AND EMA55>=REF(EMA55,1) AND CROSS(C,EMA13) AND CROSS(C,EMA34) AND CROSS(C,EMA55);
    DRAWTEXT(HR2 AND FILTER(HR2,10),L-0.09,'三线推进');
    DRAWLINE(HR2 AND FILTER(HR2,10),H,HR2 AND FILTER(HR2,10),L,COLORMAGENTA);
    STICKLINE(HR2 AND FILTER(HR2,10),O,C,COLORMAGENTA,0);

    仅凭借代码无法明确的判断交易思路是怎样的,您可以根据其指标效果总结下您的交易思路,才能为您将其转化为模型。

     

  • 网友回复: 好的,谢谢。

 

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

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


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

相关文章

    没有相关内容