纏論一買、三買選股公式(飛狐+悟多公式)_第1頁
纏論一買、三買選股公式(飛狐+悟多公式)_第2頁
纏論一買、三買選股公式(飛狐+悟多公式)_第3頁
纏論一買、三買選股公式(飛狐+悟多公式)_第4頁
纏論一買、三買選股公式(飛狐+悟多公式)_第5頁
已閱讀5頁,還剩86頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、精選優(yōu)質文檔-傾情為你奉上精選優(yōu)質文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質文檔-傾情為你奉上專心-專注-專業(yè)纏論一買、三買選股公式(飛狐+悟多公式) 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取第一個分型位置下面去掉連續(xù)的頂或底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的要求同時處理連續(xù)的頂和底的問題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將上一個分開型位置數(shù)據更新為當下位置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取第一個分型位置下面去掉連續(xù)的頂或底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滿足條件頂?shù)譴astfenxing=melse不滿足條件頂?shù)?兩個全置為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先取三個分型數(shù)據,然后進入循環(huán)處理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)開始 按照找出不能形成線段(中樞)的連續(xù)三筆中的中間那筆是兩個線段(中樞)的分界標志其它則是不同級別的中樞和線段的思路設計在大盤和指數(shù)中分筆與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取低點,線段及中樞區(qū)間取高點中的低者,低點中的高者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)結束找出所有連續(xù)三筆無重疊的位置,即不能形成中樞的候選位置,以下要對這些位置進行篩選并逐個分析,看圖時要特別注意這些位置以下為自定義函數(shù)部分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筆的數(shù)據是按K線數(shù)據自動計算的即:vbfenxing初始計算相關數(shù)據置為0當數(shù)據類型為0和1即分筆和1分鐘時要按筆-線段的過程組成中樞其它級別(指5分鐘及以上)時用筆組成中樞此時要將筆的

34、數(shù)據即:分型位置代入線段數(shù)組中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分鐘 計算線段數(shù)據vbzqdm =0 為指數(shù)公式還未考慮開始連續(xù)三筆無重疊不能形成線段的處理,纏論中對此也未明確不能形成線段的筆應發(fā)生屬于那個線段對走勢中間連續(xù)三筆無重疊不能形成線段的處理也未明確不能形成線段

35、的筆應屬于那個線段纏論中規(guī)定線段是連續(xù)的且以不同的分型作為兩個端點即:不能頂?shù)巾敽偷椎降?此規(guī)定要考慮的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)線段方向與特征序列的方向不同,即:出現(xiàn)了特征序列的分型 線段方向與特征序列關系不同,出現(xiàn)分型,首先判斷自tewei(x2)開始的三筆是否構成線段,構成線段則下一步

42、,不構成線段返回原線段繼續(xù),再判斷第一個(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)此情況發(fā)生在三筆構成線段但線段的兩端不是其最高點或最低點的情況,當下只有三筆不能開始新線段否則就出現(xiàn)一筆構成

43、一個線段的現(xiàn)象了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是否構成線段,構成則新線段否則原線段繼續(xù)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 原線段繼續(xù)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、線段繼續(xù)tewei=newteweivbtegx(newtewei) = xianfangx2=x4x3=x5m = x5 + 1end ifElse(5)線段方向與特征序列關系相同,未出現(xiàn)分型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有幾個連續(xù)包含,指大于三個K線的包含,BAO的值是包含的K線數(shù)減2,當只有兩個連續(xù)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先取三個分型數(shù)據,然后進入循環(huán)處理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)開始 按照找出不能形成線段(中樞)的連續(xù)三筆中的

57、中間那筆是兩個線段(中樞)的分界標志其它則是不同級別的中樞和線段的思路設計在大盤和指數(shù)中分筆與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取低點,線段及中樞區(qū)間取高點中的低者,低點中的高者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還要計算上一個中樞的級別和中樞區(qū)間及波動區(qū)間,計算中樞的級別根據bi記數(shù)器的值,中樞計算完畢后筆記數(shù)器bi清零bi記數(shù)器的值小于等于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)結束找出所有連續(xù)三線段無重疊的位置,即不能形成中樞的候選位置,以下要對這些位置進行篩選并逐個分析,看圖時要特別注意這些位置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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論