当前位置:分析家公式网 → 股票公式 → 飞狐公式 → 一键转帖:缺口公式----飞狐 Foxtrader V5.0.Renzm 功能应用与扩展-1
软件名称:[B]缺口公式----飞狐 Foxtrader V5.0.Renzm 功能应用与扩展-1[/B]
软件类型:国产软件
运行环境:Win9X/Win2000/WinXP/Win2003/Win7/
软件语言:简体中文
授权方式:免费版
软件大小:3.00 KB
官方主页:Home Page
更新时间:2019-02-09 00:24:23
软件简介:
飞狐 Foxtrader V5.0.Renzm 功能应用与扩展-1
新年好!飞狐功能相当丰富和完全并实用,为飞狐继续发扬光大,愿与广大的飞狐爱好者开展交流,扩展更多的功能,望支持!
飞狐软件没有缺口绘图功能,今源码送上,复制可自建公式。公式特点采用了函数VARIABLE-变量及数组声明,把序列数的复杂计算变为简单并便于编程。
缺口编程源码:
//缺口公式
INPUT:N1(300,1,1000);
IF DATATYPE>=1 THEN BEGIN
VARIABLE:QKD[80]=0,QKH[80]=0,QKL[80]=0,KG[80]=0;
VARIABLE:VHD=HIGH,VLD=LOW;
NE:= ubound(VHD);
NB:= IF(NE<N1,1,NE-N1);
N:=0;
FOR I = NB TO NE DO BEGIN
IF VLD[I] > VHD[I-1] THEN BEGIN
N:= N+1;
KG[N]:= 1;
QKD[N]:= I;
QKH[N]:= VLD[I];
QKL[N]:= VHD[I-1];
END;
IF VHD[I] < VLD[I-1] THEN BEGIN
N:= N+1;
KG[N]:= 2;
QKD[N]:= I;
QKH[N]:= VLD[I-1];
QKL[N]:= VHD[I];
END;
END;
FOR I = 1 TO N DO BEGIN
IF KG[I] = 1 THEN BEGIN
FOR J = QKD[I] TO NE DO BEGIN
IF VLD[J] < QKH[I] THEN BEGIN
IF VLD[J] > QKL[I] THEN BEGIN
QKH[I]:= VLD[J];
END;
IF VLD[J] <= QKL[I] THEN BEGIN
QKH[I]:= VLD[J];
QKL[I]:= VLD[J];
BREAK;
END;
END;
END;
END;
IF KG[I] = 2 THEN BEGIN
FOR J = QKD[I] TO NE DO BEGIN
IF VHD[J] > QKL[I] THEN BEGIN
IF VHD[J] < QKH[I] THEN BEGIN
QKL[I]:= VHD[J];
END;
END;
IF VHD[J] >= QKH[I] THEN BEGIN
QKH[I]:= VLD[J];
QKL[I]:= VLD[J];
BREAK;
END;
END;
END;
END;
NA:= 0;
FOR I = N DOWNTO 1 DO BEGIN
IF QKH[I] <> QKL[I] THEN BEGIN
NA:= NA+1;
IF(NA = 1) THEN BEGIN
W1:= QKD[I]-1;
D1:= QKH[I];
D2:= QKL[I];
END;
IF(NA = 2) THEN BEGIN
W2:= QKD[I]-1;
D3:= QKH[I];
D4:= QKL[I];
END;
IF(NA = 3) THEN BEGIN
W3:= QKD[I]-1;
D5:= QKH[I];
D6:= QKL[I];
END;
IF(NA = 4) THEN BEGIN
W4:= QKD[I]-1;
D7:= QKH[I];
D8:= QKL[I];
END;
IF(NA = 5) THEN BEGIN
W5:= QKD[I]-1;
D9:= QKH[I];
D0:= QKL[I];
END;
END;
END;
IF W1 <> 0 THEN BEGIN
DRAWLINE(W1=BARPOS,D1,BARSTATUS=2,D1,0),COLORFFAA00;
DRAWLINE(W1=BARPOS,D2,BARSTATUS=2,D2,0),COLORFFAA00;
FILLRGN(BARPOS>W1,D1,D2),COLORFFAA00;
DRAWTEXT(BARSTATUS=2,D1,' '+NUMTOSTR(D1,2)),COLORWHITE;
END;
IF W2 <> 0 THEN BEGIN
DRAWLINE(W2=BARPOS,D3,BARSTATUS=2,D3,0),COLORFFAA00;
DRAWLINE(W2=BARPOS,D4,BARSTATUS=2,D4,0),COLORFFAA00;
FILLRGN(BARPOS>W2,D3,D4),COLORFFAA00;
DRAWTEXT(BARSTATUS=2,D3,' '+NUMTOSTR(D3,2)),COLORWHITE;
END;
IF W3 <> 0 THEN BEGIN
DRAWLINE(W3=BARPOS,D5,BARSTATUS=2,D5,0),COLORFFAA00;
DRAWLINE(W3=BARPOS,D6,BARSTATUS=2,D6,0),COLORFFAA00;
FILLRGN(BARPOS>W3,D5,D6),COLORFFAA00;
DRAWTEXT(BARSTATUS=2,D5,' '+NUMTOSTR(D5,2)),COLORWHITE;
END;
IF W4 <> 0 THEN BEGIN
DRAWLINE(W4=BARPOS,D7,BARSTATUS=2,D7,0),COLORFFAA00;
DRAWLINE(W4=BARPOS,D8,BARSTATUS=2,D8,0),COLORFFAA00;
FILLRGN(BARPOS>W4,D7,D8),COLORFFAA00;
DRAWTEXT(BARSTATUS=2,D7,' '+NUMTOSTR(D7,2)),COLORWHITE;
END;
IF W5 <> 0 THEN BEGIN
DRAWLINE(W5=BARPOS,D9,BARSTATUS=2,D9,0),COLORFFAA00;
DRAWLINE(W5=BARPOS,D0,BARSTATUS=2,D0,0),COLORFFAA00;
FILLRGN(BARPOS>W5,D9,D0),COLORFFAA00;
DRAWTEXT(BARSTATUS=2,D9,' '+NUMTOSTR(D9,2)),COLORWHITE;
END;
END;
[url=http://www.70822.com/soft/sort013/sort02/down-133468.html]缺口公式----飞狐 Foxtrader V5.0.Renzm 功能应用与扩展-1[/url]