飞狐交易师指标公式示例
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
压力位[I]:=前压[I-1];J:=I-1;
WHILE((前压[J-1]<=前压[J] OR 前压[J-1]<=FC[I] OR 前压[J-1]<=压力位[I] ) AND J>=INI+1 ) DO BEGIN
J:=J-1;
END;
IF LD_Z[I]>0 THEN ANGLEX16_L[I]:=KL;
END;
END;
//DRAWSL(HD_Z>0 ,VALUE_DOT_Z,ANGLEX16_H/100,0,3),COLORGRAY,LINEDOT;
//DRAWSL(LD_Z>0 ,VALUE_DOT_Z,ANGLEX16_L/100,0,3),COLORGRAY,LINEDOT;
IF SHOW<=3 OR SHOW=6 THEN BEGIN
STICKLINE(c>o,l,h,0,0),colorred;
STICKLINE(c>o,c,o,8,1),colorred;
STICKLINE(c<=o,l,h,0,0),colorgreen;
STICKLINE(c<=o,c,o,8,1),colorgreen;
HD_Z:="HDLD.TP"(Z_DOT,M,INIDATE);
LD_Z:="HDLD.DN"(Z_DOT,M,INIDATE);
VALUE_DOT_Z:="HDLD.VALUE_DOT"(Z_DOT,M,INIDATE);
BAR_DOT_Z:="HDLD.BAR_DOT"(Z_DOT,M,INIDATE);
IF 支撑位[I-1]>0 AND FC[I]<=支撑位[I-1] AND 前支[I-1]<支撑位[I-1] THEN BEGIN
支撑位[I]:=前支[I-1] ;J:=I-1;
WHILE((前支[J-1]>=前支[J] OR 前支[J-1]>=FC[I] OR 前支[J-1]>=支撑位[I] ) AND J>=INI+1 ) DO BEGIN
IF tp2[I]< 压力位[I] AND tp2[I]>0 THEN BEGIN 前压[I]:=压力位[I];压力位[:=tp2[I];END;
IF 压力位[I-1]>0 AND FC[I]>= 压力位[I-1] AND 前压[I-1]>压力位[I-1] THEN BEGIN
DRAWSL(HD_Z>0 AND ANGLEX16_H<>0 ,VALUE_DOT_Z,ANGLEX16_H/(2*100),0,3),COLORGRAY,LINEDOT;
DRAWSL(LD_Z>0 AND ANGLEX16_L<>0 ,VALUE_DOT_Z,ANGLEX16_L/(2*100),0,3),COLORGRAY,LINEDOT;
for I=INI+1 TO DATACOUNT DO BEGIN
IF 支撑位[I-1]>0 AND FC[I]>支撑位[I-1] THEN BEGIN 支撑位[I]:=支撑位[I-1] ;前支[I]:=前支[I-1] ;END; //
IF tp1[I]>支撑位[I] AND tp1[I]>0 THEN BEGIN 前支[I]:=支撑位[I];支撑位[I]:=tp1[I];END;
IF ( BAR_DOT_N[J]>0) THEN BEGIN
HC:=(VALUE_DOT_Z[I]-VALUE_DOT_N[J])/(BAR_DOT_Z[I]-BAR_DOT_N[J])*100,PRECISION4; {找到符合相应斜率的趋势线 }
tp10:=if(c>x10 and ref(c,1)<=x10 and ref(临界点,1)=x10 and refx(c,1)>x10 and refx(c,2)>x10 and refx(c,3)>x10 ,x10,0);
VARIABLE:INI=0,J=0;
INI:=DATACOUNT-BBF[DATACOUNT];
箱底L:llv(低点,Z_DOT),colorblue,POINTDOT,LINETHICK4;
x1:=LLV(临界点,n);
x10:=HHV(临界点,n);
t0:=BARSLAST(c=x1);
t00:=BARSLAST(c=x10);
x2:=HHV(低点,N);
t2:=BARSLAST(c=x2);
UPPER: MID + 2*STD(CLOSE, 26),COLORYELLOW;//,LINEDOT;
LOWER: MID - 2*STD(CLOSE, 26), COLORMAGENTA;//,LINEDOT;
END;
////
{突破的计算}
FC:=C;
支撑位:FC*0,colorwhite, POINTDOT,LINETHICK2;
input:n(3,1,100),qj(0,0,50),m(0,0,1), inidate(600,1,1000),Z_DOT(33,3,100),show(4,0,6);
IF SHOW<=3 THEN
DRAWGBK(DATE>900101,COLORRGB(95,95,95),COLORRGB(0,0,0),1);
{定义序列变量}
FH:=HIGH;
FL:=CLOSE;
FLL:=LOW;
SELL:=0*FH;
IN_H:= SELL;
IN_L:= SELL;
突变周期:SELL;
ANGLEX16_H:=SELL; //向下角度线的16x1线的斜率
ANGLEX16_L:=SELL; //向上角度线的16x1线的斜率
END ;
{变量定义和过渡}
HD_N:="HDLD.TP"(N,M,INIDATE);
LD_N:="HDLD.DN"(N,M,INIDATE);
VALUE_DOT_N:="HDLD.VALUE_DOT"(N,M,INIDATE);
BAR_DOT_N:="HDLD.BAR_DOT"(N,M,INIDATE);
前压[I]:=前压[J-1] ;
END;
END;
////
{趋势线的计算}
VARIABLE:HC=0,KH=0,KL=0,INI_N=0,INI_HL=0;{定义循环中实用的变量}
INI_N:=IF(DATACOUNT<=inidate,DATACOUNT-3,inidate); {定义循环起始位置}
压力位:FC*0,colorgreen, POINTDOT,LINETHICK2;
前支:=fc*0;
前压:=fc*0;
临界点:=FC*0,colorwhite, POINTDOT,LINETHICK3;
低点:=FC*0,colorgreen, POINTDOT,LINETHICK3;
upx1:=if( (c>ref(c,1) or (c=ref(c,1) and (ref(c,2)<ref(c,1) or (ref(c,2)=ref(c,1) and ref(c,3)<ref(c,2))))) and c>refx(c,1),c,0);
upx2:=if( (c<ref(c,1) or (c=ref(c,1) and (ref(c,2)>ref(c,1) or (ref(c,2)=ref(c,1) and ref(c,3)>ref(c,2))))) and c<refx(c,1),c,0);
临界点:=ref(c,BARSLAST(upx1));
J:=J-1;
END;
前支[I]:=前支[J-1] ;
END;
IF tp2[I]>0 THEN BEGIN 前压[I]:=压力位[I];压力位[I]:=tp2[I];END;
IF 压力位[I-1]>0 AND FC[I]< 压力位[I-1] THEN BEGIN 前压[I]:=前压[I-1] ;压力位[I]:= 压力位[I-1] ;END;
if show >1 and show<=4 then BEGIN
养鸡: SELL,,colorred;
养狗: SELL,,COLORYELLOW;
牛熊: SELL,,colorff,Linethick2;
End ;
IF SHOW>5 THEN BEGIN
MID : MA(CLOSE,26),COLORWHITE;//,LINEDOT;
突破:=if(c>x1 and ref(c,1)<=x1 and ref(临界点,1)=x1 and refx(c,1)>x1 and refx(c,2)>x1 and refx(c,3)>x1 ,1,0),LINETHICK0;
tp1:=if(c>x1 and ref(c,1)<=x1 and ref(临界点,1)=x1 and refx(c,1)>x1 and refx(c,2)>x1 and refx(c,3)>x1 ,x1,0);//,LINETHICK0;
IF HD_Z[I]>0 AND KH>HC THEN KH:=HC;
IF LD_Z[I]>0 AND KL<HC THEN KL:=HC;
END;
END;
IF HD_Z[I]>0 THEN ANGLEX16_H[I]:=KH;
ANGLEX16_H[I]:=ANGLEX16_H[I-1]; ANGLEX16_L[I]:=ANGLEX16_L[I-1];
IF HD_N[I]>0 THEN 压力[I]:=FL[I];//VALUE_DOT_N[I] ;
IF LD_N[I]>0 THEN 支撑[I]:=FL[I];//VALUE_DOT_N[I] ;
低点:=ref(c,BARSLAST(upx2));
箱顶S:hhv(临界点,n),coloryellow,POINTDOT,LINETHICK4;//color995555,
箱顶L:hhv(临界点,Z_DOT),COLORGRAY,POINTDOT,LINETHICK4;
箱底S:llv(低点,n),color555599,POINTDOT,LINETHICK4;
DRAWSL(HD_Z>0 AND ANGLEX16_H<>0 ,VALUE_DOT_Z,ANGLEX16_H/(4*100),0,3),COLORGRAY,LINEDOT;
DRAWSL(LD_Z>0 AND ANGLEX16_L<>0 ,VALUE_DOT_Z,ANGLEX16_L/(4*100),0,3),COLORGRAY,LINEDOT;
FOR I=DATACOUNT-INI_N+2*Z_DOT+1 TO DATACOUNT-1 DO BEGIN
//FOR I=Z_DOT+N+1 TO DATACOUNT-1 DO BEGIN
// 支撑[I]:=支撑[I-1];压力[I]:=压力[I-1];
IF BAR_DOT_Z[I]>0 THEN BEGIN
KH:=0; KL:=0;
FOR J=I+1 TO DATACOUNT DO BEGIN
IF (HD_Z[I]>0 AND HD_Z[J]>0) OR (LD_Z[I]>0 AND LD_Z[J]>0) THEN BREAK;
tp2:=if(c<x2 and ref(c,1)>=x2 and ref(低点,1)=x2 and refx(c,1)<x2 and refx(c,2)<x2 and refx(c,3)<x2,x2,0);
B1:=BARSSINCE(c=x1);
B2:=BARSSINCE(c=x2);
BBF:=IF(B1>=B2,B2,B1);
WHILE((前压[J-1]<=前压[J] OR 前压[J-1]<=FC[I] OR 前压[J-1]<=压力位[I] ) AND J>=INI+1 ) DO BEGIN
J:=J-1;
END;
IF LD_Z[I]>0 THEN ANGLEX16_L[I]:=KL;
END;
END;
//DRAWSL(HD_Z>0 ,VALUE_DOT_Z,ANGLEX16_H/100,0,3),COLORGRAY,LINEDOT;
//DRAWSL(LD_Z>0 ,VALUE_DOT_Z,ANGLEX16_L/100,0,3),COLORGRAY,LINEDOT;
IF SHOW<=3 OR SHOW=6 THEN BEGIN
STICKLINE(c>o,l,h,0,0),colorred;
STICKLINE(c>o,c,o,8,1),colorred;
STICKLINE(c<=o,l,h,0,0),colorgreen;
STICKLINE(c<=o,c,o,8,1),colorgreen;
HD_Z:="HDLD.TP"(Z_DOT,M,INIDATE);
LD_Z:="HDLD.DN"(Z_DOT,M,INIDATE);
VALUE_DOT_Z:="HDLD.VALUE_DOT"(Z_DOT,M,INIDATE);
BAR_DOT_Z:="HDLD.BAR_DOT"(Z_DOT,M,INIDATE);
IF 支撑位[I-1]>0 AND FC[I]<=支撑位[I-1] AND 前支[I-1]<支撑位[I-1] THEN BEGIN
支撑位[I]:=前支[I-1] ;J:=I-1;
WHILE((前支[J-1]>=前支[J] OR 前支[J-1]>=FC[I] OR 前支[J-1]>=支撑位[I] ) AND J>=INI+1 ) DO BEGIN
IF tp2[I]< 压力位[I] AND tp2[I]>0 THEN BEGIN 前压[I]:=压力位[I];压力位[:=tp2[I];END;
IF 压力位[I-1]>0 AND FC[I]>= 压力位[I-1] AND 前压[I-1]>压力位[I-1] THEN BEGIN
DRAWSL(HD_Z>0 AND ANGLEX16_H<>0 ,VALUE_DOT_Z,ANGLEX16_H/(2*100),0,3),COLORGRAY,LINEDOT;
DRAWSL(LD_Z>0 AND ANGLEX16_L<>0 ,VALUE_DOT_Z,ANGLEX16_L/(2*100),0,3),COLORGRAY,LINEDOT;
for I=INI+1 TO DATACOUNT DO BEGIN
IF 支撑位[I-1]>0 AND FC[I]>支撑位[I-1] THEN BEGIN 支撑位[I]:=支撑位[I-1] ;前支[I]:=前支[I-1] ;END; //
IF tp1[I]>支撑位[I] AND tp1[I]>0 THEN BEGIN 前支[I]:=支撑位[I];支撑位[I]:=tp1[I];END;
IF ( BAR_DOT_N[J]>0) THEN BEGIN
HC:=(VALUE_DOT_Z[I]-VALUE_DOT_N[J])/(BAR_DOT_Z[I]-BAR_DOT_N[J])*100,PRECISION4; {找到符合相应斜率的趋势线 }
tp10:=if(c>x10 and ref(c,1)<=x10 and ref(临界点,1)=x10 and refx(c,1)>x10 and refx(c,2)>x10 and refx(c,3)>x10 ,x10,0);
VARIABLE:INI=0,J=0;
INI:=DATACOUNT-BBF[DATACOUNT];
箱底L:llv(低点,Z_DOT),colorblue,POINTDOT,LINETHICK4;
x1:=LLV(临界点,n);
x10:=HHV(临界点,n);
t0:=BARSLAST(c=x1);
t00:=BARSLAST(c=x10);
x2:=HHV(低点,N);
t2:=BARSLAST(c=x2);
UPPER: MID + 2*STD(CLOSE, 26),COLORYELLOW;//,LINEDOT;
LOWER: MID - 2*STD(CLOSE, 26), COLORMAGENTA;//,LINEDOT;
END;
////
{突破的计算}
FC:=C;
支撑位:FC*0,colorwhite, POINTDOT,LINETHICK2;
input:n(3,1,100),qj(0,0,50),m(0,0,1), inidate(600,1,1000),Z_DOT(33,3,100),show(4,0,6);
IF SHOW<=3 THEN
DRAWGBK(DATE>900101,COLORRGB(95,95,95),COLORRGB(0,0,0),1);
{定义序列变量}
FH:=HIGH;
FL:=CLOSE;
FLL:=LOW;
SELL:=0*FH;
IN_H:= SELL;
IN_L:= SELL;
突变周期:SELL;
ANGLEX16_H:=SELL; //向下角度线的16x1线的斜率
ANGLEX16_L:=SELL; //向上角度线的16x1线的斜率
END ;
{变量定义和过渡}
HD_N:="HDLD.TP"(N,M,INIDATE);
LD_N:="HDLD.DN"(N,M,INIDATE);
VALUE_DOT_N:="HDLD.VALUE_DOT"(N,M,INIDATE);
BAR_DOT_N:="HDLD.BAR_DOT"(N,M,INIDATE);
前压[I]:=前压[J-1] ;
END;
END;
////
{趋势线的计算}
VARIABLE:HC=0,KH=0,KL=0,INI_N=0,INI_HL=0;{定义循环中实用的变量}
INI_N:=IF(DATACOUNT<=inidate,DATACOUNT-3,inidate); {定义循环起始位置}
压力位:FC*0,colorgreen, POINTDOT,LINETHICK2;
前支:=fc*0;
前压:=fc*0;
临界点:=FC*0,colorwhite, POINTDOT,LINETHICK3;
低点:=FC*0,colorgreen, POINTDOT,LINETHICK3;
upx1:=if( (c>ref(c,1) or (c=ref(c,1) and (ref(c,2)<ref(c,1) or (ref(c,2)=ref(c,1) and ref(c,3)<ref(c,2))))) and c>refx(c,1),c,0);
upx2:=if( (c<ref(c,1) or (c=ref(c,1) and (ref(c,2)>ref(c,1) or (ref(c,2)=ref(c,1) and ref(c,3)>ref(c,2))))) and c<refx(c,1),c,0);
临界点:=ref(c,BARSLAST(upx1));
J:=J-1;
END;
前支[I]:=前支[J-1] ;
END;
IF tp2[I]>0 THEN BEGIN 前压[I]:=压力位[I];压力位[I]:=tp2[I];END;
IF 压力位[I-1]>0 AND FC[I]< 压力位[I-1] THEN BEGIN 前压[I]:=前压[I-1] ;压力位[I]:= 压力位[I-1] ;END;
if show >1 and show<=4 then BEGIN
养鸡: SELL,,colorred;
养狗: SELL,,COLORYELLOW;
牛熊: SELL,,colorff,Linethick2;
End ;
IF SHOW>5 THEN BEGIN
MID : MA(CLOSE,26),COLORWHITE;//,LINEDOT;
突破:=if(c>x1 and ref(c,1)<=x1 and ref(临界点,1)=x1 and refx(c,1)>x1 and refx(c,2)>x1 and refx(c,3)>x1 ,1,0),LINETHICK0;
tp1:=if(c>x1 and ref(c,1)<=x1 and ref(临界点,1)=x1 and refx(c,1)>x1 and refx(c,2)>x1 and refx(c,3)>x1 ,x1,0);//,LINETHICK0;
IF HD_Z[I]>0 AND KH>HC THEN KH:=HC;
IF LD_Z[I]>0 AND KL<HC THEN KL:=HC;
END;
END;
IF HD_Z[I]>0 THEN ANGLEX16_H[I]:=KH;
ANGLEX16_H[I]:=ANGLEX16_H[I-1]; ANGLEX16_L[I]:=ANGLEX16_L[I-1];
IF HD_N[I]>0 THEN 压力[I]:=FL[I];//VALUE_DOT_N[I] ;
IF LD_N[I]>0 THEN 支撑[I]:=FL[I];//VALUE_DOT_N[I] ;
低点:=ref(c,BARSLAST(upx2));
箱顶S:hhv(临界点,n),coloryellow,POINTDOT,LINETHICK4;//color995555,
箱顶L:hhv(临界点,Z_DOT),COLORGRAY,POINTDOT,LINETHICK4;
箱底S:llv(低点,n),color555599,POINTDOT,LINETHICK4;
DRAWSL(HD_Z>0 AND ANGLEX16_H<>0 ,VALUE_DOT_Z,ANGLEX16_H/(4*100),0,3),COLORGRAY,LINEDOT;
DRAWSL(LD_Z>0 AND ANGLEX16_L<>0 ,VALUE_DOT_Z,ANGLEX16_L/(4*100),0,3),COLORGRAY,LINEDOT;
FOR I=DATACOUNT-INI_N+2*Z_DOT+1 TO DATACOUNT-1 DO BEGIN
//FOR I=Z_DOT+N+1 TO DATACOUNT-1 DO BEGIN
// 支撑[I]:=支撑[I-1];压力[I]:=压力[I-1];
IF BAR_DOT_Z[I]>0 THEN BEGIN
KH:=0; KL:=0;
FOR J=I+1 TO DATACOUNT DO BEGIN
IF (HD_Z[I]>0 AND HD_Z[J]>0) OR (LD_Z[I]>0 AND LD_Z[J]>0) THEN BREAK;
tp2:=if(c<x2 and ref(c,1)>=x2 and ref(低点,1)=x2 and refx(c,1)<x2 and refx(c,2)<x2 and refx(c,3)<x2,x2,0);
B1:=BARSSINCE(c=x1);
B2:=BARSSINCE(c=x2);
BBF:=IF(B1>=B2,B2,B1);