當前位置:首頁 > 教育 > 正文

數浪公式+薛斯通道

數浪公式+薛斯通道


N=5

v1:=ma(HIGH,30)*1.15 ;
v2:=ma(HIGH,3)*1.03;
v3:=ma(LOW,3)*0.97;
v4:=ma(LOW,30)*0.85;
{v5}大通道上:fft(v1,30);
{v6}小通道上:fft(v2,30);
{v7}小通道下:fft(v3,30);
{v8}大通道下:fft(v4,30);
A1:=大通道上-REF(大通道上,1);
A2:=小通道上-REF(小通道上,1);
A3:=小通道下-REF(小通道下,1);
A4:=大通道下-REF(大通道下,1);
PARTLINE(A1>0,大通道上) LINETHICK2 COLORRED;
PARTLINE(A1=0,大通道上) LINETHICK1 COLORWHITE;
PARTLINE(A1<0,大通道上) LINETHICK1 COLORGREEN;
PARTLINE(A2>0,小通道上) LINETHICK2 COLORRED;
PARTLINE(A2=0,小通道上) LINETHICK1 COLORWHITE;
PARTLINE(A2<0,小通道上) LINETHICK1 COLORGREEN;
PARTLINE(A3>0,小通道下) LINETHICK2 COLORRED;
PARTLINE(A3=0,小通道下) LINETHICK1 COLORWHITE;
PARTLINE(A3<0,小通道下) LINETHICK1 COLORGREEN;
PARTLINE(A4>0,大通道下) LINETHICK2 COLORRED;
PARTLINE(A4=0,大通道下) LINETHICK1 COLORWHITE;
PARTLINE(A4<0,大通道下) LINETHICK1 COLORGREEN;

