缠论一买、三买选股公式(飞狐+悟多公式)_第1页
缠论一买、三买选股公式(飞狐+悟多公式)_第2页
缠论一买、三买选股公式(飞狐+悟多公式)_第3页
缠论一买、三买选股公式(飞狐+悟多公式)_第4页
缠论一买、三买选股公式(飞狐+悟多公式)_第5页
已阅读5页,还剩86页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精选优质文档-倾情为你奉上精选优质文档-倾情为你奉上专心-专注-专业专心-专注-专业精选优质文档-倾情为你奉上专心-专注-专业缠论一买、三买选股公式(飞狐+悟多公式) 2009-08-14 11:42:38 阅读5639 评论20 字号:大中小订阅 一买的选股公式初步搞出来的,当然还不完善,不能算是一买的公式,充其量算选出即将盘整背驰的,不过两个中枢下的盘整背驰就是一买了,当然真正是否背驰还要靠人工来判断,它只能初选,不过也省下很多事了,欢迎使用,多提意见。beginif DATAPERIOD=0 then minbi:=fbase.var2#min1; if DATAPERIOD=1 the

2、n minbi:=fbase.var2#min5; if DATAPERIOD=2 then minbi:=fbase.var2#min30; if DATAPERIOD=3 then minbi:=fbase.var2#min60; if DATAPERIOD=4 then minbi:=fbase.var2#day; if DATAPERIOD=5 then minbi:=fbase.var2#day; if DATAPERIOD=6 then minbi:=fbase.var2#week; if DATAPERIOD=7 then minbi:=fbase.var2#month; if

3、DATAPERIOD=8 then minbi:=fbase.var2#year;var001:=fbase.var2#min30;if datatype=3 then var001:=fbase.var2#min60;if datatype=4 then var001:=fbase.var2#day;var1:=;var2:=;处理笔关系var3:=chzhshchtongji(minbi);同级别分解zg:=chzhshchzg(var3);/一定要先调用ZGzd:=chzhshchzd(var3);zswz:=barslast(zgzd);tj3:=count(abs(var3),bar

