缠三----指标以式
-
相关简介:缠三 缠三 input:SHOWAVERAGE(0,0,1),showcount(0,0,1),showsum(0,0,1),p(26,20,100),s(12,5,40),m(9,2,60); MA10:=MA(CLOSE,10); MA5:=MA(CLOSE,5); MA1:=(MA5-MA10); MA2:=MA10; MA3:=MA10; DATANUMBER:=DATATYPE; DATANUMBER1:=DATATYPE; DATANUMBER2:=DATATYPE; DATANUM
-
文章来源:股海网作者:股海网发布时间:2013-10-12浏览次数:
缠三
缠三
input:SHOWAVERAGE(0,0,1),showcount(0,0,1),showsum(0,0,1),p(26,20,100),s(12,5,40),m(9,2,60);
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 = FFL.VarData("datanumber")
vbdatanumber1 = FFL.VarData("datanumber1")
vbdatanumber2 = FFL.VarData("datanumber2")
vbdata=1
vbdata1=0.001
vbdata2=1
Select Case vbdatanumber
Case 0
vbdata=0.015
vbdata1=0.001
vbdata2=0.015
Case 1
vbdata=0.018
vbdata1=0.001
vbdata2=0.018
Case 2
vbdata=0.037
vbdata1=0.001
vbdata2=0.037
Case 3
vbdata=0.052
vbdata1=0.001
vbdata2=0.052
Case 4
vbdata=0.067
vbdata1=0.001
vbdata2=0.067
Case 5
vbdata=0.13
vbdata1=0.001
vbdata2=0.13
Case 6
vbdata=0.28
vbdata1=0.001
vbdata2=0.28
Case 7
vbdata=0.45
vbdata1=0.001
vbdata2=0.45
Case 8
vbdata=0.73
vbdata1=0.001
vbdata2=0.73
Case 9
vbdata=1.2
vbdata1=0.001
vbdata2=1.2
Case 10
vbdata=0.6
vbdata1=0.001
vbdata2=0.6
Case 11
vbdata=0.1
vbdata1=0.001
vbdata2=0.1
Case 12
vbdata=0.02
vbdata1=0.001
vbdata2=0.02
Case else
vbdata=2
vbdata1=0.001
vbdata2=2
End Select
FFL.VarData("datanumber") =vbdata
FFL.VarData("datanumber1") =vbdata1
FFL.VarData("datanumber2") =vbdata2
vbling = FFL.VarData("ling")
vbma = FFL.VarData("ma1")
vbma2 = FFL.VarData("ma2")
vbma3 = FFL.VarData("ma3")
nlast = UBound( vbma )
nvalue = 0.0000
nvaluefu = 0.0000
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
FFL.VarData("ma2") = vbma2
FFL.VarData("ma3") = vbma3
FFL.VarData("ling") =vbling
%>
DRAWNUMBER(((REF(MA2,0)<0) AND (SHOWSUM=1)),LLV(LOW,5),(REF(MA2,0)*1000),0),colorFF00;
DRAWNUMBER(((REF(MA2,0)<0) AND (SHOWCOUNT=1)),(LLV(LOW,5)-DATANUMBER),REF(MA3,0),0),colorFFFF;
DRAWNUMBER(((REF(MA2,0)<0) AND (SHOWAVERAGE=1)),(LLV(LOW,5)-(DATANUMBER*2)),((REF(MA2,0)*1000)/REF(MA3,0)),0),colorFF00;
DRAWNUMBER(((REF(MA2,0)>0) AND (SHOWSUM=1)),HHV(HIGH,5),(REF(MA2,0)*1000),0),colorFF;
DRAWNUMBER(((REF(MA2,0)>0) AND (SHOWCOUNT=1)),(HHV(HIGH,5)+DATANUMBER),REF(MA3,0),0),colorFFFF;
DRAWNUMBER(((REF(MA2,0)>0) AND (SHOWAVERAGE=1)),(HHV(HIGH,5)+(DATANUMBER*2)),((REF(MA2,0)*1000)/REF(MA3,0)),0),colorFF;
MA1:=(MA5-MA10);
WEIHE:=LING;
WEIPING:=LING;
<%
vbhe=FFL.VarData("weihe")
vbping=FFL.VarData("weiping")
vbma = FFL.VarData("ma1")
nlast = UBound( vbma )
nvalue = 0.0000
nvaluefu = 0.0000
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
FFL.VarData("weihe") =vbhe
FFL.VarData("weiping")= vbping
%>
DRAWNUMBER(((WEIHE<>0) AND (SHOWSUM=1)),IF((WEIHE>0),HIGH,LOW),(WEIHE*1000),0),colorFF;
DRAWNUMBER(((WEIHE<>0) AND (SHOWAVERAGE=1)),(IF((WEIHE>0),HIGH,LOW)-(DATANUMBER*2)),(WEIPING*1000),0),colorFF00;
DRAWNUMBER(((WEIPING<>0) AND (SHOWCOUNT=1)),(IF((WEIHE>0),HIGH,LOW)-DATANUMBER),(WEIHE/WEIPING),0),colorFFFF;
DIFF:=(EMA(CLOSE,S)-EMA(CLOSE,P));
DEA:=EMA(DIFF,M);
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=FFL.VarData("foxquekou")
vbfennumber=FFL.VarData("foxfennumber")
vbdatanumber = FFL.VarData("datanumber")
vbh = FFL.VarData("foxh")
vbL = FFL.VarData("foxl")
vbh1 = FFL.VarData("foxh")
vbL1 = FFL.VarData("foxl")
vbbaohan = FFL.VarData("foxbaohan")
vbbaohan1 = FFL.VarData("foxbaohan1")
vbguanxi = FFL.VarData("foxguanxi")
vbfenxing = FFL.VarData("foxfenxing")
vbfenxing1 = FFL.VarData("foxfenxing1")
vbbicount=FFL.Vardata("foxbicount")
vbweibi=FFL.Vardata("foxweibi")
nlast = UBound( vbh )
nvalue = 0.0000
nvaluefu = 0.0000
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)
else
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
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
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
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
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
x1=a
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取低点
.......
省略部分源码,看公式吧,没加密的。。。。。