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

[求助] 帮忙编写预警公式 [文华财经]

  • 咨询内容: 老师您好:请帮忙编写一下同时出现"多”“多.BMP"和”空“”空.BMP"预警公式,谢谢

    LHS:IF(DATE>200421,NULL,1),NODRAW;A:=EMA2(HIGH,30);
    B:=EMA2(LOW,30);
    A1:=EMA2(HIGH,150),LINETHICK2;
    B1:=EMA2(LOW,150)*LHS,LINETHICK2;
    S1:=CROSS(CLOSE,EMA2(HIGH,150))*LHS,LINETHICK2;
    X1:=CROSS(EMA2(LOW,150),CLOSE)*LHS,LINETHICK2;
    WS1:=BARSLAST(S1)+1*LHS,LINETHICK2;
    WX1:=BARSLAST(X1)+1*LHS,LINETHICK2;
    SS1:=CROSS(SUM(S1,WX1),0.5)*LHS,LINETHICK2;
    XX1:=CROSS(SUM(X1,WS1),0.5)*LHS,LINETHICK2;
    S:=CROSS(CLOSE,EMA2(HIGH,30))*LHS,LINETHICK2;
    X:=CROSS(EMA2(LOW,30),CLOSE)*LHS,LINETHICK2;
    WS:=BARSLAST(S)+1*LHS,LINETHICK2;
    WX:=BARSLAST(X)+1,LINETHICK2;
    SS:=CROSS(SUM(S,WX),0.5)*LHS,LINETHICK2;
    XX:=CROSS(SUM(X,WS),0.5)*LHS,LINETHICK2;
     STICKLINE(SUM(X,WS)>0.5 && CLOSE>=OPEN,OPEN,CLOSE,COLORCYAN,1);
    STICKLINE(SUM(X,WS)>0.5 && CLOSE<OPEN,OPEN,CLOSE,COLORCYAN,0);
    DRAWLINE(SUM(X,WS)>0.5,HIGH,CLOSE>OPEN,CLOSE,COLORCYAN);
    DRAWLINE(SUM(X,WS)>0.5,LOW,CLOSE>OPEN,OPEN,COLORCYAN);
    DRAWLINE(SUM(X,WS)>0.5,HIGH,CLOSE<OPEN,OPEN,COLORCYAN);
    DRAWLINE(SUM(X,WS)>0.5,LOW,CLOSE<OPEN,CLOSE,COLORCYAN);
    DRAWLINE(SUM(X,WS)>0.5,HIGH,CLOSE=OPEN,LOW,COLORCYAN);
    STICKLINE(SUM(S,WX)>0.5 && CLOSE>=OPEN,OPEN,CLOSE,COLORRED,1);
    STICKLINE(SUM(S,WX)>0.5 && CLOSE<OPEN,OPEN,CLOSE,COLORRED,0);
    DRAWLINE(SUM(S,WX)>0.5,HIGH,CLOSE>OPEN,CLOSE,COLORRED);
    DRAWLINE(SUM(S,WX)>0.5,LOW,CLOSE>OPEN,OPEN,COLORRED);
    DRAWLINE(SUM(S,WX)>0.5,HIGH,CLOSE<OPEN,OPEN,COLORRED);
    DRAWLINE(SUM(S,WX)>0.5,LOW,CLOSE<OPEN,CLOSE,COLORRED);
    DRAWLINE(SUM(S,WX)>0.5,HIGH,CLOSE=OPEN,LOW,COLORRED);
    DRAWBMP(SS,LOW-5,'.BMP';
    DRAWBMP(XX,HIGH+5,'.BMP';
    DIFF:=(EMA(C,12)-EMA(C,26)),COLORWHITE;
    DEA  : =EMA(DIFF,9),COLORYELLOW;
    MACD := 2*(DIFF-DEA),COLORYELLOW;
    MACDMA:=EMA(MACD,3),COLORMAGENTA,LINETHICK1;
    RMACD:=REF(MACD,1);
    J:=CROSS(DIFF,DEA);
    AT:=2*(DIFF-DEA),COLORSTICK,NOTEXT;
    MACDD:IF(AT>0,AT,NULL),COLORRED,NODRAW;
    MACDD.:IF(AT<0,AT,NULL),COLORGREEN,NODRAW;
    VA1:=HHVBARS(MACD,BARSLAST(MACD<0)+1);
    VA2:=CROSS(BACKSET(CROSS(0,MACD) OR (ISLASTBAR AND MACD>0),REF(VA1,1)+2),0.5);
    P:=BACKSET(ISLASTBAR,SUMBARS(VA2,1));
    VA3:=LLVBARS(MACD,BARSLAST(MACD>0)+1);
    VA4:=CROSS(BACKSET(CROSS(MACD,0) OR (ISLASTBAR AND MACD<0),REF(VA3,1)+2),0.5);
    Q:=BACKSET(ISLASTBAR,SUMBARS(VA4,1));
    TT:=BACKSET(ISLASTBAR,MAX(SUMBARS(VA2,1),SUMBARS(VA4,1)));
    DRAWTEXT(CROSS(Q,0.5)&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,H),'',VALIGN1,COLORRED,FONTSIZE30;
    DRAWTEXT(CROSS(P,0.5)&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,H),'',VALIGN1,COLORGREEN,FONTSIZE20;
    DRAWTEXT(BARSLASTCOUNT(P)<BARSLASTCOUNT(Q)&&CROSS(P,0.5),VALUEWHEN(VA2,H),'',VALIGN1,COLORGREEN,FONTSIZE30;
    DRAWTEXT(BARSLASTCOUNT(P)>BARSLASTCOUNT(Q)&&CROSS(Q,0.5),VALUEWHEN(VA4,L),'',VALIGN1,COLORYELLOW,FONTSIZE20;
    FROMOPEN:=IF(HOUR<12,60*(HOUR-9)-30+MINUTE,120+60*(HOUR-13)+MINUTE);
    VAR1:=(2*CLOSE+HIGH+LOW)/40;
    VAR2:=EMA(EMA(EMA(VAR1,4),4),4);
    DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA2,H),0,-BARSLASTCOUNT(P)+1,0,COLORWHITE),LINETHICK1;
    DRAWSL(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA4,L),0,-BARSLASTCOUNT(Q)+1,0,COLORWHITE),LINETHICK1;
    DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)>BARSLASTCOUNT(Q),VALUEWHEN(VA2,H),BARSLASTCOUNT(Q)-1,1,VALUEWHEN(VA2,H),BARSLASTCOUNT(P)-1,0),COLORWHITE,LINETHICK1;
    DRAWLINE3(ISLASTBAR&&BARSLASTCOUNT(P)<BARSLASTCOUNT(Q),VALUEWHEN(VA4,L),BARSLASTCOUNT(P)-1,1,VALUEWHEN(VA4,L),BARSLASTCOUNT(Q)-1,0),COLORWHITE,LINETHICK1;

    MA3:=MA(C,170);
    DRAWGBK(MA3>C,RGB(0,0,0),RGB(9,60,1),0);
    DRAWGBK(MA3<C,RGB(0,0,0),RGB(62,1,1),0);
    DRAWGBK(MA3=0,RGB(0,0,0),RGB(0,0,0),0);
    HH1:=IFELSE(H<REF(H,1)&&REF(H,1)<REF(H,2),REF(H,2),0)*LHS,LINETHICK2;
    LL1:=IFELSE(L>REF(L,1)&&REF(L,1)>REF(L,2),REF(L,2),0)*LHS,LINETHICK2;
    HH2:=VALUEWHEN(HH1>0,HH1)*LHS,LINETHICK2;
    LL2:=VALUEWHEN(LL1>0,LL1)*LHS,LINETHICK2;
    K1:=IFELSE(CLOSE>HH2,-3,IFELSE(CLOSE<LL2,1,0))*LHS,LINETHICK2;
    K2:=VALUEWHEN(K1<>0,K1)*LHS,LINETHICK2;
    G:=IFELSE(K2=1,HH2,LL2)*LHS,LINETHICK2;
    G1:=VALUEWHEN(ISLASTBAR,G)*LHS,LINETHICK2;
    DRAWNUMBER(L>0,G1,G1,0,COLORCYAN);
    W1:=K2*LHS,LINETHICK2;
    W2:=OPEN-CLOSE*LHS,LINETHICK2;
    HT:=IFELSE(OPEN>CLOSE,OPEN,CLOSE)*LHS,LINETHICK2;
    LT:=IFELSE(OPEN<CLOSE,OPEN,CLOSE)*LHS,LINETHICK2;
     
    DRAWLINE(W1=1&&REF(W1,1)=1,G,W1=1&&REF(W1,1)=1,REF(G,1),COLORGREEN),DOT;
    DRAWLINE(W1=-3&&REF(W1,1)=-3,G,W1=-3&&REF(W1,1)=-3,REF(G,1),COLORYELLOW),DOT;
    DRAWSL(K2=1,G,0,1,0,COLORGREEN),DOT;
    DRAWSL(K2=-3,G,0,1,0,COLORYELLOW),DOT;
    DRAWTEXT(CROSS(W1,0),HT+6,'',COLORGREEN,ALIGN0,FONTSIZE20;
    DRAWTEXT(CROSS(0,W1),LT-5,'',COLORYELLOW,ALIGN0,FONTSIZE20;
    N3:=BARSLAST(CROSS(W1>0,0.5))*LHS,LINETHICK2;
    N4:=BARSLAST(CROSS(W1<=0,0.5))*LHS,LINETHICK2;
    HH3:=IF(W1<=0,REF(HV(H,N4),N3),NULL),COLORYELLOW,DOT;
    LL3:=IF(W1>0,REF(LV(L,N3),N4),NULL),COLORGREEN,DOT;

     

     来源:程序化99

  • 文华技术人员:  加入下面两句
    DRAWBMP(CROSS(W1,0),HT+6,''; DRAWBMP(CROSS(0,0\W1),LT-5,'';

 

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

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

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

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


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

相关文章

    没有相关内容