在线检测未来函数

飞狐多空转换主图指标公式

来源:Internet,编辑:股旁网,2016-02-04

input: k(1,0,3),n1(4,1,255),n(10,1,255),p1(3,1,255),m1(3,2,40),m2(3,2,40);
UP:=eMA(HIGH,40),COLORWHITE;
DOWN:=eMA(LOW,40),COLORWHITE;
STICKLINE(CLOSE>UP,OPEN,CLOSE,8,2),COLORRED;
STICKLINE(CLOSE>UP AND OPEN>CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORRED;
STICKLINE(CLOSE>UP AND OPEN>CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORRED;
STICKLINE(CLOSE>UP AND OPEN<=CLOSE,OPEN,CLOSE,8,0),COLORRED;
STICKLINE(CLOSE>UP AND OPEN<CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORRED;
STICKLINE(CLOSE>UP AND OPEN<CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORRED;
STICKLINE(CLOSE<DOWN,OPEN,CLOSE,8,0),COLORcyan;
STICKLINE(CLOSE<DOWN AND OPEN>CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORcyan;
STICKLINE(CLOSE<DOWN AND OPEN>CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORcyan;
STICKLINE(CLOSE<DOWN AND OPEN<=CLOSE,OPEN,CLOSE,8,2),COLORcyan;
STICKLINE(CLOSE<DOWN AND OPEN<CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORcyan;
STICKLINE(CLOSE<DOWN AND OPEN<CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORcyan;
STICKLINE(CLOSE>DOWN && CLOSE<UP,OPEN,CLOSE,8,0),COLORgray;
STICKLINE(CLOSE>DOWN && CLOSE<UP AND OPEN>CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORgray;
STICKLINE(CLOSE>DOWN && CLOSE<UP AND OPEN>CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORgray;
STICKLINE(CLOSE>DOWN && CLOSE<UP AND OPEN<=CLOSE,OPEN,CLOSE,8,0),COLORgray;
STICKLINE(CLOSE>DOWN && CLOSE<UP AND OPEN<CLOSE,HIGH,MAX(OPEN,CLOSE),0,0),COLORgray;
STICKLINE(CLOSE>DOWN && CLOSE<UP AND OPEN<CLOSE,MIN(OPEN,CLOSE),LOW,0,0),COLORgray;
F:=EMA(CLOSE,5);
X:=EMA(CLOSE,34),COLORGRAY,linethick1;
KS:=IF(BARSCOUNT(CLOSE)=1,CLOSE/10000,(1-CLOSE/SMA(CLOSE,13,1))*100);
RKS:=REF(KS,1);
MLS:=RKS/KS>1.23 AND RKS>10 AND CLOSE/REF(CLOSE,1)>1.02;
J:=STICKLINE(KS>=10,HIGH,LOW,0,1);
权:=EMA(CLOSE,13);
证:=EMA(KS*CLOSE/100+权,3);
反弹:=STICKLINE(MLS=1,HIGH,LOW,0,1);
下档线:=(((CLOSE - LLV(LOW,13)) / (HHV(HIGH,13) - LLV(LOW,13))) * 100);
aRSV:=SMA(下档线,3,1);
aK:=SMA(aRSV,3,1);
aD:=((3 * aRSV) - (2 * aK));
aJ12:=(((CLOSE - LLV(LOW,55)) / (HHV(HIGH,55) - LLV(LOW,55))) * 100);
aRSV24:=SMA(aJ12,3,1);
aK24:=SMA(aRSV24,3,1);
aD24:=((3 * aRSV24) - (2 * aK24));
撑压位:=IF(CROSS(aD24,aD),HIGH,REF(HIGH,BARSLAST(CROSS(aD24,aD))));
底:=LLV(HIGH,30);
STICKLINE(BARSTATUS=2 ,撑压位,撑压位,30,1),LINETHICK1,COLORyellow;
DRAWTEXT(BARSTATUS=2 ,撑压位,' 撑压'),COLORyellow,PXUP20;
STICKLINE(BARSTATUS=2 ,底,底,30,1),COLORred,LINETHICK3;
DRAWTEXT(BARSTATUS=2 ,底,' 底线'),COLORred;
IF k=1 then begin
aa:=REF(HIGH,n1)=HHV(HIGH,2*n1+1);
aaa:=FILTER(aa,n1);
bb:=BACKSET(aaa,n1+1);
cc1:=FILTER(bb,n1);
cc:=cc1 or BARSTATUS=2;
aa2:=REF(LOW,n1)=LLV(LOW,2*n1+1);
aaa2:=FILTER(aa2,n1);
bb2:=BACKSET(aaa2,n1+1);
cc22:=FILTER(bb2,n1);
cc2:=cc22 and NOT(cc1);
ea:=BACKSET(cc,REF(BARSLAST(cc2),1)+1);
eb:=ea>REF(ea,1);
ee:=BACKSET(eb,2);
ff1:=ee>REF(ee,1);
ee2:=BACKSET(ff1 and COUNT(cc,REF(BARSLAST(cc2),1)+2)=0,REF(BARSLAST(cc2),1)+2);
ff2:=ee2>REF(ee2,1);
ee3:=BACKSET(ff2 and COUNT(cc,REF(BARSLAST(cc2),1)+2)=0,REF(BARSLAST(cc2),1)+2);
ff3:=ee3>REF(ee3,1);
js:=IF(cc,COUNT(cc2,REF(BARSLAST(cc),1)+1),0);
g1:=IF(js=1 and cc,BARSLAST(ff1),0);
ga:=IF(cc and REF(LOW,BARSLAST(ff1))>=REF(LOW,BARSLAST(ff2)),BARSLAST(ff2),BARSLAST(ff1));
g2:=IF(js=2 and cc,ga,0);
g3:=IF(js>=3 and cc,IF(cc and REF(LOW,ga)>=REF(LOW,BARSLAST(ff3)),BARSLAST(ff3),ga),0);
gg:=g1+g2+g3;
ja:=BACKSET(cc,gg);
jb:=ja>REF(ja,1);
jj:=BACKSET(jb,2);
ld:=jj>REF(jj,1);
ld1:=ld or BARSTATUS=2;
hea:=BACKSET(ld1,REF(BARSLAST(cc),1)+1);
heb:=hea>REF(hea,1);
hee:=BACKSET(heb,2);
hff1:=hee>REF(hee,1);
hee2:=BACKSET(hff1 and COUNT(ld1,REF(BARSLAST(cc),1)+2)=0,REF(BARSLAST(cc),1)+2);
hff2:=hee2>REF(hee2,1);
hee3:=BACKSET(hff2 and COUNT(ld1,REF(BARSLAST(cc),1)+2)=0,REF(BARSLAST(cc),1)+2);
hff3:=hee3>REF(hee3,1);
hjs:=IF(ld1,COUNT(cc1,REF(BARSLAST(ld1),1)+1),0);
hg1:=IF(hjs=1 and ld1,BARSLAST(hff1),0);
hga:=IF(ld1 and REF(HIGH,BARSLAST(hff1))<=REF(HIGH,BARSLAST(hff2)),BARSLAST(hff2),BARSLAST(hff1));
hg2:=IF(hjs=2 and ld1,hga,0);
hg3:=IF(hjs>=3 and ld1,IF(ld1 and REF(HIGH,hga)<=REF(HIGH,BARSLAST(hff3)),BARSLAST(hff3),hga),0);
hgg:=hg1+hg2+hg3;
hja:=BACKSET(ld1,hgg);
hjb:=hja>REF(hja,1);
hjj:=BACKSET(hjb,2);
hd:=hjj>REF(hjj,1);
x1:=BACKSET(BARSTATUS=2,BARSLAST(ld)+1);
x2:=x1>REF(x1,1);
y1:=BACKSET(BARSTATUS=2,BARSLAST(hd)+1);
y2:=y1>REF(y1,1);
z1:=IF(BARSLAST(x2)<BARSLAST(y2),x2,y2);
z2:=IF(BARSLAST(x2)<BARSLAST(y2),LOW,HIGH);
DRAWLINE(z1,z2,BARSTATUS=2,CLOSE,0),POINTDOT,colorff9900;
uu:=BACKSET(BARSTATUS=2,BARSLAST(ld)+1);
vv:=uu>REF(uu,1);
ww:=BACKSET(vv,REF(BARSLAST(ld),1)+2);
xx:=ww>REF(ww,1);
DRAWLINE(xx,LOW,vv,LOW,1),colorwhite;
uu2:=BACKSET(BARSTATUS=2,BARSLAST(hd)+1);
vv2:=uu2>REF(uu2,1);
ww2:=BACKSET(vv2,REF(BARSLAST(hd),1)+2);
xx2:=ww2>REF(ww2,1);
DRAWLINE(xx2,HIGH,vv2,HIGH,1),colorwhite;
END;
IF k=2 then begin
V7:=BARSTATUS=2;
V8:=(REF(HIGH,n) = HHV(HIGH,((2 * n) + 1)));
V9:=FILTER(V8,n);
VA:=BACKSET(V9,(n + 1));
VB:=FILTER(VA,n);
VC:=(VB OR V7);
VD:=(REF(LOW,n) = LLV(LOW,((2 * n) + 1)));
VE:=FILTER(VD,n);
VF:=BACKSET(VE,(n + 1));
V10:=FILTER(VF,n);
V11:=(V10 AND NOT(VB));
V12:=BACKSET(VC,(REF(BARSLAST(V11),1) + 1));
V13:=(V12 > REF(V12,1));
V14:=BACKSET(V13,2);
V15:=(V14 > REF(V14,1));
V16:=BACKSET((V15 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V17:=(V16 > REF(V16,1));
V18:=BACKSET((V17 AND (COUNT(VC,(REF(BARSLAST(V11),1) + 2)) = 0)),(REF(BARSLAST(V11),1) + 2));
V19:=(V18 > REF(V18,1));
V1A:=IF(VC,COUNT(V11,(REF(BARSLAST(VC),1) + 1)),0);
V1B:=IF(((V1A = 1) AND VC),BARSLAST(V15),0);
V1C:=IF((VC AND (REF(LOW,BARSLAST(V15)) >= REF(LOW,BARSLAST(V17)))),BARSLAST(V17),BARSLAST(V15));
V1D:=IF(((V1A = 2) AND VC),V1C,0);
V1E:=IF(((V1A >= 3) AND VC),IF((VC AND (REF(LOW,V1C) >= REF(LOW,BARSLAST(V19)))),BARSLAST(V19),V1C),0);
V1F:=((V1B + V1D) + V1E);
V20:=BACKSET(VC,V1F);
V21:=(V20 > REF(V20,1));
V22:=BACKSET(V21,2);
V23:=(V22 > REF(V22,1));
V24:=(V23 OR V7);
V25:=BACKSET(V24,(REF(BARSLAST(VC),1) + 1));
V26:=(V25 > REF(V25,1));
V27:=BACKSET(V26,2);
V28:=(V27 > REF(V27,1));
V29:=BACKSET((V28 AND (COUNT(V24,(REF(BARSLAST(VC),1) + 2)) = 0)),(REF(BARSLAST(VC),1) + 2));
V2A:=(V29 > REF(V29,1));
V2B:=BACKSET((V2A AND (COUNT(V24,(REF(BARSLAST(VC),1) + 2)) = 0)),(REF(BARSLAST(VC),1) + 2));
V2C:=(V2B > REF(V2B,1));
V2D:=IF(V24,COUNT(VB,(REF(BARSLAST(V24),1) + 1)),0);
V2E:=IF(((V2D = 1) AND V24),BARSLAST(V28),0);
V2F:=IF((V24 AND (REF(HIGH,BARSLAST(V28)) <= REF(HIGH,BARSLAST(V2A)))),BARSLAST(V2A),BARSLAST(V28));
V30:=IF(((V2D = 2) AND V24),V2F,0);
V3B:=IF(((V2D >= 3) AND V24),IF((V24 AND (REF(HIGH,V2F) <= REF(HIGH,BARSLAST(V2C)))),BARSLAST(V2C),V2F),0);
V3C:=((V2E + V30) + V3B);
V3D:=BACKSET(V24,V3C);
V3E:=(V3D > REF(V3D,1));
AA:=BACKSET(V3E,2);
AAA:=(AA > REF(AA,1));
BB:=BACKSET(V7,(BARSLAST(AAA) + 1));
CC1:=(BB > REF(BB,1));
CC:=BACKSET(CC1,(REF(BARSLAST(AAA),1) + 2));
AAA2:=(CC > REF(CC,1));
DRAWLINE(AAA2,HIGH,CC1,HIGH,1),POINTDOT,color00AAAA;
BB2:=(REF(HIGH,4) = HHV(HIGH,((2 * 4) + 1)));
CC22:=FILTER(BB2,4);
CC2:=BACKSET(CC22,(4 + 1));
EA:=FILTER(CC2,4);
EB:=(EA OR BARSTATUS=2);
A6:=(REF(LOW,4) = LLV(LOW,((2 * 4) + 1)));
EE:=FILTER(A6,4);
FF1:=BACKSET(EE,(4 + 1));
EE2:=FILTER(FF1,4);
FF2:=(EE2 AND NOT(EA));
EE3:=BACKSET(EB,(REF(BARSLAST(FF2),1) + 1));
FF3:=(EE3 > REF(EE3,1));
JS:=BACKSET(FF3,2);
G1:=(JS > REF(JS,1));
GA:=BACKSET((G1 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
G2:=(GA > REF(GA,1));
G3:=BACKSET((G2 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
GG:=(G3 > REF(G3,1));
JA:=IF(EB,COUNT(FF2,(REF(BARSLAST(EB),1) + 1)),0);
JB:=IF(((JA = 1) AND EB),BARSLAST(G1),0);
JJ:=IF((EB AND (REF(LOW,BARSLAST(G1)) >= REF(LOW,BARSLAST(G2)))),BARSLAST(G2),BARSLAST(G1));
LD:=IF(((JA = 2) AND EB),JJ,0);
LD1:=IF(((JA >= 3) AND EB),IF((EB AND (REF(LOW,JJ) >= REF(LOW,BARSLAST(GG)))),BARSLAST(GG),JJ),0);
HEA:=((JB + LD) + LD1);
HEB:=BACKSET(EB,HEA);
HEE:=(HEB > REF(HEB,1));
HFF1:=BACKSET(HEE,2);
HEE2:=(HFF1 > REF(HFF1,1));
HFF2:=(HEE2 OR BARSTATUS=2);
HEE3:=BACKSET(HFF2,(REF(BARSLAST(EB),1) + 1));
HFF3:=(HEE3 > REF(HEE3,1));
HJS:=BACKSET(HFF3,2);
HG1:=(HJS > REF(HJS,1));
HGA:=BACKSET((HG1 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HG2:=(HGA > REF(HGA,1));
HG3:=BACKSET((HG2 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HGG:=(HG3 > REF(HG3,1));
HJA:=IF(HFF2,COUNT(EA,(REF(BARSLAST(HFF2),1) + 1)),0);
HJB:=IF(((HJA = 1) AND HFF2),BARSLAST(HG1),0);
HJJ:=IF((HFF2 AND (REF(HIGH,BARSLAST(HG1)) <= REF(HIGH,BARSLAST(HG2)))),BARSLAST(HG2),BARSLAST(HG1));
HD:=IF(((HJA = 2) AND HFF2),HJJ,0);
X1:=IF(((HJA >= 3) AND HFF2),IF((HFF2 AND (REF(HIGH,HJJ) <= REF(HIGH,BARSLAST(HGG)))),BARSLAST(HGG),HJJ),0);
X2:=((HJB + HD) + X1);
Y1:=BACKSET(HFF2,X2);
Y2:=(Y1 > REF(Y1,1));
Z1:=BACKSET(Y2,2);
Z2:=(Z1 > REF(Z1,1));
WW2:=BACKSET(BARSTATUS=2,(BARSLAST(HEE2) + 1));
XX2:=(WW2 > REF(WW2,1));
VAR246:=BACKSET(XX2,(REF(BARSLAST(HEE2),1) + 2));
VAR247:=(VAR246 > REF(VAR246,1));
VAR249:=BACKSET(BARSTATUS=2,(BARSLAST(Z2) + 1));
VAR250:=(VAR249 > REF(VAR249,1));
VAR251:=BACKSET(VAR250,(REF(BARSLAST(Z2),1) + 2));
VAR252:=(VAR251 > REF(VAR251,1));
DRAWLINE(VAR252,HIGH,VAR250,HIGH,1),colorwhite;
END;
IF k=3 then begin
wN:=p1;{原码 N:=3;}
wA1:=REF(HIGH,wN)=HHV(HIGH,2*wN+1); wB1:=FILTER(wA1,wN);
wC1:=BACKSET(wB1,wN+1);
wD1:=FILTER(wC1,wN);{高点}
wA2:=REF(LOW,wN)=LLV(LOW,2*wN+1);
wB2:=FILTER(wA2,wN); wC2:=BACKSET(wB2,wN+1);
wD2:=FILTER(wC2,wN);{低点}
wE1:=(REF(LLV(LOW,2*wN),1)+REF(HHV(HIGH,2*wN),1))/2;
wE2:=(HIGH+LOW)/2;
wH1:=(wD1 AND NOT(wD2 AND wE1>=wE2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
wL1:=(wD2 AND NOT(wD1 AND wE1<wE2));
wH2:=wD1 AND NOT(wD2 AND wE1>=wE2);
wX1:=REF(BARSLAST(wH1),1)+1; wF1:=BACKSET(wH1 AND COUNT(wL1,wX1)>0,LLVBARS(IF(wL1,LOW,10000),wX1));
wG1:=wF1>REF(wF1,1); wI1:=BACKSET(wG1,2);
wLD:=wI1>REF(wI1,1);{过滤后低点}
wL2:=wLD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
wX2:=REF(BARSLAST(wL2),1)+1;
wF2:=BACKSET(wL2 AND COUNT(wH2,wX2)>0,HHVBARS(IF(wH2,HIGH,0),wX2));
wG2:=wF2>REF(wF2,1); wI2:=BACKSET(wG2,2);
wHD:=wI2>REF(wI2,1);{过滤后高点}
wR1:=BACKSET(BARSTATUS=2,BARSLAST(wHD)+1);
wS1:=wR1>REF(wR1,1); {前一高}
wT1:=BACKSET(BARSTATUS=2,BARSLAST(wLD)+1); wU1:=wT1>REF(wT1,1); {前一低}
wR2:=BACKSET(wS1,REF(BARSLAST(wHD),1)+2); wS2:=wR2>REF(wR2,1); {前二高}
wT2:=BACKSET(wU1,REF(BARSLAST(wLD),1)+2); wU2:=wT2>REF(wT2,1); {前二低}
wT3:=BACKSET(wU2,REF(BARSLAST(wLD),1)+2); wU3:=wT3>REF(wT3,1); {前三低}
wT4:=BACKSET(wU3,REF(BARSLAST(wLD),1)+2); wU4:=wT4>REF(wT4,1); {前四低}
wR3:=BACKSET(wS2,REF(BARSLAST(wHD),1)+2); wS3:=wR3>REF(wR3,1); {前三高}
wR4:=BACKSET(wS3,REF(BARSLAST(wHD),1)+2); wS4:=wR4>REF(wR4,1); {前四高}
DRAWLINE(wS2,HIGH,wS1,HIGH,1),Coloryellow; {★压力1:}
DRAWLINE(wU2,LOW,wU1,LOW,1),POINTDOT,Colorred;{★支撑1:}
DRAWLINE(wS3,HIGH,wS2,HIGH,1),Coloryellow; {★压力2:}
DRAWLINE(wU3,LOW,wU2,LOW,1),POINTDOT,Colorred;{★支撑2:}
DRAWLINE(wS4,HIGH,wS3,HIGH,1),Coloryellow;{★压力3:}
DRAWLINE(wU4,LOW,wU3,LOW,1),POINTDOT,Colorred;{★支撑3:};
END;
WW:=(MA(C,5)+MA(C,8)+MA(C,14)+MA(C,21))/4;
DRAWTEXT(CROSS(C,WW),L-0.02,' 空翻多')colorcyan;
DRAWTEXT(CROSS(WW,C),H+0.06,' 多翻空')coloryellow;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K1:=SMA(RSV,M1,1);
D1:=SMA(K1,M2,1);
J1:=3*K1-2*D1;
DRAWICON(j1<0,low-0.1,1);
DRAWICON(j1>100,high+0.1,2);
MID:=MA(CLOSE,15);
SELLIT:=MID+2*STD(CLOSE,15);
BUYIT:=MID-2*STD(CLOSE,15);
位置:eMA(CLOSE,15),CROSSDOT,LINETHICK0;
p3:=SYSPARAM(1);
DRAWTEXTEX(CLOSE,1,20,10,'位置支撑(压力)位 | '+NUMTOSTR(位置 ,2 )),coloryellow;

飞狐多空转换主图指标公式

 

相关文章