驚艷新代碼---來啦!波浪尺的第二部分代碼為你奉上! 一大早發(fā)布的波浪尺算法代碼,評論區(qū)討論熱烈,這也從側面反映出該思路的價值和建立通用性算法的極大意義,不再耽擱,繼續(xù)分享。 上一文章《驚艷新代碼---EBE波浪尺的算法分享》,建立的是EBE的波浪尺,接下來完成BEB波浪尺的算法。 接著延續(xù)網友留言中的相反方向,進行算法建立--- 網友的留言 思路步驟 依據相反的方向,波浪尺的定義,包含了B2、B1以及E1三個元素;
算法建立 1. TE2:=CONST(PEAKBARS(1,F,W+1)); TE1:=CONST(PEAKBARS(1,F,W)); TB2:=CONST(TROUGHBARS(2,G,W+1)); TB1:=CONST(TROUGHBARS(2,G,W)); RE1:=IF(CURRBARSCOUNT<=TE1+1 AND RANGE(TE1,TB1,TB2),CONST(PEAK(1,F,W)),DRAWNULL); RB2:=IF(CURRBARSCOUNT<=TB2+1,CONST(TROUGH(2,G,W+1)),DRAWNULL); RB1:IF(CURRBARSCOUNT<=TB1+1 AND RB2<CONST(TROUGH(2,G,W)),CONST(TROUGH(2,G,W)),DRAWNULL),COLORYELLOW; DRAWLINE(CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1,H,CURRBARSCOUNT=CONST(BARSLAST(L=RB1))+1,L,0),COLORYELLOW; DRAWLINE(CURRBARSCOUNT=CONST(BARSLAST(L=RB2))+1,L,CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1,H,0),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1 AND RANGE(TE1,TB1,TB2),H*1.003,'B'),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(L=RB1))+1,L*0.997,'C'),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(L=RB2))+1,L*0.997,'A'),COLORYELLOW; 2. RBE:=RE1-RB2; 3. RBE0382:RB1+RBE*0.382,DOTLINE; RBE05:RB1+RBE*0.5,DOTLINE; RBE0618:RB1+RBE*0.618,DOTLINE; RBE100:RB1+RBE,COLORYELLOW; RBE1382:RB1+RBE+RBE*0.382,DOTLINE; RBE15:RB1+RBE+RBE*0.5,DOTLINE; RBE1618:RB1+RBE+RBE*0.618,DOTLINE; RBE200:RB1+RBE*2,COLORYELLOW; 4. STICKLINE(CURRBARSCOUNT=IF(INTPART((TB1+1)/2)=1,2,INTPART((TB1+1)/2)),RB1,RBE200,0,0),COLORYELLOW; 5. DRAWNUMBER(ISLASTBAR,RBE0382,RBE0382); DRAWNUMBER(ISLASTBAR,RBE05,RBE05); DRAWNUMBER(ISLASTBAR,RBE0618,RBE0618); DRAWNUMBER(ISLASTBAR,RBE100,RBE100); DRAWNUMBER(ISLASTBAR,RBE1382,RBE1382); DRAWNUMBER(ISLASTBAR,RBE15,RBE15); DRAWNUMBER(ISLASTBAR,RBE1618,RBE1618); DRAWNUMBER(ISLASTBAR,RBE200,RBE200); 代碼流程 江豐魚的BEB波浪尺代碼 效果示意 BEB波浪尺效果示意圖 完整代碼 {先做篩選再用該算法} TE2:=CONST(PEAKBARS(1,F,W+1)); TE1:=CONST(PEAKBARS(1,F,W)); TB2:=CONST(TROUGHBARS(2,G,W+1)); TB1:=CONST(TROUGHBARS(2,G,W)); RE1:=IF(CURRBARSCOUNT<=TE1+1 AND RANGE(TE1,TB1,TB2),CONST(PEAK(1,F,W)),DRAWNULL); RB2:=IF(CURRBARSCOUNT<=TB2+1,CONST(TROUGH(2,G,W+1)),DRAWNULL); RB1:IF(CURRBARSCOUNT<=TB1+1 AND RB2<CONST(TROUGH(2,G,W)),CONST(TROUGH(2,G,W)),DRAWNULL),COLORYELLOW; DRAWLINE(CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1,H,CURRBARSCOUNT=CONST(BARSLAST(L=RB1))+1,L,0),COLORYELLOW; DRAWLINE(CURRBARSCOUNT=CONST(BARSLAST(L=RB2))+1,L,CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1,H,0),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(H=RE1))+1 AND RANGE(TE1,TB1,TB2),H*1.003,'B'),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(L=RB1))+1,L*0.997,'C'),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=CONST(BARSLAST(L=RB2))+1,L*0.997,'A'),COLORYELLOW; RBE:=RE1-RB2; RBE0382:RB1+RBE*0.382,DOTLINE; RBE05:RB1+RBE*0.5,DOTLINE; RBE0618:RB1+RBE*0.618,DOTLINE; RBE100:RB1+RBE,COLORYELLOW; RBE1382:RB1+RBE+RBE*0.382,DOTLINE; RBE15:RB1+RBE+RBE*0.5,DOTLINE; RBE1618:RB1+RBE+RBE*0.618,DOTLINE; RBE200:RB1+RBE*2,COLORYELLOW; STICKLINE(CURRBARSCOUNT=IF(INTPART((TB1+1)/2)=1,2,INTPART((TB1+1)/2)),RB1,RBE200,0,0),COLORYELLOW; DRAWNUMBER(ISLASTBAR,RBE0382,RBE0382); DRAWNUMBER(ISLASTBAR,RBE05,RBE05); DRAWNUMBER(ISLASTBAR,RBE0618,RBE0618); DRAWNUMBER(ISLASTBAR,RBE100,RBE100); DRAWNUMBER(ISLASTBAR,RBE1382,RBE1382); DRAWNUMBER(ISLASTBAR,RBE15,RBE15); DRAWNUMBER(ISLASTBAR,RBE1618,RBE1618); DRAWNUMBER(ISLASTBAR,RBE200,RBE200); 至此,波浪尺算法建立全部完成---后續(xù)會依照評論區(qū)的反饋進行相應的優(yōu)化。 我的努力只為達成你的成功,贊賞是相伴前行的動力。 |
|
來自: dushikuaile > 《選股公式》