缠论一买、三买选股公式(飞狐+悟多公式)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
缠论一买、三买选股公式(飞狐+悟多公式)
MA10:=MA(CLOSE,10);
MA5:=MA(CLOSE,5);
MA1:=MA5-MA10;
MA2:=MA10;
MA3:=MA10;
DATANUMBER:=DATATYPE;
DATANUMBER1:=DATATYPE;
DATANUMBER2:=DATATYPE;
DATANUMBER3:=DATATYPE;
LING:=HIGH;
<%
vbdatanumber = ("datanumber")
vbdatanumber1 = ("datanumber1")
vbdatanumber2 = ("datanumber2")
vbdata=1
vbdata1=
vbdata2=1
Select Case vbdatanumber
Case 0
vbdata=
vbdata1=
vbdata2=
Case 1
vbdata=
vbdata1=
vbdata2=
Case 2
vbdata=
vbdata2= Case 3 vbdata= vbdata1= vbdata2= Case 4 vbdata= vbdata1= vbdata2= Case 5 vbdata= vbdata1= vbdata2= Case 6 vbdata= vbdata1= vbdata2= Case 7 vbdata= vbdata1= vbdata2= Case 8 vbdata= vbdata1= vbdata2= Case 9 vbdata= vbdata1= vbdata2= Case 10 vbdata= vbdata1= vbdata2= Case 11 vbdata= vbdata1= vbdata2= Case 12 vbdata= vbdata1= vbdata2= Case else vbdata=2
vbdata2=2
End Select ("datanumber") =vbdata ("datanumber1") =vbdata1 ("datanumber2") =vbdata2 vbling = ("ling")
vbma = ("ma1")
vbma2 = ("ma2")
vbma3 = ("ma3")
nlast = UBound( vbma ) nvalue =
nvaluefu =
bianhua = 2
oldbianhua = 0
for m = 0 to nlast
vbma2(m) = 0
vbma3(m) = 0
vbling(m)=0
next
m= 0
for i = 0 to nlast
m=m+1
'nlast - m
'vbma2(i) = 0
if (vbma(i) > 0) then bianhua = 1
nvalue = nvalue + vbma(i) else
bianhua = 2
nvaluefu = nvaluefu + vbma(i) end if
if (oldbianhua = bianhua) then else
vbma3(i) = m
m=0
if (bianhua = 1) then
vbma2(i) = nvaluefu nvaluefu = 0
'nvaluefu = 0
else
vbma2(i) = nvalue
nvalue = 0
'nvalue = 0
end if
end if
oldbianhua = bianhua
next
("ma2") = vbma2
("ma3") = vbma3
("ling") =vbling
%>
DRAWNUMBER(REF(MA2,0)<0 AND 0=1,LLV(LOW,5),REF(MA2,0)*1000,0),colorFF00;
DRAWNUMBER(REF(MA2,0)<0 AND 0=1,LLV(LOW,5)-DATANUMBER,REF(MA3,0),0),colorFFFF;
DRAWNUMBER(REF(MA2,0)<0 AND 0=1,LLV(LOW,5)-DATANUMBER*2,REF(MA2,0)*1000/REF(MA3,0),0),colorFF00; DRAWNUMBER(REF(MA2,0)>0 AND 0=1,HHV(HIGH,5),REF(MA2,0)*1000,0),colorFF;
DRAWNUMBER(REF(MA2,0)>0 AND 0=1,HHV(HIGH,5)+DATANUMBER,REF(MA3,0),0),colorFFFF;
DRAWNUMBER(REF(MA2,0)>0 AND 0=1,HHV(HIGH,5)+DATANUMBER*2,REF(MA2,0)*1000/REF(MA3,0),0),colorFF; MA1:=MA5-MA10;
WEIHE:=LING;
WEIPING:=LING;
<%
vbhe=("weihe")
vbping=("weiping")
vbma = ("ma1")
nlast = UBound( vbma )
nvalue =
nvaluefu =
bianhua = 2
oldbianhua = 0
i= 0
m= nlast
if (vbma(nlast) > 0) then
Do While (vbma(m)>0)
nvalue = vbma(m) + nvalue
i=i+1
m=m-1
if(m<0) then
exit do
end if
Loop
else
Do While (vbma(m)<0)
nvalue = vbma(m) + nvalue
i=i+1
m=m-1
if(m<0) then
exit do
end if
Loop
end if
if (i=0) then
i=1
end if
nvaluefu = nvalue/i
vbhe(nlast) = nvalue
vbping(nlast) = nvaluefu
("weihe") =vbhe
("weiping")= vbping
%>
DRAWNUMBER(WEIHE<>0 AND 0=1,IF(WEIHE>0,HIGH,LOW),WEIHE*1000,0),colorFF;
DRAWNUMBER(WEIHE<>0 AND 0=1,(IF(WEIHE>0,HIGH,LOW))-DATANUMBER*2,WEIPING*1000,0),colorFF00; DRAWNUMBER(WEIPING<>0 AND 0=1,(IF(WEIHE>0,HIGH,LOW))-DATANUMBER,WEIHE/WEIPING,0),colorFFFF; DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
MA1:=MACD;
MA2:=MACD;
MA3:=MACD;
MA1WE:=MACD;
HE:=MA2;
WEIHEMACD:=0;
WEIPINGMACD:=0;
H1:=HIGH;
L1:=LOW;
FOXH:=HIGH;
FOXL:=LOW;
FOXBAOHAN:=LING;
FOXBAOHAN1:=LING;
FOXGUANXI:=LING;
FOXFENXING:=LING;
FOXFENXING1:=LING;
FOXFENNUMBER:=LING;
FOXQUEKOU:=LING;
FOXBICOUNT:=LING;
FOXWEIBI:=LING;
<%
vbquekou=("foxquekou")
vbfennumber=("foxfennumber") vbdatanumber = ("datanumber")
vbh = ("foxh")
vbL = ("foxl")
vbh1 = ("foxh")
vbL1 = ("foxl")
vbbaohan = ("foxbaohan")
vbbaohan1 = ("foxbaohan1")
vbguanxi = ("foxguanxi")
vbfenxing = ("foxfenxing")
vbfenxing1 = ("foxfenxing1")
vbbicount=("foxbicount")
vbweibi=("foxweibi")
nlast = UBound( vbh )
nvalue =
nvaluefu =
bianhua = 2
vbguanxi(0) = 1
for m = 1 to nlast
if (vbh(m)>vbh(m-1) and vbl(m)>vbl(m-1)) then vbguanxi(m)=1
else
if (vbh(m)<vbh(m-1) and vbl(m)<vbl(m-1)) then vbguanxi(m)=-1
else
vbguanxi(m) = 0
if (vbguanxi(m-1)=1) then
vbguanxi(m)=1
if (vbh(m)>=vbh(m-1) and vbl(m)<=vbl(m-1)) then vbbaohan(m) = 2
vbbaohan(m-1) = 1
vbh(m-1)=vbh(m)
vbl(m)=vbl(m-1)
else
vbbaohan(m-1) = -1
vbbaohan(m) = -2
vbh(m)=vbh(m-1)
vbl(m-1)=vbl(m)
end if
else
vbguanxi(m)=-1
if (vbh(m)>=vbh(m-1) and vbl(m)<=vbl(m-1)) then
vbbaohan(m) = 2
vbbaohan(m-1) = 1
vbh(m)=vbh(m-1)
vbl(m-1)=vbl(m)
else
vbbaohan(m-1) = -1
vbbaohan(m) = -2
vbh(m-1)=vbh(m)
vbl(m)=vbl(m-1)
end if
end if
end if
end if
next
'处理连续包含即:连续3个及以上K线间存在的包含关系
for m = 0 to nlast
vbbaohan1(m) = vbbaohan(m)
NEXT
i=0
do while (vbbaohan(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
'第一个包含的位置
lastfenxing=i
bao=0
existbao=0
for m = i to nlast
if (vbbaohan(m) <> 0) then
bao=bao+1
if (bao>=2) then
if (vbbaohan(m)=2 and vbbaohan(m-1)=1 or vbbaohan(m)=-2 and vbbaohan(m-1)=-1) then
vbbaohan1(m) = bao
if (bao>2) then
existbao=BAO
for i = 1 to bao
vbh(m-bao+i)=vbh(m)
vbL(m-bao+i)=vbl(m)
if (i = 1 or i=bao ) then
else
vbbaohan1(m-bao+i)=-3
end if
next
end if
'do while (bao>1)
'vbh(m-bao+1)=vbh(m)
'vbL(m-bao+1)=vbl(m)
'if (existbao=BAO or bao=existbao-1) then
'else
'vbbaohan1(m-bao+1)=-3
'end if
'bao=bao-1
'loop
bao=0
end if
end if
else
bao=0
end if
next
'分型预处理
existbao=vbguanxi(0)
for m = 1 to nlast
'if (vbh(m-1)>=vbh(m-2) and vbh(m-1)>=vbh(m) and vbl(m-1)>=vbl(m-2) and vbl(m-1)>=vbl(m) or vbh(m-1)<=vbh(m-2) and vbh(m-1)<=vbh(m) and vbl(m-1)<vbl(m-2) and vbl(m-1)<=vbl(m)) then
'end if
if (vbguanxi(m)<>existbao) then
if (vbguanxi(m-1)=1) then
vbfenxing(m-1) = 1
'顶
else
vbfenxing(m-1) = -1
'底
end if
existbao=vbguanxi(m)
end if
next
'以上分型预处理
for m = 0 to nlast
vbfenxing1(m) = vbfenxing(m)
vbfenxing1(m) = 0
next
i=0
do while (vbfenxing(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastfenxing=i
'取第一个分型位置
'下面去掉连续的顶或底
for m = lastfenxing+1+nlast to nlast
if (vbfenxing(m)<>0) then
if (vbfenxing(m)<>vbfenxing(lastfenxing)) then
lastfenxing=m
else
if (vbfenxing(m)=1) then
if (vbh(m)>vbh(lastfenxing)) then
vbfenxing(lastfenxing)=0
lastfenxing=m
else
vbfenxing(m)=0
end if
else
if (vbl(m)<vbl(lastfenxing)) then
vbfenxing(lastfenxing)=0
lastfenxing=m
else
vbfenxing(m)=0
end if
end if
'顶要高的底要低的相等时要选时间在前面的
'vbfenxing(m)=0
end if
end if
next
'以下处理分型间距离不小于4的要求同时处理连续的顶和底的问题bao=0
i=0
n=0
existbao=vbfenxing(0)
m=0
do while (vbbaohan1(i) <2)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastbaohan=i
'第一个包含位置
i=0
do while (vbfenxing(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
'第一个预备分型位置
lastfenxing=i
lastfenxing1=lastfenxing
i=0
for m = lastfenxing+1 to nlast
if (vbbaohan(m) = 0) then
bao=bao+1
else
if (vbbaohan1(m) >=2 ) then
n=n+1
end if
end if
vbfenxing1(m) = bao+n
'包含关系只视为一个k线
'vbfenxing1(m)=vbbaohan1(m)
'if (m>735) then
'exit for
'end if
if (vbfenxing(m)<>0) then
if (bao+n>= 4) then
'分型间距离大于等于4 符合要求
if (vbfenxing(m)<>vbfenxing(lastfenxing)) then 'vbfenxing1(m)=vbfenxing(m)
n=0
bao=0
lastfenxing1=lastfenxing
lastfenxing=m
else
if (vbfenxing(m)=1) then
if (vbh(m)>vbh(lastfenxing)) then
'exit for
vbfenxing(lastfenxing)=0
n=0
bao=0
lastfenxing1=lastfenxing
lastfenxing=m
else
vbfenxing(m)=0
end if
else
if (vbl(m)<vbl(lastfenxing)) then
vbfenxing(lastfenxing)=0
n=0
bao=0
lastfenxing1=lastfenxing
lastfenxing=m
else
vbfenxing(m)=0
end if
end if
'顶要高的底要低的相等时要选时间在前面的
end if
'将上一个分开型位置数据更新为当下位置
else
'分型间距离小于4 要看情况若与前分型不同且破坏前笔,可保留其它情况要去掉'破坏前笔即相邻分型不同且高于上上个顶或低于上上个底
if (vbfenxing(m)<>vbfenxing(lastfenxing)) then
'vbfenxing1(m)=vbfenxing(m)
'i=lastfenxing-1
'do while (vbfenxing(i)<>vbfenxing(m))
'i=i-1
'if (i=0) then
'Exit Do
'end if
'loop
'lastfenxing1=lastfenxing
i=lastfenxing1
if (vbfenxing(m)=1) then
if (vbl(m)>vbl1(m))then
t1=vbl1(m)
else
t1=vbl(m)
end if
if (vbh(i)>vbh1(i))then
t2=vbh(m)
t2=vbh1(m)
end if
if (t1>t2) then
n=0
bao=0
lastfenxing1=lastfenxing lastfenxing=m
else
vbfenxing(m)=0
end if
else
if (vbh(m)>vbh1(m))then
t1=vbh(m)
else
t1=vbh1(m)
end if
if (vbl(i)>vbl1(i))then
t2=vbl(m)
else
t2=vbl1(m)
end if
if (t1<t2) then
'if (vbh(m)<vbl(i)) then
n=0
bao=0
lastfenxing1=lastfenxing lastfenxing=m
else
vbfenxing(m)=0
end if
end if
else
if (vbfenxing(m)=1) then
if (vbh(m)>vbh(lastfenxing)) then 'exit for
vbfenxing(lastfenxing)=0
n=0
bao=0
lastfenxing1=lastfenxing lastfenxing=m
else
vbfenxing(m)=0
end if
if (vbl(m)<vbl(lastfenxing)) then
vbfenxing(lastfenxing)=0
n=0
bao=0
lastfenxing1=lastfenxing
lastfenxing=m
else
vbfenxing(m)=0
end if
end if
'顶要高的底要低的相等时要选时间在前面的end if
end if
end if
next
'以上处理分型间距离不小于4的要求
'以下去掉连续的顶或底
i=0
do while (vbfenxing(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastfenxing=i
'取第一个分型位置
'下面去掉连续的顶或底
for m = lastfenxing+1+nlast to nlast
if (vbfenxing(m)<>0) then
if (vbfenxing(m)<>vbfenxing(lastfenxing)) then lastfenxing=m
else
if (vbfenxing(m)=1) then
if (vbh(m)>vbh(lastfenxing)) then
vbfenxing(lastfenxing)=0
lastfenxing=m
else
vbfenxing(m)=0
end if
else
if (vbl(m)<vbl(lastfenxing)) then
vbfenxing(lastfenxing)=0
lastfenxing=m
else
vbfenxing(m)=0
end if
end if
'顶要高的底要低的相等时要选时间在前面的
'vbfenxing(m)=0
end if
end if
next
'以下处理一个顶要大于相邻的两个底及一个底要小于相邻的两个顶的问题'取第一个分型位置
i=0
do while (vbfenxing(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastfenxing=i
for m = lastfenxing+1 to nlast
if (vbfenxing(m)<>0) then
if (vbfenxing(m)>0) then
if (vbh(m)>vbl(lastfenxing)) then
'满足条件顶>底
lastfenxing=m
else
'不满足条件顶>底两个全置为0,并查下一个
vbfenxing(m)=0
vbfenxing(lastfenxing)=0
m=m+1
do while (vbfenxing(m)=0)
m=m+1
if (m>nlast) then
Exit Do
end if
loop
lastfenxing=m
end if
else
if (vbl(m)<vbh(lastfenxing)) then
'满足条件底<顶
lastfenxing=m
'不满足条件底<顶两个全置为0,并查下一个vbfenxing(m)=0
vbfenxing(lastfenxing)=0
m=m+1
do while (vbfenxing(m)=0)
m=m+1
if (m>nlast) then
Exit Do
end if
loop
lastfenxing=m
end if
end if
end if
next
i=0
for m = 0 to nlast
if (vbfenxing(m)<>0) then
i=i+1
vbfennumber(m)=i
end if
next
'vbfennumber(nlast)=0
'vbfenxing(nlast)=-vbfenxing(lastfenxing)
x1=0
x2=0
x3=0
x4=0
x5=0
x6=0
x7=0
bi=0
maxbi=0
zhsh=0
'先取三个分型数据,然后进入循环处理
a=0
'Do While (vbfenxing(a) = 0 and a <= nlast) Do While ( a < nlast)
if ( vbfenxing(a) <> 0) then
exit do
end if
a = a + 1
Loop
a=x1+1
Do While ( a < nlast)
if ( vbfenxing(a) <> 0) then
exit do
end if
a = a + 1
Loop
x2=a
a=x2+1
Do While ( a < nlast)
if ( vbfenxing(a) <> 0) then
exit do
end if
a = a + 1
Loop
x3=a
a=x3+1
bi=0
zhshbegin=x1
zzg=0
zzd=0
zgg=0
zdd=0
zg=0
zd=0
gg=0
dd=0
FOR m=a TO nlast
'(1)开始按照找出不能形成线段(中枢)的连续三笔中的中间那笔是两个线段(中枢)的分界标志
'其它则是不同级别的中枢和线段的思路设计
'在大盘和指数中分笔与1分中1分级别要大一些,在个股中1分要大一些因有的个股1分钟内可能无成交
if (vbfenxing(m)<>0) then
'(2) begin 只在分型不为0时进行处理,即:是分型时处理
bi=bi+1
x4=m
if (zhshbegin=0) then
zhshbegin=x4
end if
if (vbfenxing(x1)>0) then
'以顶分型开始,x1,x3取高点x2,x4取低点,线段及中枢区间取高点中的低者,低点中的高者
zg=min(vbh(x1),vbh(x3))
'临时中枢高点
zd=max(vbl(x2),vbl(x4))
'临时中枢低点
gg=max(vbh(x1),vbh(x3))
'临时中枢高高点
dd=min(vbl(x2),vbl(x4))
'临时中枢低低点
else
'以底分型开始,x2,x4取高点x1,x3取低点
zg=min(vbh(x2),vbh(x4))
'临时中枢高点
zd=max(vbl(x1),vbl(x3))
'临时中枢低点
gg=max(vbh(x2),vbh(x4))
'临时中枢高高点
dd=min(vbl(x1),vbl(x3))
'临时中枢低低点
end if
if (zd>zg ) then
'(3)中枢低点大于高点,即未形成中枢,要将x2,x3的位置记录出来
vbweibi(x2)=1
vbweibi(x3)=2
'msgbox("当前的vbweibi(x3):" & cstr(vbweibi(x3)))
maxbi=max(maxbi,bi)
vbbicount(x2)=bi
bi=-1
zhshbegin=0
else
'(3)中枢低点小于等于高点,即形成中枢,不用记录位置
end if
'(3)结束,将x1,x2,x3的值分别换成x2,x3,x4的值,也即向前推进一个分型,然后再返回进行比较
x1=x2
x2=x3
x3=x4
end if
'(2) 结束
NEXT
'(1)结束找出所有连续三笔无重叠的位置,即不能形成中枢的候选位置,以下要对这些位置进行筛选并逐个分析,看图时要特别注意这些位置
'以下为自定义函数部分
Function max(a, b)
If (a >= b) Then
max = a
Else
max = b
End If
End Function
Function min(a, b)
If (a <= b) Then
min = a
Else
min = b
End If
End Function
("foxweibi")=vbweibi ("foxbicount")=vbbicount ("foxh") =vbh
("foxl") =vbl
("foxbaohan") = vbbaohan ("foxbaohan1") = vbbaohan1 ("foxguanxi") = vbguanxi ("foxfenxing") = vbfenxing ("foxfenxing1") = vbfenxing1 ("foxfennumber") = vbfennumber ("foxquekou") = vbquekou
%>
FOXXIAN:=LING;
FOXXIANG:=LING;
FOXXIAND:=LING;
FOXTEG:=LING;
FOXTED:=LING;
FOXTEGX:=LING;
FOXTEG1:=LING;
FOXTED1:=LING;
FOXTEGX1:=LING; FOXDATATYPE:=DATATYPE; FOXTEBAO:=LING;
FOXTEBAO1:=LING; FOXTEGUANXI1:=LING; FOXFENNUMXIAN:=LING; FOXZQDM:=STRLEFT(STKLABEL,2); FOXXIAOSHU:=0;
<%
vbquekou=("foxquekou") vbfennumber=("foxfennumber")
vbdatanumber = ("foxdatatype")
vbfennumxian=("foxfennumxian")
vbxiaoshu=("foxxiaoshu")
vbh = ("foxh")
vbL = ("foxl")
vbh1 = ("foxh")
vbL1 = ("foxl")
vbbaohan = ("foxbaohan")
vbbaohan1 = ("foxbaohan1")
vbguanxi = ("foxguanxi")
vbfenxing = ("foxfenxing")
vbfenxing1 = ("foxfenxing1")
vbzqdm = ("foxzqdm")
vbxian=("foxxian")
vbxiang=("foxxiang")
vbxiand=("foxxiand")
vbteg=("foxteg")
vbted=("foxted")
vbtegx=("foxtegx")
vbtebao=("foxtebao")
vbtebao1=("foxtebao1")
vbteg1=("foxteg1")
vbted1=("foxted1")
vbtegx1=("foxtegx1")
vbweibi=("foxweibi")
vbbicount=("foxbicount")
nlast = UBound( vbh )
'msgbox("当前的数据类型为:" & cstr(vbzqdm))
IF ( vbzqdm ="58" or vbzqdm ="90" or vbzqdm ="03" or vbzqdm ="18" or vbzqdm ="50" or vbzqdm ="51" or vbzqdm ="52" ) THEN
vbxiaoshu=3
else
vbxiaoshu=2
end if
IF ((vbdatanumber>=0 OR vbdatanumber=1 ) )THEN
'IF ((vbdatanumber=0 OR vbdatanumber=1 ) and ( vbzqdm ="88" or vbzqdm ="1b" or vbzqdm ="1B" or vbzqdm ="1a" or vbzqdm ="1A" or vbzqdm ="39" ) )THEN
ELSE
FOR m=0 TO nlast
if (vbfenxing(m)<>0) then
vbxian(m)=vbfenxing(m)
vbxiang(m)=vbh(m)
vbxiand(m)=vbl(m)
end if
NEXT
ENd IF
'笔的数据是按K线数据自动计算的即:vbfenxing
'初始计算相关数据置为0 当数据类型为0和1即分笔和1分钟时要按笔-线段的过程组成中枢
'其它级别(指5分钟及以上)时用笔组成中枢此时要将笔的数据即:分型位置代入线段数组中
IF ((vbdatanumber>=0 OR vbdatanumber=1 ) )THEN
'IF ((vbdatanumber=0 OR vbdatanumber=1 ) and ( vbzqdm ="88" or vbzqdm ="1b" or vbzqdm ="1B" or vbzqdm ="1a" or vbzqdm ="1A" or vbzqdm ="39" ) )THEN
'(1)分笔和1分钟计算线段数据 vbzqdm =0 为指数
'公式还未考虑开始连续三笔无重叠不能形成线段的处理,缠论中对此也未明确不能形成线段的笔应发生属于那个线段
'对走势中间连续三笔无重叠不能形成线段的处理也未明确不能形成线段的笔应属于那个线段
'缠论中规定线段是连续的且以不同的分型作为两个端点即:不能顶到顶和底到底,此规定要考虑的
i = 0
ex=0
Do While ( i <= nlast)
If (vbfenxing(i) <> 0 ) then
exit do
end if
i = i + 1
Loop
x1 = i
xianbegin = x1
i = x1 + 1
Do While ( i <= nlast)
If (vbfenxing(i) <> 0 ) then
exit do
end if
i = i + 1
Loop
x2 = i
i = x2 + 1
Do While ( i <= nlast)
If (vbfenxing(i) <> 0 ) then
exit do
end if
i = i + 1
Loop
x3 = i
i = x3 + 1
Do While ( ex=0 )
'()
if (x3>nlast or x2>nlast ) then
'msgbox("当前的1 x2:" & cstr(x2) & "当前的1 x3:" & cstr(x3) & "当前的nlast:" & cstr(nlast) )
exit do
end if
if ( vbweibi(x2)=0 or vbweibi(x3)=0 or vbweibi(x3)=1 or vbweibi(x2)=2 ) then
'msgbox("当前的1 x2:" & cstr(x2) & "当前的1 x3:" & cstr(x3) & "当前的nlast:" & cstr(nlast) )
exit do
else
x1=x2
x2=x3
Do While ( i <= nlast)
If (vbfenxing(i) <> 0 ) then
exit do
end if
i = i + 1
Loop
x3 = i
i = x3 + 1
end if
loop
'()
i = x3 + 1
xianbegin = x1
tewei = x2
if (x3<=nlast) then
If (vbfenxing(x1) = 1) Then
xianfang = -1
'以顶分型开始,线段方向向下
vbted(tewei) = vbl(tewei)
vbteg(tewei) = vbh(x3)
Else
xianfang = -1
'以底分型开始,线段方向向上
vbteg(tewei) = vbl(tewei)
vbted(tewei) = vbh(x3)
End If
vbtegx(tewei) = xianfang
'定义出第一个特征序列,及关系即:是上升的还是下降的
end if
'tewei = x4
tenumber = 0
i = x3 + 1
vbxian(xianbegin) = vbfenxing(xianbegin)
vbxiang(xianbegin) = vbh(xianbegin)
vbxiand(xianbegin) = vbl(xianbegin)
'vbxiang(xianbegin) = gg
'vbxiand(xianbegin) = dd
For m = i To nlast
'(2)
Do While ( m <= nlast)
If (vbfenxing(m) <> 0 ) then
exit do
end if
m = m + 1
Loop
x4 = m
m = x4 + 1
Do While ( m <= nlast)
If (vbfenxing(m) <> 0 ) then
exit do
end if
m = m + 1
Loop
x5 = m
m = x5 + 1
newtewei = x4
if ( x5 > nlast) then
exit for
end if
If (xianfang = -1) Then
'xianfang=-1 以顶分型开始,线段方向向下
vbted(newtewei) = vbl(newtewei)
vbteg(newtewei) = vbh(x5)
Else
'xianfang=1 以底分型开始,线段方向向上
vbteg(newtewei) = vbh(newtewei)
vbted(newtewei) = vbl(x5)
End If
'判断方向/缺口及包含
vbtegx(newtewei) = xianfang
tenumber = 1 + tenumber
'if (tenumber >= 1) then
If (vbted(newtewei) > vbted(tewei) And vbteg(newtewei) > vbteg(tewei) Or vbted(newtewei) < vbted(tewei) And vbteg(newtewei) < vbteg(tewei)) Then
'(3)向上或向下即:不是包含
If (vbted(newtewei) > vbted(tewei) And vbteg(newtewei) > vbteg(tewei)) Then
'(4) 特征序列的方向向上
tefang = 1
Else
tefang = -1
'(4)特征序列的方向向下
End If
vbtegx(newtewei) = tefang
If (xianfang <> tefang) Then
'(5)线段方向与特征序列的方向不同,即:出现了特征序列的分型线段方向与特征序列关系不同,出现分型,
'首先判断自tewei(x2)开始的三笔是否构成线段,构成线段则下一步,不构成线段返回原线段继续,再判断第一个(tewei的前一个特征序列)与第二个(tewei)之间是否有缺口if ( vbweibi(x4)=0 or vbweibi(x3)=0 or vbweibi(x4)=1 or vbweibi(x3)=2 ) then
'if ( vbweibi(x6)=0 or vbweibi(x5)=0 ) then
'{}构成线段,新线段从newtewei开始,原线段在newtewei处结束还要判断顶是否大于底
if (tenumber <= 1) then
'(tenumber)此情况发生在三笔构成线段但线段的两端不是其最高点或最低点的情况,当下只有三笔不能开始新线段否则就出现一笔构成一个线段的现象了
i=m
Do While ( i <= nlast)
If (vbfenxing(i) <> 0 ) then
exit do
end if
i = i + 1
Loop
x6 = i
if ( x6 > nlast) then
'msgbox( " {}当前的x6:" & cstr(x6) & "当前的nlast:" & cstr(nlast) )
exit for
end if
'再判断x5,x6是否构成线段,构成则新线段否则原线段继续
if ( vbweibi(x6)=0 or vbweibi(x5)=0 or vbweibi(x6)=1 or vbweibi(x5)=2 ) then
'开始构成新线段,新线段在newtewei开始
xianbegin=newtewei
vbxian(xianbegin) = vbfenxing(xianbegin)
vbxiang(xianbegin) = vbh(xianbegin)
vbxiand(xianbegin) = vbl(xianbegin)
x2=x5
x3=x6
tewei=x2
m = x6 + 1
If (vbfenxing(xianbegin) = 1) Then xianfang = -1
'以顶分型开始,线段方向向下
vbted(tewei) = vbl(tewei)
vbteg(tewei) = vbh(x3)
Else
xianfang = 1
'以底分型开始,线段方向向上
vbteg(tewei) = vbh(tewei)
vbted(tewei) = vbl(x3)
End If
vbtegx(tewei) = xianfang
tenumber = 0
else
'else 原线段继续
tewei=newtewei
vbtegx(newtewei) = xianfang
x2=x4
x3=x5
m = x5 + 1
end if
'开始结束
else
'(tenumber)
tenumber = 0
bao = 0
xianbegin = tewei
vbxian(xianbegin) = vbfenxing(xianbegin) vbxiang(xianbegin) = vbh(xianbegin) vbxiand(xianbegin) = vbl(xianbegin)
x2 = X3
x3 = x4
tewei = x2
If (vbfenxing(xianbegin) = 1) Then xianfang = -1
'以顶分型开始,线段方向向下
vbted(tewei) = vbl(tewei)
vbteg(tewei) = vbh(x3)
Else
xianfang = 1
'以底分型开始,线段方向向上
vbteg(tewei) = vbh(tewei)
vbted(tewei) = vbl(x3)
End If
vbtegx(tewei) = xianfang
m = x3+1
end if
'(tenumber)
else
'{}不构成线段,原线段继续
tewei=newtewei
vbtegx(newtewei) = xianfang
x2=x4
x3=x5
m = x5 + 1
end if
'{}
Else
'(5)线段方向与特征序列关系相同,未出现分型tewei的值更新为newtewei
'tenumber = 1+tenumber
vbtegx(newtewei) = xianfang
tewei=newtewei
x2=x4
x3=x5
End If
'(5)
Else
'(3)包含
vbtegx(newtewei) = xianfang
If (vbted(tewei) >= vbted(newtewei) And vbteg(tewei) <= vbteg(newtewei)) Then
'后面包含前面 newtewei是后面的tewei在前面1为tewei被后一个包含2为newtewei包含前一个
vbtebao(tewei) = 1
vbtebao(newtewei) = 2
Else
'前面包含后面-1为tewei包含后一个-2为newtewei被前一个包含
vbtebao(tewei) = -1
vbtebao(newtewei) = -2
End If
If (xianfang = -1) Then
'线段方向向下取向下包含
temp = min(vbted(newtewei), vbted(tewei))
vbted(newtewei) = temp
vbted(tewei) = temp
temp = min(vbteg(newtewei), vbteg(tewei))
vbteg(newtewei) = temp
vbteg(tewei) = temp
Else
'线段方向向上取向上包含
temp = max(vbted(newtewei), vbted(tewei))
vbted(newtewei) = temp
vbted(tewei) = temp
temp = max(vbteg(newtewei), vbteg(tewei))
vbteg(newtewei) = temp
vbteg(tewei) = temp
End If
'判断与tewei的前面是否有连续的包含关系
temp = tewei - 1
ex = 0
bao = 0
Do While (ex = 0)
Do While ( temp >=0)
If (vbteg(temp) <> 0 ) then
exit do
end if
temp = temp - 1
Loop
if (temp<0) then
'msgbox("当前的10 temp:" & cstr(temp) & "当前的nlast:" & cstr(nlast) )
exit do
end if
If (vbtebao(temp) = 0 Or vbtebao(temp) >= 2 Or vbtebao(temp) = -2 Or vbtegx(temp) <> xianfang) Then
ex = 1
Else
bao = bao + 1
End If
temp = temp - 1
Loop
'有几个连续包含,指大于三个K线的包含,BAO的值是包含的K线数减2,当只有两个连续K线包含时BAO为0
temp = tewei - 1
For i = 1 To bao
Do While ( temp >=0)
If (vbteg(temp) <> 0 ) then
exit do
end if
temp = temp - 1
Loop
if (temp<0) then
'msgbox("当前的11 temp:" & cstr(temp) & "当前的nlast:" & cstr(nlast) )
exit for
end if
vbteg(temp) = vbteg(tewei)
vbted(temp) = vbted(tewei)
temp = temp - 1
Next
vbtebao(newtewei) = bao + 2
temp = tewei - 1
For i = 1 To bao + 2
If (i = 1 Or i = bao + 2) Then
Else
Do While ( temp >0)
If (vbteg(temp) <> 0 ) then
exit do
end if
temp = temp - 1
Loop
if (temp<0) then
'msgbox("当前的12 temp:" & cstr(temp) & "当前的nlast:" & cstr(nlast) ) exit for
end if
vbtebao(temp) = -3
temp = temp - 1
End If
Next
tewei=newtewei
x2=x4
x3=x5
m = x5 + 1
End If
'(3)
Next
'(2)
For i = 0 To nlast
If (vbtebao(i) = -2) Then
vbtebao(i) = 2
End If
If (vbtebao1(i) = -2) Then
vbtebao1(i) = 2
End If
Next
'包含关系标准化,即结束标志都为2及以上
'处理线段的两个端点满足条件顶>=底
i=0
do while (vbxian(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastfenxing=i
for m = lastfenxing+1+ nlast to nlast
if (vbxian(m)<>0) then
if (vbxian(m)>0) then
if (vbxiang(m)>=vbxiand(lastfenxing)) then
'满足条件顶>=底
lastfenxing=m
else
'不满足条件顶<底两个全置为0,并查下一个vbxian(m)=0
vbxian(lastfenxing)=0
vbxiang(m)=0
vbxiang(lastfenxing)=0
vbxiand(m)=0
vbxiand(lastfenxing)=0
m=m+1
do while (vbxian(m)=0)
m=m+1
if (m>nlast) then
Exit Do
end if
loop
lastfenxing=m
end if
else
if (vbxiand(m)<=vbxiang(lastfenxing)) then
'满足条件底<顶
lastfenxing=m
else
'不满足条件底<顶两个全置为0,并查下一个vbxian(m)=0
vbxian(lastfenxing)=0
vbxiang(m)=0
vbxiang(lastfenxing)=0
vbxiand(m)=0
vbxiand(lastfenxing)=0
m=m+1
do while (vbxian(m)=0)
if (m>nlast) then
Exit Do
end if
loop
lastfenxing=m
end if
end if
end if
next
'计算线段的高点和低点
i=0
do while (vbxian(i)=0)
i=i+1
if (i>nlast) then
Exit Do
end if
loop
lastfenxing=i
'vbxiang(i)=vbh(i)
'vbxiand(i)=vbl(i)
gg=vbxiang(i)
dd=vbxiand(i)
for m = lastfenxing+1+ nlast to nlast if (vbfenxing(m)<>0) then
gg=max(gg,vbh(m))
dd=min(dd,vbl(m))
if (vbxian(m)<>0) then
vbxiang(i)=gg
vbxiand(i)=dd
if (vbxian(m)>0) then
else
end if
gg=vbh(m)
dd=vbl(m)
end if
end if
next
end if
'(1)
i=nlast
do while (vbxian(i)=0)
if (i>nlast or i<0) then
Exit Do
end if
loop
lastfenxing=i
'vbxian(nlast) = -vbxian(lastfenxing) 'vbxiang(nlast) = vbh(nlast)
'vbxiand(nlast) = vbl(nlast)
'vbteg(newtewei) = 0
'vbted(newtewei) = 0
'以下为自定义函数部分
Function max(a, b)
If (a >= b) Then
max = a
Else
max = b
End If
End Function
Function min(a, b)
If (a <= b) Then
min = a
Else
min = b
End If
End Function ("foxxiaoshu") =vbxiaoshu ("foxteg")=vbteg
("foxted")=vbted ("foxtegx")=vbtegx
("foxteg1")=vbteg1
("foxted1")=vbted1
("foxtegx1")=vbtegx1 ("foxtebao")=vbtebao ("foxtebao1")=vbtebao1 ("foxxian")=vbxian ("foxxiang")=vbxiang ("foxxiand")=vbxiand
%>
FOXWEI:=LING; FOXBUYSELL:=LING;
<%
vbdatanumber3 = ("datanumber3") vbbicount=("foxbicount") vbweibi=("foxweibi") vbquekou=("foxquekou") vbfennumber=("foxfennumber") vbfennumxian=("foxfennumxian") vbh = ("foxh")
vbL = ("foxl")
vbh1 = ("foxh")
vbL1 = ("foxl")
vbbaohan = ("foxbaohan") vbbaohan1 = ("foxbaohan1") vbguanxi = ("foxguanxi") vbfenxing = ("foxfenxing") vbfenxing1 = ("foxfenxing1") vbbuysell=("foxbuysell")
vbwei=("foxwei")
vbxian=("foxxian")
vbxiang=("foxxiang")
vbxiand=("foxxiand")
vbteg=("foxteg")
vbted=("foxted")
vbtegx=("foxtegx")
vbteg1=("foxteg1")
vbted1=("foxted1")
vbtegx1=("foxtegx1")
nlast = UBound( vbh )
i=0
for m = 0 to nlast
if (vbxian(m)<>0) then
i=i+1
vbfennumxian(m)=i
end if
next
'vbfennumxian(nlast)=0
x1=0
x2=0
x3=0
x4=0
x5=0
x6=0
x7=0
bi=0
maxbi=0。