驚豔新代碼---來啦!波浪尺的第二部分代碼為你奉上!
一大早發布的波浪尺算法代碼,評論區讨論熱烈,這也從側面反映出該思路的價值和建立通用性算法的極大意義,不再耽擱,繼續分享。
上一文章《驚豔新代碼---EBE波浪尺的算法分享》,建立的是EBE的波浪尺,接下來完成BEB波浪尺的算法。
接着延續網友留言中的相反方向,進行算法建立---
網友的留言
思路步驟
依據相反的方向,波浪尺的定義,包含了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);
至此,波浪尺算法建立全部完成---後續會依照評論區的反饋進行相應的優化。
我的努力隻為達成你的成功,贊賞是相伴前行的動力。
江豐魚的文章隻在今日頭條首發,未經授權禁止引用和轉載;文中代碼均可運行。
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!