kxs:=sysparam(2);
dsj:=1;
GET:zig(3,n),coloryellow;
pl5:=zig(3,5)*dsj;
en1:=zig(3,5)>ref(zig(3,5),1) and ref(zig(3,5),1)<=ref(zig(3,5),2) andref(zig(3,5),2)<=ref(zig(3,5),3)*dsj;
ex1:=zig(3,5)=ref(zig(3,5),2) andref(zig(3,5),2)>=ref(zig(3,5),3)*dsj;
pl10:=zig(3,10)*dsj;
en2:=zig(3,10)>ref(zig(3,10),1) and ref(zig(3,10),1)<=ref(zig(3,10),2)and ref(zig(3,10),2)<=ref(zig(3,10),3)*dsj;
ex2:=zig(3,10)=ref(zig(3,10),2)and ref(zig(3,10),2)>=ref(zig(3,10),3)*dsj;
pl20:=zig(3,20)*dsj;
en3:=zig(3,20)>ref(zig(3,20),1) and ref(zig(3,20),1)<=ref(zig(3,20),2)and ref(zig(3,20),2)<=ref(zig(3,20),3)*dsj;
ex3:=zig(3,20)=ref(zig(3,20),2)and ref(zig(3,20),2)>=ref(zig(3,20),3)*dsj;
pl40:=zig(3,40)*dsj;
走強1:=barslast(pl5走弱1:=barslast(pl5>ref(pl5,1));
走強2:=barslast(pl10走弱2:=barslast(pl10>ref(pl10,1));
走強3:=barslast(pl20走弱3:=barslast(pl20>ref(pl20,1));
ztjz5:=if(pl10>ref(pl10,1),count(en1,走強2),0);
ztjd5:=if(pl10>ref(pl10,1),count(ex1,走強2),0);
dtjz5:=if(pl10dtjd5:=if(pl10ztjz10:=if(pl20>ref(pl20,1),count(en2,走強3),0);
ztjd10:=if(pl20>ref(pl20,1),count(ex2,走強3),0);
dtjz10:=if(pl20dtjd10:=if(pl20drawtext(en1 and dtjz5=1,l*0.98,'㈠'),colorffff00;
drawtext(ex1 and dtjd5=2,h*1.02,'㈡'),colorffff00;
drawtext(en2 and ztjz5=1,l*0.98,'㈢'),colorffff00;
drawtext(ex1 and pl10>ref(pl10,1) and ztjd5=1,h*1.02,'⑴'),colorff;
drawtext(en1 and pl10>ref(pl10,1) and ztjz5=2,l*0.98,'⑵'),colorff;
drawtext(ex1 and pl10>ref(pl10,1) and ztjz5=2,h*1.02,'⑶'),colorff;
drawtext(en1 and pl10>ref(pl10,1) and ztjz5=3,l*0.98,'⑷'),colorff;
drawtext(ex2 and pl20>ref(pl20,1) and ztjd10=1,h*1.02,'⑸'),colorff;
drawtext(en2 and dtjz10=1,l*0.94,'Ⅰ'),colorff0000;
drawtext(ex2 and dtjd10=2,h*1.06,'Ⅱ'),colorff0000;
drawtext(en3 and ztjz10=1,l*0.94,'Ⅲ'),colorff0000;
drawtext(ex2 and pl20>ref(pl20,1) andztjd10=1,h*1.06,'①'),Linethick3,colorffff;
drawtext(en2 and pl20>ref(pl20,1) andztjz10=2,l*0.94,'②'),Linethick3,colorffff;
drawtext(ex2 and pl20>ref(pl20,1) and ztjd10=2 or (ztjd10=0 orztjd10=2) and ex2,h*1.06*dsj,'③'),Linethick3,colorffff;
drawtext(en2 and pl20>ref(pl20,1) andztjz10=3,l*0.94,'④'),Linethick3,colorffff;

點石成金


畫漸變背景色((收盤價 > 0),RGB顔色值(0,0,0),RGB顔色值(0,0,0),0);
input: N(5,1,60);
DRAWGBK(C, COLORRGB(10,40,10),COLORRGB(10,40,10),1);
{-----------------------功能開關------------------------}
jQCB:=EMA(C,3);
h1:=h;
hh:=hhv(h,21);
L1:=L;
LL:=llv(L,21);
if h1[datacount] =hh[datacount]thenbegin
if L1[datacount] =LL[datacount]thenbegin
end;
end;
頂:=hh,LINEDOT,PRECISION2,COLORYELLOW;//黃
底:=LL,LINEDOT,PRECISION2,COLORGREEN;//綠
DScj1:=PEAKBARS(3,N,1);
DScj2:=TROUGHBARS(3,N,1);
DScj3:=PEAKBARS(2,N,1);
點石:=ma(LLV(jQCB,3),DScj2+1),PRECISION2,LINETHICK,ColorFFA6FF;
成金:=ma(HHV(jQCB,1),DScj3+1),PRECISION2,LINETHICK,COLORYELLOW;
壓力:=ma(wma(h,2),DScj1+1),PRECISION2,LINETHICK,ColorFF8700;
Kn:=BARSCOUNT(C)=SYSPARAM(1); p:=SYSPARAM(1);
{未來參考K線}
F:=100*(C-REF(C,1))/REF(C,1);
p1:=IF(Cp3:=IF(C>REF(O,1) AND f>0,1,0);
p2:=IF(Cp4:=IF(C>REF(O,2) AND f>0,1,0);
買D5:=P1=0 AND REF(P1,1)=1 AND P2=0 AND REF(P2,1)=1;
賣D6:=P3=0 AND REF(P3,1)=1 AND P4=0 AND REF(P4,1)=1;
AS:=ZIG(3,3);
漲AL:=CROSS(AS,REF(AS,1));
跌AG:=CROSS(REF(AS,1),AS);
買點:=FILTER((TROUGHBARS(3,15,1)<4)=1,3);//提前一天
賣點:=FILTER((PEAKBARS(3,15,1)<4)=1,3);//提前一天
{-----------------【圖解模闆】---------------------}
{K線}
KLINE(O,H,L,C,0);
{未來K線}
STICKLINE(買點,L,(O+C)/2,0,0),COLORWHITE; {未來買點}
STICKLINE(買點,C,(O+C)/2,7,0),COLORWHITE; {未來買點}
STICKLINE(賣點,H,(O+C)/2,0,0),COLORYELLOW;{未來賣點}
STICKLINE(賣點,C,(O+C)/2,7,0),COLORYELLOW;{未來賣點}
STICKLINE(買D5 and 漲AL,L,(O+C)/2,0,0),COLORWHITE; {未來買}
STICKLINE(買D5 and 漲AL,O,(O+C)/2,7,0),COLORWHITE; {未來買}
STICKLINE(賣D6 and 跌AG,L,(O+C)/2,0,0),Color3EA63E;{未來賣}
STICKLINE(賣D6 and 跌AG,O,(O+C)/2,7,0),Color3EA63E;{未來賣}
{}
PARTLINE(C,頂),LINEDOT,COLORYELLOW;//黃
PARTLINE(C,底),LINEDOT,COLORGREEN;//綠
{}
PARTLINE(DScj1>0,壓力),ColorFFB900; //壓力--暗藍
PARTLINE(DScj2>0,點石),ColorFFA6FF; //點石--暗粉
PARTLINE(DScj3>0 and 成金>ref(成金,1),成金),LINETHICK2,Color00A3C1;//成金--金黃
{}
DRAWTEXT(Kn AND DScj2>0,點石*0.98,'點石:'+NUMTOSTR(點石[p],2)),ALIGN0,ColorFFA6FF;
DRAWTEXT(Kn AND DScj3>0 and 成金>ref(成金,1),成金,'成金:'+NUMTOSTR(成金[p],2)),ALIGN0,PXDN12,COLORYELLOW;
DRAWTEXT(Kn AND DScj1>0,壓力,'壓力:'+NUMTOSTR(壓力[p],2)),ALIGN2,PXUP12,ColorFF8700;
//

新結構波浪


新結構波浪


A1:=REF(HIGH,3)=HHV(HIGH,2*3+1); B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1); D1:=FILTER(C1,3);{高點}
A2:=REF(LOW,3)=LLV(LOW,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低點}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低點出現在同一K線上時可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
L1:=(D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{過濾後低點}
L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{過濾後高點}
DRAWLINE(LD,L,HD,H,0),COLORWHITE,LINETHICK1,POINTDOT;
DRAWLINE(HD,H,LD,L,0),COLORWHITE,LINETHICK1,POINTDOT;
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),COLORWHITE,LINETHICK1,POINTDOT;
{以上語句為新結構波浪}

A3:=HB3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD; E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2); HH:=E3>REF(E3,1);{找出全部長期高點}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1)D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2); LL:=E4>REF(E4,1);{找出全部長期低點}
DRAWICON(HH,H,10),ALIGN2; DRAWICON(LL,L,12),ALIGN1;
H3:=HH OR ISLASTBAR OR BARSCOUNT(C)=1; {後面進行過濾,方法同前。隻是不用考慮高低點出現在同一K線}
X3:=REF(BARSLAST(H3),1)+1; F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1);I3:=BACKSET(G3,2);LZ:=I3>REF(I3,1),LINETHICK0; {長期低點,也可供引用}
L4:=LZ OR ISLASTBAR OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1; F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4>REF(F4,1);I4:=BACKSET(G4,2);HZ:=I4>REF(I4,1),LINETHICK0;{長期高點,也可供引用}
DRAWLINE(HZ,H,LZ,L,0),COLORGREEN,LINETHICK1;
DRAWLINE(LZ,L,HZ,H,0),COLORGREEN,LINETHICK1;{長期連線}
K1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
DRAWLINE(K2,IF(HZ,H,L),ISLASTBAR,C,0),COLORGREEN,LINETHICK1; {最後的長期連線,連在收盤價上}

{以下是兩條趨勢線原碼}
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK1;
UU2:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK1;

前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK3;
前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK3;
前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK3;
前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK3;
短高:=REF(H,BARSLAST(VV2)),LINETHICK0;
短低:=REF(L,BARSLAST(VV)),LINETHICK0;
短比: (C-短低)/(短高-短低),LINETHICK0;

{以下語句是大盤趨勢疊加}
常數:=REF(INDEXC,BARSLAST(VV))/REF(C,BARSLAST(VV));
疊1:INDEXC/常數,COLORGRAY,LINETHICK0;
PARTLINE(1,疊1),COLORGRAY;
常數2:=REF(INDEXC,BARSLAST(XX))/REF(C,BARSLAST(XX));
疊2:INDEXC/常數2,COLORGRAY,LINETHICK0;
PARTLINE(1,疊2),COLORGRAY;

DRAWNUMBER(HD,1.02*H,DATEDIFF(REF(DATE,BARSLAST(LD)),DATE),0),COLORCYAN;
DRAWNUMBER(LD,0.98*L,DATEDIFF(REF(DATE,BARSLAST(HD)),DATE),0),COLORCYAN;

DRAWNUMBER(HD,H*(1+0.002),H,2),COLORBLUE,ALIGN0;
DRAWNUMBER(LD,L*(1.001-0.002),L,2),COLORBLUE,ALIGN0;

數浪公式+薛斯通道


v1:=簡單移動平均(最高價,30)*1.15 ;
v2:=簡單移動平均(最高價,3)*1.03;
v3:=簡單移動平均(最低價,3)*0.97;
v4:=簡單移動平均(最低價,30)*0.85;
{v5}大通道上:傅立葉變換(v1,30);
{v6}小通道上:傅立葉變換(v2,30);
{v7}小通道下:傅立葉變換(v3,30);
{v8}大通道下:傅立葉變換(v4,30);
A1:=大通道上-向前引用(大通道上,1);
A2:=小通道上-向前引用(小通道上,1);
A3:=小通道下-向前引用(小通道下,1);
A4:=大通道下-向前引用(大通道下,1);
畫分段線(A1>0,大通道上) LINETHICK2 COLORRED;
畫分段線(A1=0,大通道上) LINETHICK1 COLORWHITE;
畫分段線(A1<0,大通道上) LINETHICK1 COLORGREEN;
畫分段線(A2>0,小通道上) LINETHICK2 COLORRED;
畫分段線(A2=0,小通道上) LINETHICK1 COLORWHITE;
畫分段線(A2<0,小通道上) LINETHICK1 COLORGREEN;
畫分段線(A3>0,小通道下) LINETHICK2 COLORRED;
畫分段線(A3=0,小通道下) LINETHICK1 COLORWHITE;
畫分段線(A3<0,小通道下) LINETHICK1 COLORGREEN;
畫分段線(A4>0,大通道下) LINETHICK2 COLORRED;
畫分段線(A4=0,大通道下) LINETHICK1 COLORWHITE;
畫分段線(A4<0,大通道下) LINETHICK1 COLORGREEN;
kxs:=系統參數(2);
dsj:=1;
GET:之字轉向(3,n),coloryellow;
pl5:=之字轉向(3,5)*dsj;
en1:=之字轉向(3,5)>向前引用(之字轉向(3,5),1) and 向前引用(之字轉向(3,5),1)<=向前引用(之字轉向(3,5),2) and向前引用(之字轉向(3,5),2)<=向前引用(之字轉向(3,5),3)*dsj;
ex1:=之字轉向(3,5)<向前引用(之字轉向(3,5),1) and 向前引用(之字轉向(3,5),1)>=向前引用(之字轉向(3,5),2) and向前引用(之字轉向(3,5),2)>=向前引用(之字轉向(3,5),3)*dsj;
pl10:=之字轉向(3,10)*dsj;
en2:=之字轉向(3,10)>向前引用(之字轉向(3,10),1) and 向前引用(之字轉向(3,10),1)<=向前引用(之字轉向(3,10),2)and 向前引用(之字轉向(3,10),2)<=向前引用(之字轉向(3,10),3)*dsj;
ex2:=之字轉向(3,10)<向前引用(之字轉向(3,10),1) and 向前引用(之字轉向(3,10),1)>=向前引用(之字轉向(3,10),2)and 向前引用(之字轉向(3,10),2)>=向前引用(之字轉向(3,10),3)*dsj;
pl20:=之字轉向(3,20)*dsj;
en3:=之字轉向(3,20)>向前引用(之字轉向(3,20),1) and 向前引用(之字轉向(3,20),1)<=向前引用(之字轉向(3,20),2)and 向前引用(之字轉向(3,20),2)<=向前引用(之字轉向(3,20),3)*dsj;
ex3:=之字轉向(3,20)<向前引用(之字轉向(3,20),1) and 向前引用(之字轉向(3,20),1)>=向前引用(之字轉向(3,20),2)and 向前引用(之字轉向(3,20),2)>=向前引用(之字轉向(3,20),3)*dsj;
pl40:=之字轉向(3,40)*dsj;
走強1:=上一次條件成立位置(pl5<向前引用(pl5,1));
走弱1:=上一次條件成立位置(pl5>向前引用(pl5,1));
走強2:=上一次條件成立位置(pl10<向前引用(pl10,1));
走弱2:=上一次條件成立位置(pl10>向前引用(pl10,1));
走強3:=上一次條件成立位置(pl20<向前引用(pl20,1));
走弱3:=上一次條件成立位置(pl20>向前引用(pl20,1));
ztjz5:=條件函數(pl10>向前引用(pl10,1),統計總數(en1,走強2),0);
ztjd5:=條件函數(pl10>向前引用(pl10,1),統計總數(ex1,走強2),0);
dtjz5:=條件函數(pl10<向前引用(pl10,1),統計總數(en1,走弱2),0);
dtjd5:=條件函數(pl10<向前引用(pl10,1),統計總數(ex1,走弱2),0);
ztjz10:=條件函數(pl20>向前引用(pl20,1),統計總數(en2,走強3),0);
ztjd10:=條件函數(pl20>向前引用(pl20,1),統計總數(ex2,走強3),0);
dtjz10:=條件函數(pl20<向前引用(pl20,1),統計總數(en2,走弱3),0);
dtjd10:=條件函數(pl20<向前引用(pl20,1),統計總數(ex2,走弱3),0);
顯示文字(en1 and dtjz5=1,最低價*0.98,'㈠'),colorffff00;
顯示文字(ex1 and dtjd5=2,最高價*1.02,'㈡'),colorffff00;
顯示文字(en2 and ztjz5=1,最低價*0.98,'㈢'),colorffff00;
顯示文字(ex1 and pl10>向前引用(pl10,1) and ztjd5=1,最高價*1.02,'⑴'),colorff;
顯示文字(en1 and pl10>向前引用(pl10,1) and ztjz5=2,最低價*0.98,'⑵'),colorff;
顯示文字(ex1 and pl10>向前引用(pl10,1) and ztjz5=2,最高價*1.02,'⑶'),colorff;
顯示文字(en1 and pl10>向前引用(pl10,1) and ztjz5=3,最低價*0.98,'⑷'),colorff;
顯示文字(ex2 and pl20>向前引用(pl20,1) and ztjd10=1,最高價*1.02,'⑸'),colorff;
顯示文字(en2 and dtjz10=1,最低價*0.94,'Ⅰ'),colorff0000;
顯示文字(ex2 and dtjd10=2,最高價*1.06,'Ⅱ'),colorff0000;
顯示文字(en3 and ztjz10=1,最低價*0.94,'Ⅲ'),colorff0000;
顯示文字(ex2 and pl20>向前引用(pl20,1) andztjd10=1,最高價*1.06,'①'),Linethick3,colorffff;
顯示文字(en2 and pl20>向前引用(pl20,1) andztjz10=2,最低價*0.94,'②'),Linethick3,colorffff;
顯示文字(ex2 and pl20>向前引用(pl20,1) and ztjd10=2 or (ztjd10=0 orztjd10=2) and ex2,最高價*1.06*dsj,'③'),Linethick3,colorffff;
顯示文字(en2 and pl20>向前引用(pl20,1) andztjz10=3,最低價*0.94,'④'),Linethick3,colorffff;

STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,9,0),colorFF5B00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,8,0),colorFF6C00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,7,0),colorFF7B00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,6,0),colorFF9C00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,5,0),colorFFBE00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,3.5,0),colorFFCC00;
STICKLINE((OPEN >= CLOSE),CLOSE,OPEN,1.5,0),colorFFFF00;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,9,0),color70084;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,8,0),colorA3;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,7,0),colorB7;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,6,0),colorCD;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,5,0),colorE9;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,3,0),color754E9;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,1.5,0),color76EF3;
STICKLINE((CLOSE >= OPEN),CLOSE,OPEN,1,0),color77BF3;
STICKLINE((CLOSE > OPEN),OPEN,LOW,1,0),color726CA;
STICKLINE((CLOSE > OPEN),CLOSE,HIGH,1,0),color726CA;
STICKLINE((OPEN > CLOSE),CLOSE,LOW,1,0),colorDE9100;
STICKLINE((OPEN > CLOSE),OPEN,HIGH,1,0),colorDE9100;


