文华公式WH3经典多空交易模型


程序化交易模型源码:
A:=(3*CLOSE+LOW+OPEN+HIGH)/6;
BB:(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+14*REF(A,6) +13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12) +7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+ REF(A,20))/210,COLORYELLOW;
dd:=MA(BB,10),COLORYELLOW;
KG1:=VOL>REF(HHV(VOL,6),1);
W2:=OPEN-CLOSE;
HH1:= IFELSE (H<REF(H,2)&&REF(H,1)<REF(H,2),REF(H,2),0);
LL1:= IFELSE (L>REF(L,2)&&REF(L,1)>REF(L,2),REF(L,2),0);
HH2:=VALUEWHEN(HH1>0,HH1);
LL2:=VALUEWHEN(LL1>0,LL1);
KA1:= IFELSE (CLOSE>HH2,-3,IFELSE(CLOSE<LL2,1,0));
KA2:=VALUEWHEN(KA1<>0,KA1);
GA:=IFELSE(KA2=1,HH2,LL2);
GA1:=VALUEWHEN(ISLASTBAR,GA);
DRAWNUMBER(L>0,GA1,GA1,0,COLORBLUE);
W1:=KA2;
U1:=(HIGH+LOW+CLOSE*2)/4;
HT:= IFELSE (OPEN>CLOSE,OPEN,CLOSE);
LT:= IFELSE (OPEN<CLOSE,OPEN,CLOSE);
DRAWLINE(W1=1,HIGH,W1=1,HT,COLORBLUE);
DRAWLINE(W1=1,LOW,W1=1,LT,COLORBLUE);
DRAWLINE(W1=-3,HIGH,W1=-3,HT,COLORRED);
DRAWLINE(W1=-3,LOW,W1=-3,LT,COLORRED);
STICKLINE(W1>0,OPEN,CLOSE,COLORBLUE,1);
STICKLINE(W1<=0,OPEN,CLOSE,COLORRED,1);
D:= VALUEWHEN(KG1, (HIGH+LOW)/2);STICKLINE(W2>0&&W1<=0,OPEN,CLOSE,COLORRED,0);
STICKLINE(W2>0&&W1>0,OPEN,CLOSE,COLORBLUE,0);
HO:= HIGH >REF( HIGH,1) &&HIGH >REF(HIGH,2) && HIGH >=REFX(HIGH,1) && IFELSE(HIGH =REFX(HIGH,2), HIGH >REFX(HIGH,3), HIGH >REFX(HIGH,2));
FXH:=CROSS(HO,0.9);
HH:=REF(HIGH,BARSLAST(FXH));
LO:= LOW <REF(LOW,1) && LOW <REF(LOW,2) && LOW <=REFX(LOW,1) && IFELSE(LOW =REFX(LOW,2), LOW <REFX(LOW,3), LOW <REFX(LOW,2));
FXL:=CROSS(LO,0.9);
LL:=REF(LOW,BARSLAST(FXL));
STICKLINE(CLOSE,HH,HH-0.0001,COLORMAGENTA,0);
STICKLINE(CLOSE,LL,LL-0.0001,COLORLIGHTBLUE,0);
W2>0&&W1<=0,BPK;
W2>0&&W1>0,SPK;
AUTOFILTER;


点击复制上述代码粘贴到到公式管理器