通達(dá)信波段空間計(jì)算主圖指標(biāo)公式源碼(無源碼的請(qǐng)下載附件導(dǎo)入)
{指標(biāo)介紹:指標(biāo)在參數(shù)調(diào)整窗設(shè)置有【顯示開關(guān)】,作用是通過調(diào)整參數(shù),選擇顯示不同的顯示數(shù)據(jù)。
“1”是回調(diào)、反彈的預(yù)測(cè),“2”是回調(diào)預(yù)測(cè),“3”是反彈預(yù)測(cè)。(參考附圖五、六、七)
預(yù)測(cè)計(jì)算:C1、C2、C3 按預(yù)測(cè)贏家算法;C4按波浪半對(duì)數(shù)的G=0.875(甘氏角)算法; C5、C6按費(fèi)氏黃金分割1.236、1.618算法。}
波段微調(diào):=2;
顯示開關(guān):=1;
DRAWTEXT_FIX(1,0.30,0.00005,1,'說明: 適當(dāng)改變【波段微調(diào)】參數(shù)的數(shù)值,可變動(dòng)波段的位置。'),COLORYELLOW;
QS:=zig(1,波段微調(diào));
低點(diǎn):=TROUGHBARS(2,波段微調(diào),1);
高點(diǎn):=PEAKBARS(1,波段微調(diào),1);
L低:=IF(低點(diǎn)=0,L,IF(高點(diǎn)<低點(diǎn),TROUGH(2,波段微調(diào),1),REF(TROUGH(2,波段微調(diào),1),1)));
H高:=IF(高點(diǎn)=0,H,IF(低點(diǎn)<高點(diǎn),PEAK(1,波段微調(diào),1),REF(PEAK(1,波段微調(diào),1),1)));
L低A:=IF(高點(diǎn)<低點(diǎn) AND 顯示開關(guān)=1 OR 顯示開關(guān)=2,L低,DRAWNULL);
H高A:=IF(高點(diǎn)<低點(diǎn) AND 顯示開關(guān)=1 OR 顯示開關(guān)=2,H高,DRAWNULL);
DRAWTEXT(低點(diǎn)=0,L,VARCAT('【低點(diǎn)】',VAR2STR(L,2))),COLORGREEN;
DRAWTEXT(高點(diǎn)=0,H,VARCAT('【高點(diǎn)】',VAR2STR(H,2))),COLORRED;
DRAWLINE(低點(diǎn)=0,L,高點(diǎn)=0,H,0)COLORRED,LINETHICK2;
DRAWLINE(高點(diǎn)=0,H,低點(diǎn)=0,L,0)COLORGREEN,LINETHICK2;
VAR1:=SQRT(H高A/L低A);
VAR2:=SQRT(VAR1);
A:=H高A/SQRT(VAR1);
B:=H高A/VAR1;
D:=H高A/(VAR1+VAR2-1);
E:=POW(L低A,0.875)*POW(H高A,0.125);
I:=H高A-(H高A-L低A)*1.236,NODRAW;
U:=H高A-(H高A-L低A)*1.618,NODRAW;
DRAWTEXT(高點(diǎn)=0,(A),VARCAT('C1=',VAR2STR(A,2))),COLORYELLOW;
DRAWTEXT(高點(diǎn)=0,(B),VARCAT('C2=',VAR2STR(B,2))),COLORYELLOW;
DRAWTEXT(高點(diǎn)=0,(D),VARCAT('C3=',VAR2STR(D,2))),COLORYELLOW;
DRAWTEXT(高點(diǎn)=0,(E),VARCAT('G4=',VAR2STR(E,2))),COLORLIRED;
DRAWTEXT(高點(diǎn)=0,(I),VARCAT('C5=',VAR2STR(I,2))),COLORLIRED;
DRAWTEXT(高點(diǎn)=0,(U),VARCAT('G6=',VAR2STR(U,2))),COLORLIRED;
STICKLINE(高點(diǎn)<低點(diǎn),A,A,3,1),COLORFF8800;
STICKLINE(高點(diǎn)<低點(diǎn),B,B,3,1),COLORFF8800;
STICKLINE(高點(diǎn)<低點(diǎn),D,D,3,1),COLORFF8800;
STICKLINE(高點(diǎn)<低點(diǎn),E,E,3,1),COLORFF8800;
STICKLINE(高點(diǎn)<低點(diǎn),I,I,3,1),COLORFF8800;
STICKLINE(高點(diǎn)<低點(diǎn),U,U,3,1),COLORFF8800;
STICKLINE(高點(diǎn)=0,H,U,0,0),COLORFF8800;
L低1:=IF(低點(diǎn)=0,L,IF(高點(diǎn)<低點(diǎn),TROUGH(2,波段微調(diào),1),REF(TROUGH(2,波段微調(diào),1),1)));
H高1:=IF(高點(diǎn)=0,H,IF(低點(diǎn)<高點(diǎn),PEAK(1,波段微調(diào),1),REF(PEAK(1,波段微調(diào),1),1)));
L低B:=IF(高點(diǎn)>低點(diǎn) AND 顯示開關(guān)=1 OR 顯示開關(guān)=3,L低1,DRAWNULL);
H高B:=IF(高點(diǎn)>低點(diǎn) AND 顯示開關(guān)=1 OR 顯示開關(guān)=3,H高1,DRAWNULL);
VAR3:=SQRT(H高B/L低B);
VAR4:=SQRT(VAR3);
F:=L低B*SQRT(VAR3),NODRAW;
G:=L低B*VAR3,NODRAW;
J:=L低B*(VAR3+VAR4-1),NODRAW;
K:=POW(H高B,0.875)*POW(L低B,0.125);
P:=L低B+(H高B-L低B)*1.236,NODRAW;
Q:=L低B+(H高B-L低B)*1.618,NODRAW;
DRAWTEXT(低點(diǎn)=0,(F),VARCAT('C1=',VAR2STR(F,2))),COLORWHITE;
DRAWTEXT(低點(diǎn)=0,(G),VARCAT('C2=',VAR2STR(G,2))),COLORWHITE;
DRAWTEXT(低點(diǎn)=0,(J),VARCAT('C3=',VAR2STR(J,2))),COLORWHITE;
DRAWTEXT(低點(diǎn)=0,(K),VARCAT('C4=',VAR2STR(K,2))),COLORGREEN;
DRAWTEXT(低點(diǎn)=0,(P),VARCAT('C5=',VAR2STR(P,2))),COLORGREEN;
DRAWTEXT(低點(diǎn)=0,(Q),VARCAT('C6=',VAR2STR(Q,2))),COLORGREEN;
STICKLINE(低點(diǎn)<高點(diǎn),F,F,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)<高點(diǎn),G,G,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)<高點(diǎn),J,J,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)<高點(diǎn),K,K,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)<高點(diǎn),P,P,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)<高點(diǎn),Q,Q,3,1),COLORMAGENTA;
STICKLINE(低點(diǎn)=0,L,Q,0,0),COLORMAGENTA;
DRAWICON(高點(diǎn)=0,H,39);
DRAWICON(低點(diǎn)=0,L,38);
|