n=21 input: N(5,1,100);
A1:=向前引用(最高價,N)=最高值(最高價,2*N+1);
B1:=信号過濾(A1,N);
C1:=向前賦值(B1,N+1);
D1:=信号過濾(C1,n);{高點}
A2:=向前引用(最低價,N)=最低值(最低價,2*N+1);
B2:=信号過濾(A2,N);
C2:=向前賦值(B2,N+1);
D2:=信号過濾(C2,N);{低點}
E1:=(向前引用(最低值(最低價,2*N),1)+向前引用(最高值(最高價,2*N),1))/2; E2:=(最高價+最低價)/2;{高低點出現在同一K線上時可作取舍}
H1:=(D1 AND 求邏輯非(D2 AND E1>=E2)) OR 數據位置狀态=2 OR 有效值周期數(收盤價)=1;
L1:=(D2 AND 求邏輯非(D1 AND E1=E2);
X1:=向前引用(上一次條件成立位置(H1),1)+1; F1:=向前賦值(H1 AND 統計總數(L1,X1)>0,上一低點位置
(條件函數(L1,最低價,10000),X1));
G1:=F1>向前引用(F1,1); I1:=向前賦值(G1,2); LD:=I1>向前引用(I1,1);{過濾後低點}
L2:=LD OR 數據位置狀态=2 OR 有效值周期數(收盤價)=1;
X2:=向前引用(上一次條件成立位置(L2),1)+1; F2:=向前賦值(L2 AND 統計總數(H2,X2)>0,上一高點位置
(條件函數(H2,最高價,0),X2));
G2:=F2>向前引用(F2,1); I2:=向前賦值(G2,2); HD:=I2>向前引用(I2,1);{過濾後高點}
R1:=向前賦值(數據位置狀态=2,上一次條件成立位置(HD)+1); S1:=R1>向前引用(R1,1); {前一高}
T1:=向前賦值(數據位置狀态=2,上一次條件成立位置(LD)+1); U1:=T1>向前引用(T1,1); {前一低}
R2:=向前賦值(S1,向前引用(上一次條件成立位置(HD),1)+2); S2:=R2>向前引用(R2,1); {前二高}
T2:=向前賦值(U1,向前引用(上一次條件成立位置(LD),1)+2); U2:=T2>向前引用(T2,1); {前二低}
T3:=向前賦值(U2,向前引用(上一次條件成立位置(LD),1)+2); U3:=T3>向前引用(T3,1); {前三低}
T4:=向前賦值(U3,向前引用(上一次條件成立位置(LD),1)+2); U4:=T4>向前引用(T4,1); {前四低}
R3:=向前賦值(S2,向前引用(上一次條件成立位置(HD),1)+2); S3:=R3>向前引用(R3,1); {前三高}
R4:=向前賦值(S3,向前引用(上一次條件成立位置(HD),1)+2); S4:=R4>向前引用(R4,1); {前四高}
短期壓力:畫直線(S2,最高價,S1,最高價,1),Colorred;
短期支撐:畫直線(U2,最低價,U1,最低價,1),Colorgreen;
中期壓力:畫直線(S3,最高價,S2,最高價,1),Coloryellow;
中期支撐:畫直線(U3,最低價,U2,最低價,0),Colorgreen;
長期壓力:畫直線(S4,最高價,S3,最高價,1),COLORFF00FF;
長期支撐:畫直線(U4,最低價,U3,最低價,0),Colorgreen;
畫圖标(S1,最高價*1.01,10);
畫圖标(S2,最高價*1.01,10);
畫圖标(S3,最高價*1.01,10);
畫圖标(S4,最高價*1.01,10);
畫圖标(U1,最低價*0.99,9);
畫圖标(U2,最低價*0.99,9);
畫圖标(U3,最低價*0.99,9);
畫圖标(U4,最低價*0.99,9);
畫柱線(收盤價>=開盤價,開盤價,收盤價,8,0),COLORRED;
畫柱線(收盤價>=開盤價,收盤價,最高價,0,0),COLORRED;
畫柱線(收盤價>=開盤價,最低價,開盤價,0,0),COLORRED;
畫柱線(收盤價<開盤價,收盤價,開盤價,8,0),colorFFFF00;
畫柱線(收盤價<開盤價,開盤價,最高價,0,0),colorFFFF00;
畫柱線(收盤價<開盤價,最低價,收盤價,0,0),colorFFFF00;
J:=(收盤價*2+最高價+最低價)/4;
K:=(指數平滑移動平均(J,13) - 指數平滑移動平均(J,21))*180;
D:=指數平滑移動平均(K,2);
kk:=K-D;
dd:=-1*(K-D);
jj:=交叉函數(kk,dd);
畫柱線(jj,開盤價,收盤價,8,0),COLORyellow;
畫柱線(jj,開盤價,最高價,0,0),COLORyellow;
畫柱線(jj,最低價,收盤價,0,0),COLORyellow;
ss2:=移動平均(收盤價,3,1);
ss6:=移動平均(收盤價,5,1);
dk:=2*(ss2-ss6)*15*4*1.5;
畫柱線(dk>0 and kk畫柱線(dk>0 and kk畫柱線(dk>0 and kk畫柱線(dk<0 and kk畫柱線(dk<0 and kk
畫柱線(dk<0 and kk

z:zig(4,N);a:=FLATZIG(4,N);q:=datacount; aa:=if(ISLASTBAR,0,a=1 or a=0);
w:barslast(aa),LINETHICK;s:=sum(aa,0);ss:=s[q]-s+1;ba:=barpos;
K:=if(ss<4,4,ss[SYSPARAM(1)]);
xx0:=ref(ba,barssince(ss=K));
xx1:=ref(ba,barssince(ss=K-1));
xx2:=ref(ba,barssince(ss=K-2));
x0:=xx0[q];x1:=xx1[q];x2:=xx2[q];
y0:=z[x0];y1:=z[x1];y2:=z[x2];
x:=(x1+x2)/2;y:=(y1+y2)/2;xL:=(y-y0)/(x-x0);
DRAWSL(ba=x0,z,xL,0,0),COLORMAGENTA,LINEDOT;
DRAWSL(ba=x1,z,xL,0,0),COLORGREEN,LINEDOT;
DRAWSL(ba=x2,z,xL,0,0),COLORGREEN,LINEDOT;
DRAWLINE(ba=x1,z,ba=x2,z,0),COLORGREEN,LINETHICK2;
中:LINEVALUE(ba=x0,z,ba=x0+1,y0+xL,0,0),COLORMAGENTA;
下:LINEVALUE(ba=x1,z,ba=x1+1,y1+xL,0,0),COLORGREEN;
上:LINEVALUE(ba=x2,z,ba=x2+1,y2+xL,0,0),COLORGREEN;
斜率:xL,LINETHICK;
角度:ATAN(xL)*114.6,LINETHICK;
中1:=LINEVALUE(ba=x0,z,ba=x0+1,y0+xL,1,0),COLORMAGENTA;
中0:=if(ba>x1,中,中1);
M1:=LINEVALUE(ba=x1,z,ba=x2,z,0,0);
M2:=LINEVALUE(ba=x1,z,ba=x2,z,1,0);
M:=if(ba>x,m1,m2);
u:=中0-if(y2>y1,下,上);
t0:=中0-u[q]*0.5,LINETHICK,Color005500;
t1:=中0-u[q]*1.5,LINETHICK,Color005500;
t2:=中0-u[q]*2,LINETHICK,Color005500;
wt0:=barssince(cross(t0,m) or cross(m,t0))*0;
wt1:=barssince(cross(t1,m) or cross(m,t1))*0;
wt2:=barssince(cross(t2,m) or cross(m,t2))*0;
t0+wt0,LINEDASHDOT,Color005500;
t1+wt1,LINEDASHDOT,Color005500;
t2+wt2,LINEDASHDOT,Color005500;
u0:=中0+u[q]*0.5,LINETHICK,Color005500;
u1:=中0+u[q]*1.5,LINETHICK,Color005500;
u2:=中0+u[q]*2,LINETHICK,Color005500;
wu0:=barssince(cross(u0,m) or cross(m,u0))*0;
wu1:=barssince(cross(u1,m) or cross(m,u1))*0;
wu2:=barssince(cross(u2,m) or cross(m,u2))*0;
u0+wu0,LINEDASHDOT,Color005500;
u1+wu1,LINEDASHDOT,Color005500;
u2+wu2,LINEDASHDOT,Color005500;
PARTLINE(BETWEEN(m,u2,t2),m),LINETHICK,Color005500;

UZ百分比線


UZ百分比線 附件 (1.43 KB)

2008-6-14 12:51, 下載次數: 53

黃金分割公式

{-------------------------------------------------------------}

V1:=REF(C,1);
V2:=SMA(MAX(C-V1,0),6,1)/SMA(ABS(C-V1),6,1)*100;
DRAWICON(IF(CROSS(81,V2),1,0),h*1.01,11);
Var1:=SYSPARAM(3)-SYSPARAM(2)+1;
Var2:=SYSPARAM(3)-BARPOS;
Var3:=HHV(HIGH,Var1);
Var4:=LLV(LOW,VaR1);
Var5:=REFX(Var3,Var2); //主圖最高價
Var5:IF(SYSPARAM(3)<>SYSPARAM(1),SYSPARAM(6),Var5),COLORWHITE;
Var6:REFX(Var4,Var2),COLORWHITE;//主圖最低價
黃191: (Var5-Var6)*0.191+Var6,COLORWHITE,POINTDOT;
黃382: (Var5-Var6)*0.382+Var6,COLORWHITE,POINTDOT;
黃500: (Var5-Var6)*0.500+Var6,COLORWHITE;
黃618: (Var5-Var6)*0.618+Var6,COLORWHITE,POINTDOT;
黃809: (Var5-Var6)*0.809+Var6,COLORWHITE,POINTDOT;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.0381+Var6,'最低價('+NUMTOSTR(Var6,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.191+Var6,'黃金0.191('+NUMTOSTR(黃191,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.382+Var6,'黃金0.382('+NUMTOSTR(黃382,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.500+Var6,'黃金分割中軸('+NUMTOSTR(黃500,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.618+Var6,'黃金0.618('+NUMTOSTR(黃618,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.809+Var6,'黃金0.809('+NUMTOSTR(黃809,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.981+Var6,'最高價('+NUMTOSTR(Var5,2)+')'),COLORWHITE;
zf:=(c/ref(c,4)-1)*100;
s:='z:'+NUMTOSTR(zf[SYSPARAM(1)],2);
DRAWTEXT(BARPOS=SYSPARAM(1),h,s) ALIGN4;

穩操勝券莊家顯身


//穩操勝券莊家顯身



VAR2:=REF(LOW,1);
VAR3:=((SMA(ABS((LOW - VAR2)),3,1) / SMA(MAX((LOW - VAR2),0),3,1)) * 100);
VAR4:=EMA(IF((CLOSE * 1.2),(VAR3 * 10),(VAR3 / 10)),3);
VAR5:=LLV(LOW,38);
VAR6:=HHV(VAR4,38);
VAR7:=IF(LLV(LOW,90),1,0);
VAR8:=((EMA(IF((LOW <= VAR5),((VAR4 + (VAR6 * 2)) / 2),0),3) / 618) * VAR7);
有莊的影子:STICKLINE(VAR8,0,VAR8,6,1),colorFFAAFF;
趨勢線:(((CLOSE - MA(CLOSE,40)) / MA(CLOSE,40)) * 100),colorAABBDD;
AA:=(((((REF(趨勢線,1) < REF(趨勢線,2)) AND (趨勢線 < (0 - 30))) AND (趨勢線 >= REF(趨勢線,1))) OR (REF(CROSS((0 - 30),趨勢線),1) AND CROSS(趨勢線,(0 - 30)))) OR (趨勢線 = (0 - 30)));
DRAWTEXT(AA,500,'砸鍋賣田買'),colorFFFF;
砸鍋賣田買:IF(AA,500,(0 - 30)),colorFFFF;
BB:=(((((REF(趨勢線,1) < REF(趨勢線,2)) AND (趨勢線 < (0 - 20))) AND (趨勢線 > (0 - 25))) AND (趨勢線 >= REF(趨勢線,1))) OR (REF(CROSS((0 - 20),趨勢線),1) AND CROSS(趨勢線,(0 - 20))));
DRAWTEXT(BB,300,'見底信号'),colorFF;
見底信号:IF(BB,300,(0 - 20)),colorFF;
CC:=(((((REF(趨勢線,1) < REF(趨勢線,2)) AND (趨勢線 < (0 - 25))) AND (趨勢線 > (0 - 30))) AND (趨勢線 >= REF(趨勢線,1))) OR (REF(CROSS((0 - 25),趨勢線),1) AND CROSS(趨勢線,(0 - 25))));
DRAWTEXT(CC,400,'莫錯失機會'),colorFF00;
莫錯失機會:IF(CC,400,(0 - 25)),colorFF00;
底部快顯:IF(CROSS((0 - 20),趨勢線),100,(0 - 20)),LINETHICK2,colorF0F000;
DRAWTEXT(CROSS((0 - 20),趨勢線),120,''),colorF0F000;
機會來臨:IF(CROSS((0 - 25),趨勢線),150,(0 - 25)),LINETHICK2,colorF00FF0;
DRAWTEXT(CROSS((0 - 25),趨勢線),170,''),colorF00FF0;
砸鍋賣田等:IF(CROSS((0 - 30),趨勢線),200,(0 - 30)),LINETHICK2,colorFFFFFF;
DRAWTEXT(CROSS((0 - 30),趨勢線),220,''),colorFFFFFF;
(0 - 20),POINTDOT,colorFF;
(0 - 25),POINTDOT,color1;
(0 - 30),POINTDOT,colorFFFF;

[江恩黃金分割]


input:w(2,1,3);
年:=MA(CLOSE,26);
STICKLINE(C>=年 AND C>=O,C,O,7,0),COLORRED;
STICKLINE(C>=年 AND C>=O,H,L,0,0),COLORRED;
STICKLINE(C>=年 AND CSTICKLINE(C>=年 AND CSTICKLINE(C>=年 AND C
STICKLINE(C<年 AND C>O,C,O,7,1),COLORffff00;
STICKLINE(C<年 AND C<=O,C,O,7,0),COLORffff00;
STICKLINE(C<年 AND C<=O,H,L,0,1),COLORffff00;
STICKLINE(C<年 AND C>O,C,H,0,1),COLORffff00;
STICKLINE(C<年 AND C>O,O,L,0,1),COLORffff00;

u1:=sysparam(3);
u:=u1-sysparam(2)+1;
hh:=hhv(H,u);
ll:=llv(L,u);
最高:=hh[u1],COLORYELLOW;
PARTLINE(C and w<>3,最高),COLORYELLOW;
最低:ll[u1],COLORred;
PARTLINE(C and w<>3,最低),COLORred;
PARTLINE(C and w=1,最低+(最高-最低)*0.191),LINEDOT,COLORWHITE;
PARTLINE(C and w=1,最低+(最高-最低)*0.382),LINEDOT,COLORWHITE;
PARTLINE(C and w<>3,最低+(最高-最低)*0.5),COLORGREEN;
PARTLINE(C and w=1,最低+(最高-最低)*0.618),LINEDOT,COLORWHITE;
PARTLINE(C and w=1,最低+(最高-最低)*0.809),LINEDOT,COLORWHITE;
DRAWTEXT(BARSCOUNT(C)=SYSPARAM(3) and w<>3,REF(最低,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'最低↓'),ALIGN2,COLORred;
DRAWTEXT(BARSCOUNT(C)=SYSPARAM(3) and w<>3,REF(最高,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'最高↑'),ALIGN2,COLORYELLOW;

DRAWTEXT(BARPOS=SYSPARAM(2) and w=1,REF((最低+(最高-最低)*0.191)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'黃金 0.191↑'+NUMTOSTR(最低+(最高-最低)*0.191,2)),COLORWHITE;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=1,REF((最低+(最高-最低)*0.382)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'黃金 0.382↑'+NUMTOSTR(最低+(最高-最低)*0.382,2)),COLORWHITE;
DRAWTEXT(BARPOS=SYSPARAM(2) and w<>3,REF((最低+(最高-最低)*0.5)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM (2))),' 50%↑'+NUMTOSTR(最低+(最高-最低)*0.5,2)),COLORGREEN;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=1,REF((最低+(最高-最低)*0.618)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'黃金 0.618↑'+NUMTOSTR(最低+(最高-最低)*0.618,2)),COLORWHITE;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=1,REF((最低+(最高-最低)*0.809)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'黃金 0.809↑'+NUMTOSTR(最低+(最高-最低)*0.809,2)),COLORWHITE;

PARTLINE(C and w=2,最低+(最高-最低)*1/8),LINEDOT,Color0095BC;
PARTLINE(C and w=2,最低+(最高-最低)*1/4),LINEDOT,Color0095BC;
PARTLINE(C and w=2,最低+(最高-最低)*3/8),LINEDOT,Color0095BC;
PARTLINE(C and w=2,最低+(最高-最低)*5/8),LINEDOT,Color0095BC;
PARTLINE(C and w=2,最低+(最高-最低)*7/8),LINEDOT,Color0095BC;
PARTLINE(C and w=2,最低+(最高-最低)*3/4),LINEDOT,Color0095BC;

DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*1/8)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 1/8↑'+NUMTOSTR(最低+(最高-最低)*1/8,2)),Color0095BC;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*1/4)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 1/4↑'+NUMTOSTR(最低+(最高-最低)*1/4,2)),Color0095BC;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*3/8)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 3/8↑'+NUMTOSTR(最低+(最高-最低)*3/8,2)),Color0095BC;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*5/8)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 5/8↑'+NUMTOSTR(最低+(最高-最低)*5/8,2)),Color0095BC;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*7/8)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 7/8↑'+NUMTOSTR(最低+(最高-最低)*7/8,2)),Color0095BC;
DRAWTEXT(BARPOS=SYSPARAM(2) and w=2,REF((最低+(最高-最低)*3/4)*0.996,BARSLAST(BARSCOUNT(C)=SYSPARAM(2))),'江恩 3/4↑'+NUMTOSTR(最低+(最高-最低)*3/4,2)),Color0095BC;


G:=ZIG(3,5)>REF(ZIG(3,5),1) AND REF(ZIG(3,5),1)<=REF(ZIG(3,5),2) AND REF(ZIG(3,5),2)<=REF(ZIG(3,5),3);
X:=ZIG(3,5)=REF(ZIG(3,5),2) AND REF(ZIG(3,5),2)>=REF(ZIG(3,5),3);
DRAWTEXT(G,L*0.997,'▲'),ALIGN1,Colorff00ff;
DRAWTEXT(G,L,' ̄'),ALIGN1,Color00ff00;
DRAWTEXT(X,H*1.002,'▼'),ALIGN1,Color00ffff;
DRAWTEXT(X,H,' ̄'),ALIGN1,Color00ffff;
ED:=barslast(G);
EF:=barslast(X);
買入到賣出天數:ED,LINETHICK0,ColorFFFFFF;
賣出到買入天數:EF,LINETHICK0,ColorFFFFFF;

真真正正的黃金分割


input:n(30,1,1000);
HH:HHV(H,N);
LL:LLV(L,N);

<%

VH=FFL.VARDATA("HH")

VL=FFL.VARDATA("LL")

VN=FFL.VARDATA("N")

LAST=UBOUND(VH)

IF VN>LAST THEN VN=LAST+1

FOR I=LAST TO LAST-VN+1 STEP-1

VH(I)=VH(LAST)

VL(I)=VL(LAST)

NEXT

FFL.VARDATA("HH")=VH

FFL.VARDATA("LL")=VL

FFL.VARSTARTINDEX("HH")=LAST-VN+1

FFL.VARSTARTINDEX("LL")=LAST-VN+1

%>

HH,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,HH,'【黃金分割】↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),HH,HH,2),align2,coloryellow;
LL+((HH-LL)*0.809),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.809),' 0.809↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.809),LL+((HH-LL)*0.809),2),align2,coloryellow;
LL+((HH-LL)*0.764),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.764),' 0.764↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.764),LL+((HH-LL)*0.764),2),align2,coloryellow;
LL+((HH-LL)*0.618),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.618),' 0.618↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.618),LL+((HH-LL)*0.618),2),align2,coloryellow;
LL+((HH-LL)*0.500),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.500),' 0.500↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.500),LL+((HH-LL)*0.500),2),align2,coloryellow;
LL+((HH-LL)*0.382),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.382),' 0.382↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.382),LL+((HH-LL)*0.382),2),align2,coloryellow;
LL+((HH-LL)*0.333),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.333),' 0.333↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.333),LL+((HH-LL)*0.333),2),align2,coloryellow;
LL+((HH-LL)*0.236),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.236),' 0.236↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.236),LL+((HH-LL)*0.236),2),align2,coloryellow;
LL+((HH-LL)*0.191),pointdot,linethick1,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL+((HH-LL)*0.191),' 0.191↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL+((HH-LL)*0.191),LL+((HH-LL)*0.191),2),align2,coloryellow;
LL,coloryellow;
DRAWTEXT(c>0and ISLASTBAR=1,LL,'〖底部起點〗↑'),coloryellow;
DRAWNUMBER(BARSCOUNT(LL)=N-(N-1),LL,LL,2),align2,coloryellow;

黃金分割線──價格


//黃金分割線──價格
DRAWBKBMP(CLOSE>0,'MOON');
STICKLINE(C>=O,C,O,8,0),COLOR0000AA;
STICKLINE(C>=O,C,O,6,0),COLOR0000CC ;
STICKLINE(C>=O,C,O,4,0),COLOR0000DD ;
STICKLINE(C>=O,C,O,2,0),COLOR0000FF;
STICKLINE(C>=O,H,L,0,0),COLORRED;
STICKLINE(C>=O,C,O,8,0),COLOR0000AA;
STICKLINE(C>=O,C,O,6,0),COLOR0000CC ;
STICKLINE(C>=O,C,O,4,0),COLOR0000DD ;
STICKLINE(C>=O,C,O,2,0),COLOR0000FF;
STICKLINE(C>=O,H,L,0,0),COLORRED;
STICKLINE(C<=O,C,O,8,0),Color007B00;
STICKLINE(C<=O,C,O,6,0),Color009000;
STICKLINE(C<=O,C,O,4,0),Color00A800;
STICKLINE(C<=O,C,O,2,0),COLORGREEN;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
5日:MA(C,5);
20日:MA(C,20);
30日:MA(C,30);
60日:MA(C,60);
Var1:=SYSPARAM(3)-SYSPARAM(2)+1;
Var2:=SYSPARAM(3)-BARPOS;
Var3:=HHV(HIGH,Var1);
Var4:=LLV(LOW,VaR1);
Var5:=REFX(Var3,Var2); //主圖最高價
Var5:IF(SYSPARAM(3)<>SYSPARAM(1),SYSPARAM(6),Var5),COLORRED,LINETHICK3;
Var6:REFX(Var4,Var2),COLORWHITE,LINETHICK3;//主圖最低價
黃191:(Var5-Var6)*0.191+Var6,COLORYELLOW,POINTDOT,LINETHICK3;
黃382:(Var5-Var6)*0.382+Var6,COLORYELLOW,POINTDOT,LINETHICK3;
黃500:(Var5-Var6)*0.500+Var6,COLORYELLOW;
黃618:(Var5-Var6)*0.618+Var6,COLORYELLOW,POINTDOT,LINETHICK3;
黃809:(Var5-Var6)*0.809+Var6,COLORYELLOW,POINTDOT,LINETHICK3;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.0381+Var6,'最低價('+NUMTOSTR(Var6,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.191+Var6,'黃金0.191('+NUMTOSTR(黃191,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.382+Var6,'黃金0.382('+NUMTOSTR(黃382,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.500+Var6,'黃金分割中軸('+NUMTOSTR(黃500,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.618+Var6,'黃金0.618('+NUMTOSTR(黃618,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.809+Var6,'黃金0.809('+NUMTOSTR(黃809,2)+')'),COLORWHITE;
DRAWTEXT(SYSPARAM(2)=BARPOS,(Var5-Var6)*0.981+Var6,'最高價('+NUMTOSTR(Var5,2)+')'),COLORWHITE;

時間之窗[飛狐]主圖


DRAWGBK(DATE>900101,COLORRGB(95,95,95),COLORRGB(0,0,0),1);
Var1:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
Var2:=REF(Var1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var3:=REF(Var2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var4:=REF(Var3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var5:=REF(Var4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var6:=REF(Var5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var7:=REF(Var6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var8:=REF(Var7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var9:=REF(Var8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VarA:=REF(Var9,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VarB:=REF(VarA,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VarC:=REF(VarB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
漲:STICKLINE(Var1 OR Var2 OR Var3 OR Var4 OR Var5 OR Var6 OR Var7 OR Var8 OR Var9 OR VarA OR VarB OR VarC,CLOSE,REF(CLOSE,1),7,1),COLORRED;
VarD:=CLOSEVarE:=REF(VarD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VarF:=REF(VarE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var10:=REF(VarF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var11:=REF(Var10,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var12:=REF(Var11,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var13:=REF(Var12,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var14:=REF(Var13,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var15:=REF(Var14,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var16:=REF(Var15,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
Var17:=REF(Var16,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
Var18:=REF(Var17,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
跌:STICKLINE(VarD OR VarE OR VarF OR Var10 OR Var11 OR Var12 OR Var13 OR Var14 OR Var15 OR Var16 OR Var17 OR Var18,CLOSE,REF(CLOSE,1),7,1),COLORGREEN;
Var19:=REF(VarD OR VarE OR VarF OR Var10 OR Var11 OR Var12 OR Var13 OR Var14 OR Var15 OR Var16 OR Var17 OR Var18,1) AND Var1;
底:STICKLINE(Var19,REF(CLOSE,1),REF(CLOSE,2),7,0),COLORred;
Var1A:=REF(Var1 OR Var2 OR Var3 OR Var4 OR Var5 OR Var6 OR Var7 OR Var8 OR Var9 OR VarA OR VarB OR VarC,1) AND VarD;
頂:STICKLINE(Var1A,REF(CLOSE,1),REF(CLOSE,2),7,0),COLORBLUE;
a:=BARSCOUNT(c);
ah:=hhv(h,72);
al:=llv(l,72);
a0:=(ah-al)/21;
b1:=l-a0;
stickline((a+0)/13=FLOOR((a+0)/13),b1,b1-3*a0,1,0);
drawtext((a+0)/13=FLOOR((a+0)/13),b1-2.5*a0,'轉向時間窗'),COLORWHITE;
Z10:ZIG(3,10);
Z20:ZIG(3,20);
Z30:ZIG(3,30);
z40:zig(3,40);
z60:zig(3,60);
參照系:ref(z10,1),pointdot,coloryellow;
z10新低點:llv(z10,0),pointdot,color00ff00;
zig(3,80);
zig(3,100),color00ff00;

江恩時間窗


a:=BARSCOUNT(c);
ah:=hhv(h,72);
al:=llv(l,72);
a0:=(ah-al)/21;
b1:=l-a0;
stickline((a+0)/13=FLOOR((a+0)/13),b1,b1-3*a0,1,0);
drawtext((a+0)/13=FLOOR((a+0)/13),b1-2.5*a0,'轉向時間窗'),COLORWHITE;

INPUT:n(20,1,999),上角(50,0,500),下角(50,0,500);
{江恩角度線周期、角度可調}
N日:=n*10;
p1:=CLOSE-REF(CLOSE,1);p2:=SUM(ABS(p1),0); p3:=COUNT(CLOSE>0,0);
k1:=p2/p3/上角*10;k2:=p2/p3/下角*10;
DRAWSL(FILTER(BACKSET(ISLASTBAR,HHVBARS(HIGH,N日)+1),N日),HIGH,-0.5*K2,0,0),COLOR33FFCC,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,HHVBARS(HIGH,N日)+1),N日),HIGH, -K2,0,0),COLOR33FFCC,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,HHVBARS(HIGH,N日)+1),N日),HIGH,-2*K2,0,0),COLOR33FFCC;
DRAWSL(FILTER(BACKSET(ISLASTBAR,HHVBARS(HIGH,N日)+1),N日),HIGH,-4*K2,0,0),COLOR33FFCC,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,HHVBARS(HIGH,N日)+1),N日),HIGH,-8*K2,0,0),COLOR33FFCC,POINTDOT;

DRAWSL(FILTER(BACKSET(ISLASTBAR,LLVBARS(LOW,N日)+1),N日),LOW,0.5*K1,0,0),COLORffCCff,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,LLVBARS(LOW,N日)+1),N日),LOW, K1,0,0),COLORffCCff,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,LLVBARS(LOW,N日)+1),N日),LOW,2*K1,0,0),COLORffCCff;
DRAWSL(FILTER(BACKSET(ISLASTBAR,LLVBARS(LOW,N日)+1),N日),LOW,4*K1,0,0),COLORffCCff,POINTDOT;
DRAWSL(FILTER(BACKSET(ISLASTBAR,LLVBARS(LOW,N日)+1),N日),LOW,8*K1,0,0),COLORffCCff,POINTDOT; 畫線法__真正高手用的



KDTP
input:n(9),m(3);

RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M,1);
D:=BARSLAST(CROSS(K,80));
KH:=REF(H,D);
PARTLINE(C
預警:CROSS(C,KH);
DRAWTEXT(CROSS(C,KH),L*0.995,'預警'),COLORGREEN;

KD指标K值上穿80時(條件),取當日最高價,向右畫線,直到某日收盤價突破該價格(突破該線),畫線結束。1、作出主圖指标;2突破時條件選股(預警)。


XH-Zzig-分段信号

INPUT:N(20,1,100);
M:=(SYSPARAM(4)-SYSPARAM(5))/SYSPARAM(5)*100,LINETHICK0;{确定高低點差}
M1:=IF(DATATYPE>5,M/6,IF(DATATYPE>3,M/8,M/10)),LINETHICK0;{确定ZIG轉向參數}
M1:IF(M1>1,FLOOR(M1),CEILING(M1)),LINETHICK0;

z:=zig(4,M1); f:=z-ref(z,1);
d:=FILTER(refx(f>0 and ref(f,1)<0,1)or BARPOS=1,2);{低點}
wd:=barslast(d);{低點位置}
g:=FILTER(refx(f<0 and ref(f,1)>0,1)or BARPOS=1,2);{高點}
wg:=barslast(g);{高點位置}
xwd:=if(sum(wd=0,2)>1,1,wd)linethick0;//低點位置确認
xwg:=if(sum(wg=0,2)>1,1,wg)linethick0;//高點位置确認
fd:=hhv(h,xwd)/ref(L,xwd)-1>M1/100;//低點鞏固系數
fg:=1-LLv(L,xwg)/ref(h,xwg)>M1/100;//高點鞏固系數
dqz:=BACKSET(ISLASTBAR and wdgqz:=BACKSET(ISLASTBAR and wg{以下輸出信号}
dd:dqz*d or BARPOS=1;{輸出低點}
gg:gqz*g or BARPOS=1;{輸出高點}


畫圓弧
ng\nd均為16

drawtext(sysparam(2)=barpos,c,'闆塊:'+blkname),colorccffff,align4;
gg:="xh-z.gg";//(ng);
dd:="xh-z.dd";//(nd);
p:=SYSPARAM(1);
z:=gg*h+dd*L;
sd:=sum(dd,0);
sdd:=sd[p]-sd+1;
wx1:=barssince(sdd=3);
wx2:=barssince(sdd=2);
wx3:=barssince(sdd=1);
ry1:=hhv((wx1=0)*z,0);
ry2:=hhv((wx2=0)*z,0);
ry3:=hhv((wx3=0)*z,0);
rx2:=hhv((wx2=0)*wx1,wx1+1);
rx3:=hhv((wx3=0)*wx1,wx1+1);
x2:=rx2[p];
x3:=rx3[p];
y1:=ry1[p];
y2:=(ry2[p]-ry1[p]);
y3:=(ry3[p]-ry1[p]);
xy:=POW(x2,2)+POW(y2,2);
e:=(x3*xy/x2-(x3*x3+y3*y3))/(y3-x3*y2/x2);
d:=-(y2*e+xy)/x2;
y1:=POW((d*d+e*e)/4-POW((wx1+d/2),2),0.5);
y2:=-POW((d*d+e*e)/4-POW((wx1+d/2),2),0.5);
c1:=ref(L,wx1)-ref(y1,wx1);
yy:=(y1+c1);
c2:=ref(L,wx1)+ref(y1,wx1);
ye:=(y2+c2);
wyy:=abs(ref(yy,wx3)-ref(z,wx3))<0.01;
wye:=abs(ref(ye,wx3)-ref(z,wx3))<0.01;
if wyy[datacount] then
yy,LINETHICK2,COLORMAGENTA;
ELSE
ye,LINETHICK2,COLORMAGENTA;


sg:=sum(gg,0);
sgg:=sg[p]-sg+1;
wxg1:=barssince(sgg=3);
wxg2:=barssince(sgg=2);
wxg3:=barssince(sgg=1);
ryg1:=hhv((wxg1=0)*z,0);
ryg2:=hhv((wxg2=0)*z,0);
ryg3:=hhv((wxg3=0)*z,0);
rxg2:=hhv((wxg2=0)*wxg1,wxg1+1);
rxg3:=hhv((wxg3=0)*wxg1,wxg1+1);
xg2:=rxg2[p];
xg3:=rxg3[p];
yg1:=ryg1[p];
yg2:=(ryg2[p]-ryg1[p]);
yg3:=(ryg3[p]-ryg1[p]);
xyg:=POW(xg2,2)+POW(yg2,2);
eg:=(xg3*xyg/xg2-(xg3*xg3+yg3*yg3))/(yg3-xg3*yg2/xg2);
g:=-(yg2*eg+xyg)/xg2;
yg1:=POW((g*g+eg*eg)/4-POW((wxg1+g/2),2),0.5);
yg2:=-POW((g*g+eg*eg)/4-POW((wxg1+g/2),2),0.5);
cg1:=ref(z,wxg1)-ref(yg1,wxg1);
yyg:=(yg1+cg1);
cg2:=ref(z,wxg1)+ref(yg1,wxg1);
yeg:=(yg2+cg2);
wyyg:=abs(ref(yyg,wxg3)-ref(z,wxg3))<0.01;
wyeg:=abs(ref(yeg,wxg3)-ref(z,wxg3))<0.01;
if wyyg[datacount] then
yyg,LINETHICK2,COLORGREEN;
ELSE
yeg,LINETHICK2,COLORGREEN;
DRAWICON(dd,z,11);
DRAWICON(gg,z,10);




波段畫線

input:n(5,5,30);
fh:=high; fl:=low;
///以下找曆史最高點,hh1表示最高價,phh1表示最高點位置///
hh1:=fh[1]; phh1:=1;
for i=1 to datacount do //從第1條K線開始,循環執行下面3條複合語句,直到K線結束
if hh1hh1:=fh; phh1:=i; //用hh1單值變量記錄曆史最高價,phh1記錄位置
end;

///以下找phh1之後的最低點,ll表示最低價,pll最低點位置
if phh1ll:=fl[phh1+1];
for i=phh1 to datacount do
if ll>fl then begin
ll:=fl; pll:=i;
end;
end;

///以下用zig轉折模拟波段,通過參數n來調整波的分布///
///找曆史最高後的波峰最高點,hh2次高價,phh2位置///
tj:=peakbars(high,n,1)=0;
nstart:=max(lbound(tj),phh1+1);
if nstart<=datacount then begin
hh2:=0;
for i=nstart to datacount do
if tj then begin
if hh2hh2:=fh;
phh2:=i;
end;
end;
end;

//////以下畫線///////////
drawline(barpos=phh1,high,barpos=phh2,high,1),colormagenta;
drawline(barpos=phh1,high,barpos=pll,low,1),coloryellow;



波浪+趨勢

{以下語句為新結構波浪}
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1); B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1); D1:=FILTER(C1,3);{高點}
A2:=REF(LOW,3)=LLV(LOW,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低點}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低點出現在同一K線上時可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
L1:=(D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{過濾後低點}
L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{過濾後高點}
DRAWLINE(LD,L,HD,H,0),COLORWHITE,LINETHICK1,POINTDOT;
DRAWLINE(HD,H,LD,L,0),COLORWHITE,LINETHICK1,POINTDOT;
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),COLORWHITE,LINETHICK1,POINTDOT;
{以上語句為新結構波浪}

A3:=HB3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD; E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2); HH:=E3>REF(E3,1);{找出全部長期高點}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1)D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2); LL:=E4>REF(E4,1);{找出全部長期低點}
DRAWICON(HH,H,10),ALIGN2; DRAWICON(LL,L,12),ALIGN1;
H3:=HH OR ISLASTBAR OR BARSCOUNT(C)=1; {後面進行過濾,方法同前。隻是不用考慮高低點出現在同一K線}
X3:=REF(BARSLAST(H3),1)+1; F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1);I3:=BACKSET(G3,2);LZ:=I3>REF(I3,1),LINETHICK0; {長期低點,也可供引用}
L4:=LZ OR ISLASTBAR OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1; F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4>REF(F4,1);I4:=BACKSET(G4,2);HZ:=I4>REF(I4,1),LINETHICK0;{長期高點,也可供引用}
DRAWLINE(HZ,H,LZ,L,0),COLORGREEN,LINETHICK1;
DRAWLINE(LZ,L,HZ,H,0),COLORGREEN,LINETHICK1;{長期連線}
K1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HZ),BARSLAST(LZ))+1); K2:=K1>REF(K1,1);
DRAWLINE(K2,IF(HZ,H,L),ISLASTBAR,C,0),COLORGREEN,LINETHICK1; {最後的長期連線,連在收盤價上}

{以下是兩條趨勢線原碼}
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK1;
UU2:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK1;

前一低:REF(L,BARSLAST(VV)),COLOR99FF66,POINTDOT,LINETHICK3;
前二低:REF(L,BARSLAST(XX)),COLORFF66FF,POINTDOT,LINETHICK3;
前一高:REF(H,BARSLAST(VV2)),COLOR99FF66,POINTDOT,LINETHICK3;
前二高:REF(H,BARSLAST(XX2)),COLORFF66FF,POINTDOT,LINETHICK3;
短高:=REF(H,BARSLAST(VV2)),LINETHICK0;
短低:=REF(L,BARSLAST(VV)),LINETHICK0;
短比: (C-短低)/(短高-短低),LINETHICK0;

{以下語句是大盤趨勢疊加}
常數:=REF(INDEXC,BARSLAST(VV))/REF(C,BARSLAST(VV));
疊1:INDEXC/常數,COLORGRAY,LINETHICK0;
PARTLINE(1,疊1),COLORGRAY;
常數2:=REF(INDEXC,BARSLAST(XX))/REF(C,BARSLAST(XX));
疊2:INDEXC/常數2,COLORGRAY,LINETHICK0;
PARTLINE(1,疊2),COLORGRAY;

DRAWNUMBER(HD,1.02*H,DATEDIFF(REF(DATE,BARSLAST(LD)),DATE),0),COLORCYAN;
DRAWNUMBER(LD,0.98*L,DATEDIFF(REF(DATE,BARSLAST(HD)),DATE),0),COLORCYAN;

DRAWNUMBER(HD,H*(1+0.002),H,2),COLORBLUE,ALIGN0;
DRAWNUMBER(LD,L*(1.001-0.002),L,2),COLORBLUE,ALIGN0; JGB

n=319999

A1:=REF(H,N)=HHV(H,2*N+1); B1:=FILTER(A1,N); C1:=BACKSET(B1,N+1); D1:=FILTER(C1,N);{高點}
A2:=REF(L,N)=LLV(L,2*N+1); B2:=FILTER(A2,N); C2:=BACKSET(B2,N+1); D2:=FILTER(C2,N);{低點}
E1:=(REF(LLV(L,2*N),1)+REF(HHV(H,2*N),1))/2; E2:=(H+L)/2;{高低點出現在同一K線上時可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(C)=1;
L1:=(D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:I1>REF(I1,1),LINETHICK0;{過濾後低點}
L2:=LD OR ISLASTBAR OR BARSCOUNT(C)=1;
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:I2>REF(I2,1),LINETHICK0;{過濾後高點}
DRAWLINE(HD,H,LD,L,0),COLORYELLOW,LINETHICK1;DRAWLINE(LD,L,HD,H,0),COLORYELLOW,LINETHICK1;
{高低點之間作連線。Param#1調峰點參數N(3,2,999);}
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),COLORYELLOW;
{作最後的連線。這根線有時會不盡人意。}

JGE

n=3 2 9999 m=101

HD:="jgb.HD"(N);LD:="jgb.LD"(N);
DRAWLINE(LD,L,HD,H,0),COLORFF9900;DRAWLINE(HD,H,LD,L,0),COLORFF9900;
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD),BARSLAST(LD))+1); J2:=J1>REF(J1,1);
DRAWLINE(J2,IF(HD,H,L),ISLASTBAR,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),COLORFF9900;
R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1); S1:=R1>REF(R1,1); {前一高}
T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1); U1:=T1>REF(T1,1); {前一低}
R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2); S2:=R2>REF(R2,1); {前二高}
T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2); U2:=T2>REF(T2,1); {前二低}
短高:REF(H,BARSLAST(S1)),LINETHICK1; 短低:REF(L,BARSLAST(U1)),LINETHICK1;
短比:(C-短低)/(短高-短低),LINETHICK0;
DRAWLINE(S2,H,S1,H,1); DRAWLINE(U2,L,U1,L,1);
V1:=LINEVALUE(S2,H,S1,H,0,1); V2:=LINEVALUE(U2,L,U1,L,0,1);
DRAWICON(CROSS(C,V1),V1,4); DRAWICON(CROSS(V2,C),V2,5);
DRAWICON(CROSS(C,短高),短高,4);DRAWICON(CROSS(短低,C),短低,5);

A3:=HB3:=REF(H,REF(BARSLAST(HD),1)+1)>REF(H,REF(BARSLAST(HD),1)+2+REF(BARSLAST(HD),REF(BARSLAST(HD),1)+2));
D3:=A3 AND B3 AND HD; E3:=BACKSET(D3,REF(BARSLAST(HD),1)+2); HZ:=E3>REF(E3,1);{找出全部長期高點}
A4:=L>REF(L,REF(BARSLAST(LD),1)+1);
B4:=REF(L,REF(BARSLAST(LD),1)+1)D4:=A4 AND B4 AND LD; E4:=BACKSET(D4,REF(BARSLAST(LD),1)+2); LZ:=E4>REF(E4,1);{找出全部長期低點}
R3:=BACKSET(ISLASTBAR,BARSLAST(HZ)+1); S3:=R3>REF(R3,1); {前一長高}
T3:=BACKSET(ISLASTBAR,BARSLAST(LZ)+1); U3:=T3>REF(T3,1); {前一長低}
長高:REF(H,BARSLAST(S3)),LINETHICK2; 長低:REF(L,BARSLAST(U3)),LINETHICK2;
長比:(C-長低)/(長高-長低),LINETHICK0;
PARTLINE(1,長低+(長高-長低)/2),COLORRED; PARTLINE(1,長低+(長高-長低)/3),POINTDOT,COLORDDDDDD;
PARTLINE(1,長低+2*(長高-長低)/3),POINTDOT,COLORDDDDDD;

{下面做大盤疊加,從可見的第一根K線開始。}
A:=BARSCOUNT(C)=SYSPARAM(2); B:=BARSLAST(A); CC:=REF(INDEXC,B)/REF(C,B);
DD1:=INDEXO/CC; DD2:=INDEXH/CC; DD3:=INDEXL/CC; DD4:=INDEXC/CC;
STICKLINE(M AND DD4>=REF(DD4,1),DD3,DD1,0.1,0),COLORFF66FF;
STICKLINE(M AND DD4>=REF(DD4,1),DD4,DD2,0.1,0),COLORFF66FF;
STICKLINE(M AND DD4>=REF(DD4,1),DD1,DD4,7,1),COLORFF66FF;
STICKLINE(M AND DD4STICKLINE(M AND DD4背離系數:100*(C-DD4)/DD4,LINETHICK0;

你可能想看:

有話要說...

取消
掃碼支持 支付碼