4、slast(var3=1)=0;tj4:=l0;tj6:=ref(h,barslast(var2=1)zd,barslast(var3=1)0;not(zgzd)&tj3&tj7&tj4&tj5&tj6;end;一买是模糊的,不准确的,三买就比较标准了,同样背驰需自行判断,否则不背驰就跌回中枢了:beginif DATAPERIOD=0 then minbi:=fbase.var2#min1; if DATAPERIOD=1 then minbi:=fbase.var2#min5; if DATAPERIOD=2 then minbi:=fbase.var2#min30; if DATAPER

5、IOD=3 then minbi:=fbase.var2#min60; if DATAPERIOD=4 then minbi:=fbase.var2#day; if DATAPERIOD=5 then minbi:=fbase.var2#day; if DATAPERIOD=6 then minbi:=fbase.var2#week; if DATAPERIOD=7 then minbi:=fbase.var2#month; if DATAPERIOD=8 then minbi:=fbase.var2#year;var001:=fbase.var2#min30;if datatype=3 th

6、en var001:=fbase.var2#min60;if datatype=4 then var001:=fbase.var2#day;var1:=;var2:=;处理笔关系var3:=chzhshchtongji(minbi);同级别分解zg:=chzhshchzg(var3);/一定要先调用ZGzd:=chzhshchzd(var3);var1:=;var2:=;var4:=barslast(var0010);tj1:=ref(var001,var2)=-1; /上级别是底var5:=sum(abs(var2),var2);tj2:=var5=1; /第一个回调才算tj3:=count

7、(abs(var3),barslast(var3=-1)=0;zswz:=barslast(zgzd);tj4:=count(zgzd,barslast(var3=-1)0;tj5:=count(var2=1,barslast(var2=-1)=1;tj6:=count(var2=1,zswz-1)=1;tj7:=ref(l,barslast(var2=1)ref(zg,barslast(zgzd);not(zgzd)&tj3&tj4&tj5&tj6&tj7;end;MA10:=MA(CLOSE,10);MA5:=MA(CLOSE,5);MA1:=MA5-MA10;MA2:=MA10;MA3:

8、=MA10;DATANUMBER:=DATATYPE;DATANUMBER1:=DATATYPE;DATANUMBER2:=DATATYPE;DATANUMBER3:=DATATYPE;LING:=HIGH; 0) thenbianhua = 1nvalue = nvalue + vbma(i)elsebianhua = 2nvaluefu = nvaluefu + vbma(i) end if if (oldbianhua = bianhua) thenelsevbma3(i) = mm=0if (bianhua = 1) thenvbma2(i) = nvaluefunvaluefu =

9、0nvaluefu = 0elsevbma2(i) = nvaluenvalue = 0nvalue = 0end ifend ifoldbianhua = bianhuanext FFL.VarData(ma2) = vbma2FFL.VarData(ma3) = vbma3FFL.VarData(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)

10、,0),colorFFFF;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; 0)

11、thenDo While (vbma(m)0)nvalue = vbma(m) + nvaluei=i+1m=m-1if(m0) thenexit doend ifLoopelseDo While (vbma(m)0)nvalue = vbma(m) + nvaluei=i+1m=m-1if(mDRAWNUMBER(WEIHE0 AND 0=1,IF(WEIHE0,HIGH,LOW),WEIHE*1000,0),colorFF;DRAWNUMBER(WEIHE0 AND 0=1,(IF(WEIHE0,HIGH,LOW)-DATANUMBER*2,WEIPING*1000,0),colorFF0

12、0;DRAWNUMBER(WEIPING0 AND 0=1,(IF(WEIHE0,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;FOXBAOHAN

13、1:=LING;FOXGUANXI:=LING;FOXFENXING:=LING;FOXFENXING1:=LING;FOXFENNUMBER:=LING;FOXQUEKOU:=LING;FOXBICOUNT:=LING;FOXWEIBI:=LING;vbh(m-1) and vbl(m)vbl(m-1) thenvbguanxi(m)=1elseif (vbh(m)vbh(m-1) and vbl(m)=vbh(m-1) and vbl(m)=vbh(m-1) and vbl(m)nlast) thenExit Doend ifloop第一个包含的位置lastfenxing=ibao=0ex

14、istbao=0for m = i tonlastif (vbbaohan(m) 0) thenbao=bao+1if (bao=2) thenif (vbbaohan(m)=2 and vbbaohan(m-1)=1 or vbbaohan(m)=-2 and vbbaohan(m-1)=-1) thenvbbaohan1(m) = baoif (bao2) thenexistbao=BAOfor i = 1 tobaovbh(m-bao+i)=vbh(m)vbL(m-bao+i)=vbl(m)if (i = 1 or i=bao ) thenelsevbbaohan1(m-bao+i)=-

15、3end ifnextend ifdo while (bao1)vbh(m-bao+1)=vbh(m)vbL(m-bao+1)=vbl(m)if (existbao=BAO or bao=existbao-1) thenelsevbbaohan1(m-bao+1)=-3end ifbao=bao-1loopbao=0end ifend ifelsebao=0end ifnext分型预处理existbao=vbguanxi(0)for m = 1 tonlastif (vbh(m-1)=vbh(m-2) and vbh(m-1)=vbh(m) and vbl(m-1)=vbl(m-2) and

16、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) thenend ifif(vbguanxi(m)existbao) thenif(vbguanxi(m-1)=1) thenvbfenxing(m-1) = 1顶else vbfenxing(m-1) = -1底end ifexistbao=vbguanxi(m)end ifnext以上分型预处理for m = 0 tonlastvbfenxing1(m) = vbfenxing(m)vbfenxin

17、g1(m) = 0nexti=0do while (vbfenxing(i)=0)i=i+1if (inlast) thenExit Doend iflooplastfenxing=i取第一个分型位置下面去掉连续的顶或底for m = lastfenxing+1+nlasttonlastif(vbfenxing(m)0) thenif (vbfenxing(m)vbfenxing(lastfenxing) thenlastfenxing=melseif (vbfenxing(m)=1) thenif (vbh(m)vbh(lastfenxing) thenvbfenxing(lastfenxi

18、ng)=0lastfenxing=melsevbfenxing(m)=0end ifelseif (vbl(m)vbl(lastfenxing) thenvbfenxing(lastfenxing)=0lastfenxing=melsevbfenxing(m)=0end ifend if顶要高的底要低的 相等时要选时间在前面的vbfenxing(m)=0end ifend ifnext以下处理分型间距离不小于4的要求同时处理连续的顶和底的问题bao=0i=0n=0existbao=vbfenxing(0)m=0do while (vbbaohan1(i) nlast) thenExit Doe

19、nd iflooplastbaohan=i第一个包含位置i=0do while (vbfenxing(i)=0)i=i+1if (inlast) thenExit Doend ifloop第一个预备分型位置lastfenxing=ilastfenxing1=lastfenxingi=0for m = lastfenxing+1 tonlastif (vbbaohan(m) = 0) thenbao=bao+1elseif (vbbaohan1(m) =2) thenn=n+1end ifend ifvbfenxing1(m) = bao+n包含关系只视为一个k线vbfenxing1(m)=vb

20、baohan1(m)if (m735) thenexit forend ifif(vbfenxing(m)0) thenif (bao+n= 4) then分型间距离大于等于4 符合要求if (vbfenxing(m)vbfenxing(lastfenxing) thenvbfenxing1(m)=vbfenxing(m)n=0bao=0lastfenxing1=lastfenxinglastfenxing=melseif (vbfenxing(m)=1) thenif (vbh(m)vbh(lastfenxing) thenexit for vbfenxing(lastfenxing)=0n

21、=0bao=0lastfenxing1=lastfenxinglastfenxing=melsevbfenxing(m)=0end ifelseif (vbl(m)vbl(lastfenxing) thenvbfenxing(lastfenxing)=0n=0bao=0lastfenxing1=lastfenxinglastfenxing=melsevbfenxing(m)=0end ifend if顶要高的底要低的 相等时要选时间在前面的end if将上一个分开型位置数据更新为当下位置else分型间距离小于4 要看情况 若与前分型不同且破坏前笔,可保留其它情况要去掉破坏前笔即相邻分型不同且高

22、于上上个顶或低于上上个底if (vbfenxing(m)vbfenxing(lastfenxing) thenvbfenxing1(m)=vbfenxing(m)i=lastfenxing-1do while (vbfenxing(i)vbfenxing(m)i=i-1if (i=0) thenExit Doend iflooplastfenxing1=lastfenxingi=lastfenxing1if (vbfenxing(m)=1) thenif (vbl(m)vbl1(m)thent1=vbl1(m)elset1=vbl(m)end ifif (vbh(i)vbh1(i)thent2

23、=vbh(m)elset2=vbh1(m)end ifif (t1t2) thenn=0bao=0lastfenxing1=lastfenxinglastfenxing=melsevbfenxing(m)=0end ifelseif (vbh(m)vbh1(m)thent1=vbh(m)elset1=vbh1(m)end ifif (vbl(i)vbl1(i)thent2=vbl(m)elset2=vbl1(m)end ifif (t1t2) thenif (vbh(m)vbh(lastfenxing) thenexit for vbfenxing(lastfenxing)=0n=0bao=0

24、lastfenxing1=lastfenxinglastfenxing=melsevbfenxing(m)=0end ifelseif (vbl(m)nlast) thenExit Doend iflooplastfenxing=i取第一个分型位置下面去掉连续的顶或底for m = lastfenxing+1+nlasttonlastif(vbfenxing(m)0) thenif (vbfenxing(m)vbfenxing(lastfenxing) thenlastfenxing=melseif (vbfenxing(m)=1) thenif (vbh(m)vbh(lastfenxing)

25、 thenvbfenxing(lastfenxing)=0lastfenxing=melsevbfenxing(m)=0end ifelseif (vbl(m)nlast) thenExit Doend iflooplastfenxing=ifor m = lastfenxing+1 tonlastif(vbfenxing(m)0) thenif(vbfenxing(m)0) thenif (vbh(m)vbl(lastfenxing) then满足条件顶底lastfenxing=melse不满足条件顶底 两个全置为0,并查下一个vbfenxing(m)=0vbfenxing(lastfenx

26、ing)=0m=m+1do while (vbfenxing(m)=0)m=m+1if (mnlast) thenExit Doend iflooplastfenxing=mend ifelseif (vbl(m)vbh(lastfenxing) then满足条件底顶lastfenxing=melse不满足条件底nlast) thenExit Doend iflooplastfenxing=mend ifend ifend ifnexti=0for m = 0 tonlastif (vbfenxing(m)0) theni=i+1vbfennumber(m)=iend ifnextvbfenn

27、umber(nlast)=0vbfenxing(nlast)=-vbfenxing(lastfenxing)x1=0 x2=0 x3=0 x4=0 x5=0 x6=0 x7=0bi=0maxbi=0zhsh=0先取三个分型数据,然后进入循环处理a=0Do While (vbfenxing(a) = 0 and a = nlast)Do While ( a nlast)if ( vbfenxing(a) 0) thenexit doend ifa = a + 1Loopx1=aa=x1+1Do While ( a nlast)if ( vbfenxing(a) 0) thenexit doend

28、 ifa = a + 1Loopx2=aa=x2+1Do While ( a nlast)if ( vbfenxing(a) 0) thenexit doend ifa = a + 1Loopx3=aa=x3+1bi=0zhshbegin=x1zzg=0zzd=0zgg=0zdd=0zg=0zd=0gg=0dd=0FOR m=a TO nlast (1)开始 按照找出不能形成线段(中枢)的连续三笔中的中间那笔是两个线段(中枢)的分界标志其它则是不同级别的中枢和线段的思路设计在大盘和指数中分笔与1分中1分级别要大一些,在个股中1分要大一些因有的个股1分钟内可能无成交if (vbfenxing(m

29、)0) then(2) begin 只在分型不为0时进行处理,即:是分型时处理bi=bi+1x4=mif (zhshbegin=0) thenzhshbegin=x4end ifif (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取低点z

30、g=min(vbh(x2),vbh(x4)临时中枢高点zd=max(vbl(x1),vbl(x3)临时中枢低点gg=max(vbh(x2),vbh(x4)临时中枢高高点dd=min(vbl(x1),vbl(x3)临时中枢低低点end ifif (zdzg ) then(3)中枢低点大于高点,即未形成中枢,要将x2,x3的位置记录出来vbweibi(x2)=1vbweibi(x3)=2msgbox(当前的vbweibi(x3): & cstr(vbweibi(x3)maxbi=max(maxbi,bi)vbbicount(x2)=bibi=-1zhshbegin=0else(3)中枢低点小于等于

31、高点,即形成中枢,不用记录位置end if(3)结束,将x1,x2,x3的值分别换成x2,x3,x4的值,也即向前推进一个分型,然后再返回进行比较x1=x2x2=x3x3=x4end if(2) 结束 NEXT(1)结束找出所有连续三笔无重叠的位置,即不能形成中枢的候选位置,以下要对这些位置进行筛选并逐个分析,看图时要特别注意这些位置以下为自定义函数部分Function max(a, b)If (a = b) Thenmax = aElsemax = bEnd IfEnd FunctionFunction min(a, b)If (a FOXXIAN:=LING;FOXXIANG:=LING;

32、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;=0 OR vbdatanumber=1 )THENIF (vbdatanumber=0 OR vbdatanumber=1 ) an

33、d (vbzqdm =88 or vbzqdm =1b or vbzqdm =1B or vbzqdm =1a or vbzqdm =1A or vbzqdm =39 ) )THENELSEFOR m=0 TO nlast if (vbfenxing(m)0) thenvbxian(m)=vbfenxing(m)vbxiang(m)=vbh(m)vbxiand(m)=vbl(m)end ifNEXTENd IF笔的数据是按K线数据自动计算的即:vbfenxing初始计算相关数据置为0当数据类型为0和1即分笔和1分钟时要按笔-线段的过程组成中枢其它级别(指5分钟及以上)时用笔组成中枢此时要将笔的

34、数据即:分型位置代入线段数组中IF (vbdatanumber=0 OR vbdatanumber=1 )THENIF (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 为指数公式还未考虑开始连续三笔无重叠不能形成线段的处理,缠论中对此也未明确不能形成线段的笔应发生属于那个线段对走势中间连续三笔无重叠不能形成线段的处理也未明确不能形成线段

35、的笔应属于那个线段缠论中规定线段是连续的且以不同的分型作为两个端点即:不能顶到顶和底到底,此规定要考虑的i = 0ex=0Do While ( i = nlast)If (vbfenxing(i) 0 ) thenexit doend ifi = i + 1Loopx1 = ixianbegin = x1i = x1 + 1Do While ( i = nlast)If (vbfenxing(i) 0 ) thenexit doend ifi = i + 1Loopx2 = ii = x2 + 1Do While ( i = nlast)If (vbfenxing(i) 0 ) thenexi

36、t doend ifi = i + 1Loopx3 = ii = x3 + 1Do While ( ex=0)()if (x3nlast or x2nlast ) thenmsgbox(当前的1 x2: & cstr(x2) & 当前的1 x3: & cstr(x3) & 当前的nlast: & cstr(nlast) )exit doend ifif ( vbweibi(x2)=0 or vbweibi(x3)=0orvbweibi(x3)=1 or vbweibi(x2)=2) thenmsgbox(当前的1 x2: & cstr(x2) & 当前的1 x3: & cstr(x3) & 当

37、前的nlast: & cstr(nlast) )exit doelsex1=x2x2=x3Do While ( i = nlast)If (vbfenxing(i) 0 ) thenexit doend ifi = i + 1Loopx3 = ii = x3 + 1end ifloop()i = x3 + 1xianbegin = x1tewei = x2if (x3=nlast) thenIf (vbfenxing(x1) = 1) Thenxianfang = -1以顶分型开始,线段方向向下vbted(tewei) = vbl(tewei)vbteg(tewei) = vbh(x3)Els

38、exianfang = -1以底分型开始,线段方向向上vbteg(tewei) = vbl(tewei)vbted(tewei) = vbh(x3)End Ifvbtegx(tewei) = xianfang定义出第一个特征序列,及关系即:是上升的还是下降的end iftewei = x4tenumber = 0i = x3 + 1vbxian(xianbegin) = vbfenxing(xianbegin)vbxiang(xianbegin) = vbh(xianbegin)vbxiand(xianbegin) = vbl(xianbegin)vbxiang(xianbegin) = gg

39、vbxiand(xianbegin) = ddFor m = i To nlast(2)Do While ( m = nlast)If (vbfenxing(m) 0 ) thenexit doend ifm = m + 1Loopx4 = mm = x4 + 1Do While ( m = nlast)If (vbfenxing(m) 0 ) thenexit doend ifm = m + 1Loopx5 = mm = x5 + 1newtewei = x4if ( x5 nlast) thenexit forend ifIf (xianfang = -1) Thenxianfang=-1

40、 以顶分型开始,线段方向向下vbted(newtewei) = vbl(newtewei)vbteg(newtewei) = vbh(x5)Elsexianfang=1 以底分型开始,线段方向向上vbteg(newtewei) = vbh(newtewei)vbted(newtewei) = vbl(x5)End If判断方向/缺口及包含vbtegx(newtewei) = xianfangtenumber = 1 + tenumberif (tenumber = 1) thenIf (vbted(newtewei) vbted(tewei) And vbteg(newtewei) vbteg

41、(tewei) Or vbted(newtewei) vbted(tewei) And vbteg(newtewei) vbted(tewei) And vbteg(newtewei) vbteg(tewei) Then(4) 特征序列的方向向上tefang = 1Elsetefang = -1(4)特征序列的方向向下End Ifvbtegx(newtewei) = tefangIf (xianfang tefang) Then(5)线段方向与特征序列的方向不同,即:出现了特征序列的分型 线段方向与特征序列关系不同,出现分型,首先判断自tewei(x2)开始的三笔是否构成线段,构成线段则下一步

42、,不构成线段返回原线段继续,再判断第一个(tewei的前一个特征序列)与第二个(tewei)之间是否有缺口if ( vbweibi(x4)=0 or vbweibi(x3)=0orvbweibi(x4)=1 or vbweibi(x3)=2) thenif ( vbweibi(x6)=0 or vbweibi(x5)=0 ) then构成线段,新线段从newtewei开始,原线段在newtewei处结束 还要判断顶是否大于底if (tenumber = 1) then(tenumber)此情况发生在三笔构成线段但线段的两端不是其最高点或最低点的情况,当下只有三笔不能开始新线段否则就出现一笔构成

43、一个线段的现象了i=mDo While ( i = nlast)If (vbfenxing(i) 0 ) thenexit doend ifi = i + 1Loopx6 = iif ( x6 nlast) thenmsgbox( 当前的x6: & cstr(x6) & 当前的nlast: & cstr(nlast) )exit forend if再判断x5,x6是否构成线段,构成则新线段否则原线段继续if ( vbweibi(x6)=0 or vbweibi(x5)=0 orvbweibi(x6)=1 or vbweibi(x5)=2 ) then开始 构成新线段,新线段在newtewei开

44、始xianbegin=newteweivbxian(xianbegin) = vbfenxing(xianbegin)vbxiang(xianbegin) = vbh(xianbegin)vbxiand(xianbegin) = vbl(xianbegin)x2=x5x3=x6tewei=x2m = x6 + 1If (vbfenxing(xianbegin) = 1) Thenxianfang = -1以顶分型开始,线段方向向下vbted(tewei) = vbl(tewei)vbteg(tewei) = vbh(x3)Elsexianfang = 1以底分型开始,线段方向向上vbteg(t

45、ewei) = vbh(tewei)vbted(tewei) = vbl(x3)End Ifvbtegx(tewei) = xianfangtenumber = 0elseelse 原线段继续tewei=newteweivbtegx(newtewei) = xianfangx2=x4x3=x5m = x5 + 1end if开始结束else(tenumber)tenumber = 0bao = 0 xianbegin = teweivbxian(xianbegin) = vbfenxing(xianbegin)vbxiang(xianbegin) = vbh(xianbegin)vbxiand

46、(xianbegin) = vbl(xianbegin)x2 = X3x3 = x4tewei = x2If (vbfenxing(xianbegin) = 1) Thenxianfang = -1以顶分型开始,线段方向向下vbted(tewei) = vbl(tewei)vbteg(tewei) = vbh(x3)Elsexianfang = 1以底分型开始,线段方向向上vbteg(tewei) = vbh(tewei)vbted(tewei) = vbl(x3)End Ifvbtegx(tewei) = xianfangm = x3+1end if(tenumber)else不构成线段,原

47、线段继续tewei=newteweivbtegx(newtewei) = xianfangx2=x4x3=x5m = x5 + 1end ifElse(5)线段方向与特征序列关系相同,未出现分型tewei的值更新为newteweitenumber = 1+tenumbervbtegx(newtewei) = xianfangtewei=newteweix2=x4x3=x5End If(5)Else(3)包含vbtegx(newtewei) = xianfangIf (vbted(tewei) = vbted(newtewei) And vbteg(tewei) =0)If (vbteg(tem

48、p) 0 ) thenexit doend iftemp = temp - 1Loopif (temp= 2 Or vbtebao(temp) = -2 Or vbtegx(temp) xianfang) Thenex = 1Elsebao = bao + 1End Iftemp = temp - 1Loop有几个连续包含,指大于三个K线的包含,BAO的值是包含的K线数减2,当只有两个连续K线包含时BAO为0temp = tewei - 1For i = 1 To baoDo While ( temp =0)If (vbteg(temp) 0 ) thenexit doend iftemp =

49、 temp - 1Loopif (temp0)If (vbteg(temp) 0 ) thenexit doend iftemp = temp - 1Loopif (temp=底i=0do while (vbxian(i)=0)i=i+1if (inlast) thenExit Doend iflooplastfenxing=ifor m = lastfenxing+1+ nlast tonlastif(vbxian(m)0) thenif(vbxian(m)0) thenif (vbxiang(m)=vbxiand(lastfenxing) then满足条件顶=底lastfenxing=me

50、lse不满足条件顶nlast) thenExit Doend iflooplastfenxing=mend ifelseif (vbxiand(m)=vbxiang(lastfenxing) then满足条件底顶lastfenxing=melse不满足条件底nlast) thenExit Doend iflooplastfenxing=mend ifend ifend ifnext计算线段的高点和低点i=0do while (vbxian(i)=0)i=i+1if (inlast) thenExit Doend iflooplastfenxing=ivbxiang(i)=vbh(i)vbxia

51、nd(i)=vbl(i)gg=vbxiang(i)dd=vbxiand(i)for m = lastfenxing+1+ nlast tonlastif(vbfenxing(m)0) thengg=max(gg,vbh(m)dd=min(dd,vbl(m)if(vbxian(m)0) thenvbxiang(i)=ggvbxiand(i)=ddif(vbxian(m)0) thenelseend ifgg=vbh(m)dd=vbl(m)end ifend ifnextend if(1)i=nlastdo while (vbxian(i)=0)i=i-1if (inlast or i= b) T

52、henmax = aElsemax = bEnd IfEnd FunctionFunction min(a, b)If (a FOXWEI:=LING;FOXBUYSELL:=LING;%vbdatanumber3 = FFL.VarData(datanumber3) vbbicount=FFL.Vardata(foxbicount)vbweibi=FFL.Vardata(foxweibi)vbquekou=FFL.VarData(foxquekou)vbfennumber=FFL.VarData(foxfennumber) vbfennumxian=FFL.VarData(foxfennum

53、xian) 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) vbbuysell=FFL.VarD

54、ata(foxbuysell) vbwei=FFL.Vardata(foxwei)vbxian=FFL.Vardata(foxxian)vbxiang=FFL.Vardata(foxxiang)vbxiand=FFL.Vardata(foxxiand)vbteg=FFL.Vardata(foxteg)vbted=FFL.Vardata(foxted)vbtegx=FFL.Vardata(foxtegx)vbteg1=FFL.Vardata(foxteg1)vbted1=FFL.Vardata(foxted1)vbtegx1=FFL.Vardata(foxtegx1)nlast = UBound

55、( vbh ) i=0for m = 0 tonlastif (vbxian(m)0) theni=i+1vbfennumxian(m)=iend ifnextvbfennumxian(nlast)=0 x1=0 x2=0 x3=0 x4=0 x5=0 x6=0 x7=0bi=0maxbi=0zhsh=0先取三个分型数据,然后进入循环处理a=0Do While (vbxian(a) = 0 and a = nlast)Do While ( a nlast)if ( vbxian(a) 0) thenexit doend ifa = a + 1Loopx1=aa=x1+1Do While ( a

56、 nlast)if ( vbxian(a) 0) thenexit doend ifa = a + 1Loopx2=aa=x2+1Do While ( a nlast)if ( vbxian(a) 0) thenexit doend ifa = a + 1Loopx3=aa=x3+1bi=0zhshbegin=x1zzg=0zzd=0zgg=0zdd=0zg=0zd=0gg=0dd=0vbbicount=FFL.Vardata(foxbicount)vbweibi=FFL.Vardata(foxweibi)FOR m=a TO nlast (1)开始 按照找出不能形成线段(中枢)的连续三笔中的

57、中间那笔是两个线段(中枢)的分界标志其它则是不同级别的中枢和线段的思路设计在大盘和指数中分笔与1分中1分级别要大一些,在个股中1分要大一些因有的个股1分钟内可能无成交if (vbxian(m)0) then(2) begin 只在分型不为0时进行处理,即:是分型时处理bi=bi+1x4=mif (zhshbegin=0) thenzhshbegin=x4end ifif (vbxian(x1)0) then以顶分型开始,x1,x3取高点x2,x4取低点,线段及中枢区间取高点中的低者,低点中的高者zg=min(vbxiang(x1),vbxiang(x3)临时中枢高点zd=max(vbxiand

58、(x2),vbxiand(x4)临时中枢低点gg=max(vbxiang(x1),vbxiang(x3)临时中枢高高点dd=min(vbxiand(x2),vbxiand(x4)临时中枢低低点else以底分型开始,x2,x4取高点x1,x3取低点zg=min(vbxiang(x2),vbxiang(x4)临时中枢高点zd=max(vbxiand(x1),vbxiand(x3)临时中枢低点gg=max(vbxiang(x2),vbxiang(x4)临时中枢高高点dd=min(vbxiand(x1),vbxiand(x3)临时中枢低低点end ifif (zdzg ) then(3)中枢低点大于高

59、点,即未形成中枢,要将x2,x3的位置记录出来vbwei(x2)=1vbwei(x3)=2还要计算上一个中枢的级别和中枢区间及波动区间,计算中枢的级别根据bi记数器的值,中枢计算完毕后笔记数器bi清零bi记数器的值小于等于6时为本级别中枢,值为7或8时可能为本级别两个中枢,大于或等于9时为上一级别的中枢maxbi=max(maxbi,bi)vbbicount(x2)=bibi=-1zhshbegin=0else(3)中枢低点小于等于高点,即形成中枢,不用记录位置end if(3)结束,将x1,x2,x3的值分别换成x2,x3,x4的值,也即向前推进一个分型,然后再返回进行比较x1=x2x2=x

60、3x3=x4end if(2) 结束 NEXT(1)结束找出所有连续三线段无重叠的位置,即不能形成中枢的候选位置,以下要对这些位置进行筛选并逐个分析,看图时要特别注意这些位置FFL.Vardata(foxweibi)=vbweibiFFL.Vardata(foxbicount)=vbbicountFunction max(a, b)If (a = b) Thenmax = aElsemax = bEnd IfEnd FunctionFunction min(a, b)If (a FOXZHSH:=LING;FOXZHSHG:=LING;FOXZHSHD:=LING;FOXZHSHGG:=LIN

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论