载入中...
在线检测未来函数
载入中...

分割套装公式TROUGHBARS(4,10,2)中4

来源:Internet,编辑:股旁网,2012-04-09

编写要求:

股旁网解答:

 网友求助:

{主图-【分割套装】--作者:AHFYXL 保密:)}
{◎¥〖〗【】↙↖← → ↑ ↓●○▼▽▲△◆◇■□★☆¤⊙※^_^ ^o^ ^O^ @_@ ^&^♂♀ ヲ ︼ ◎Ψ①②③④⑤⑥}

INPUT:显示(0,0,2);
DRAWGBK((DATE > 0),COLORRGB(0,33,0),COLORRGB(0,33,0),1);

{立体K线}
STICKLINE(C<O||C=O&&C<=REF(C,1),L,H,0,0),COLORCYAN; STICKLINE(C<O||C=O&&C<=REF(C,1),O,C,8,0),COLORCYAN;
STICKLINE(O>=C,C,O,7,0 ),COLOR009900; STICKLINE(O>=C,C,O,6,0 ),COLOR00AA00; STICKLINE(O>=C,C,O,5,0 ),COLOR00BB00;
STICKLINE(O>=C,C,O,4,0 ),COLOR00CC00; STICKLINE(O>=C,C,O,3,0 ),COLOR00DD00; STICKLINE(O>=C,C,O,2,0 ),COLOR00EE00;
STICKLINE(C>O||C=O&&C>REF(C,1),L,H,0,0),COLORRED; STICKLINE(C>OPEN||C=O&&C>REF(C,1),O,C,8,0),COLORRED;
STICKLINE(C>O,C,O,7,0),COLORFF22FF; STICKLINE(C>O,C,O,6,0),COLORFF44FF; STICKLINE(C>O,C,O,5,0),COLORFF66FF;
STICKLINE(C>O,C,O,4,0),COLORFF88FF; STICKLINE(C>O,C,O,3,0),COLORFF99FF; STICKLINE(C>O,C,O,2,0),COLORFFAAFF;

{阻撑位}
W_1:=cost(2); W_2:=cost(20); W_3:=(W_1+W_2)/2; W_4:=cost(40); W_5:=(W_2+W_4)/2; W_6:=cost(60);
W_7:=(W_4+W_6)/2; W_8:=cost(85); W_9:=(W_6+W_8)/2; W_10:=cost(99); W_11:=(W_8+W_10)/2; W_12:=W_10-W_8;
W_13:=W_8-W_6; W_14:=W_6-W_4; W_15:=W_4-W_2; W_16:=W_2-W_1;
W_17:=MIN(MIN(MIN(MIN(W_12,W_13),W_14),W_15),W_16);
W_18:=IF(MIN(MIN(W_12,W_13),W_14),MIN(MIN(W_12,W_13),W_14),MIN(W_15,W_16));
W_19:=IF(W_12=W_17,W_13,IF(W_13=W_17,W_12,IF(W_14=W_17,W_15,if(W_15=W_17,W_16,W_15)))); W_20:=MIN(W_19,W_18);
阻撑一:if(W_12=W_20,W_11,if(W_13=W_20,W_9,if(W_14=W_20,W_7,if((W_15=W_20),W_5,if(W_16=W_20,W_3,0))))),LINETHICK,PRECISION2,COLORMAGENTA;
阻撑二:if(W_12=W_17,W_11,if(W_13=W_17,W_9,if(W_14=W_17,W_7,if(W_15=W_17,W_5,if(W_16=W_17,W_3,0))))),LINETHICK,PRECISION2,COLORYELLOW;
PARTLINE(显示=0,阻撑一),COLORMAGENTA;
PARTLINE(显示=0,阻撑二),COLORYELLOW;
{======= 点石成金 =======}
P:=SYSPARAM(1); P1:=SYSPARAM(2); P2:=SYSPARAM(3); P3:=SYSPARAM(4); P4:=SYSPARAM(5);
Cj_Z:=barslast(P=barpos)+1;
Cj_H:=IF(c>100,SUM(h*V,Cj_z)/SUM(V,Cj_z),sum(AMOUNT,Cj_z)/sum(v,Cj_z)/100*SUM(H,Cj_z)/SUM(C,Cj_z));//点石成金H
Cj_L:=IF(c>100,SUM(l*V,Cj_z)/SUM(V,Cj_z),sum(AMOUNT,Cj_z)/sum(v,Cj_z)/100*SUM(L,Cj_z)/SUM(C,Cj_z));//点石成金L
点石成金:=if(ref(h,Cj_z-1)>ref(h,Cj_z) and ref(h,Cj_z-1)>ref(h,Cj_z-2),Cj_h,Cj_l);//点石成金
偏离:=(C-点石成金)/点石成金*100;
PARTLINE(显示=0,点石成金),COLORCYAN;//点石成金线
bc:=barslast(P=barpos)+1;
DRAWTEXT(BARPOS=P2&&显示=0,点石成金[DATACOUNT],' 点石成金 \n '+NUMTOSTR(点石成金[DATACOUNT],2)+' 元'),PXUP26,Color009A00;
DRAWTEXT(ISLASTBAR&&显示=0,点石成金,'偏离 \n'+NUMTOSTR(偏离[DATACOUNT],1)+'%'),SHIFT1,PXDN30,Color00DBD9;
{======= 黄金分割线+江恩八分线 =======}
hh:=hhv(H,P2-P1+1); ll:=llv(L,P2-P1+1); 最高:=hh[P2];最低:=ll[P2];
{}
PARTLINE(显示<>2,最高),COLORYELLOW;
PARTLINE(显示<>2,最低),COLORRED;
PARTLINE(显示=0,最低+(最高-最低)*0.191),LINEDOT,COLORWHITE;
PARTLINE(显示=0,最低+(最高-最低)*0.382),LINEDOT,COLORWHITE;
PARTLINE(显示<>2,最低+(最高-最低)*0.5),COLORGREEN;
PARTLINE(显示=0,最低+(最高-最低)*0.618),LINEDOT,COLORWHITE;
PARTLINE(显示=0,最低+(最高-最低)*0.809),LINEDOT,COLORWHITE;
DRAWTEXT(BARSCOUNT(C)=P2&&显示<>2,REF(最低,BARSLAST(BARSCOUNT(C)=P1)),'最低↓'),ALIGN2,COLORred;
DRAWTEXT(BARSCOUNT(C)=P2&&显示<>2,REF(最高,BARSLAST(BARSCOUNT(C)=P1)),'最高↑'),ALIGN2,COLORYELLOW;
DRAWTEXT(BARPOS=P1&&显示=0,REF((最低+(最高-最低)*0.191)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'黄金 0.191↑'+NUMTOSTR(最低+(最高-最低)*0.191,2)),COLORWHITE;
DRAWTEXT(BARPOS=P1&&显示=0,REF((最低+(最高-最低)*0.382)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'黄金 0.382↑'+NUMTOSTR(最低+(最高-最低)*0.382,2)),COLORWHITE;
DRAWTEXT(BARPOS=P1&&显示<>2,REF((最低+(最高-最低)*0.5)*0.996,BARSLAST(BARSCOUNT(C)=P1)),' 50% ↑'+NUMTOSTR(最低+(最高-最低)*0.5,2)),COLORGREEN;
DRAWTEXT(BARPOS=P1&&显示=0,REF((最低+(最高-最低)*0.618)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'黄金 0.618↑'+NUMTOSTR(最低+(最高-最低)*0.618,2)),COLORWHITE;
DRAWTEXT(BARPOS=P1&&显示=0,REF((最低+(最高-最低)*0.809)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'黄金 0.809↑'+NUMTOSTR(最低+(最高-最低)*0.809,2)),COLORWHITE;
{}
PARTLINE(显示=1,最低+(最高-最低)*1/8),LINEDOT,Color0095BC;
PARTLINE(显示=1,最低+(最高-最低)*1/4),LINEDOT,Color0095BC;
PARTLINE(显示=1,最低+(最高-最低)*3/8),LINEDOT,Color0095BC;
PARTLINE(显示=1,最低+(最高-最低)*5/8),LINEDOT,Color0095BC;
PARTLINE(显示=1,最低+(最高-最低)*7/8),LINEDOT,Color0095BC;
PARTLINE(显示=1,最低+(最高-最低)*3/4),LINEDOT,Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*1/8)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 1/8↑'+NUMTOSTR(最低+(最高-最低)*1/8,2)),Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*1/4)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 1/4↑'+NUMTOSTR(最低+(最高-最低)*1/4,2)),Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*3/8)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 3/8↑'+NUMTOSTR(最低+(最高-最低)*3/8,2)),Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*5/8)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 5/8↑'+NUMTOSTR(最低+(最高-最低)*5/8,2)),Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*7/8)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 7/8↑'+NUMTOSTR(最低+(最高-最低)*7/8,2)),Color0095BC;
DRAWTEXT(BARPOS=P1&&显示=1,REF((最低+(最高-最低)*3/4)*0.996,BARSLAST(BARSCOUNT(C)=P1)),'江恩 3/4↑'+NUMTOSTR(最低+(最高-最低)*3/4,2)),Color0095BC;

{======= 江恩时间循环 =======}
x1:=TROUGHBARS(4,10,2); x2:=TROUGHBARS(4,10,1); x3:=PEAKBARS(4,10,2); x4:=PEAKBARS(4,10,1);
y1:=x2[P]; y2:=x4[P]; y3:=P-y1; y4:=P-y2; y5:=x2[P]; y6:=x4[P];
y7:=P-y5; y8:=P-y6; y9:=x1[P]; y10:=x3[P]; y11:=P-y9; y12:=P-y10; PH:=H; PL:=L;
K一浪a:=IF(y3>y4,y11,y12); K二浪b:=IF(y3>y4,y8,y7); K三浪c:=IF(y3>y4,y3,y4);
P一浪a:=IF(y3>y4,PL[y11],PH[y12]); P二浪b:=IF(y3>y4,PH[y8],PL[y7]); P三浪c:=IF(y3>y4,PL[y3],PH[y4]);
if 0>-0.5 then
begin
一浪长:=P二浪b-P一浪a;; y1:=一浪长; P1:=P三浪c+y1;
end;
b:=barpos=K三浪c;//起点
Wb:=barslast(P=barpos)+1;
S_j:=BARSCOUNT(C)*3.142/60;
S_jA:=if(COS(S_j*4)>ref(COS(S_j*4),1),1,0);
S_jB:=if(COS(S_j*2)>ref(COS(S_j*2),1),2,0);
S_jC:=if(SIN(S_j*8)>ref(SIN(S_j*8),1),1.6,0);
S_jD:=if(COS(S_j*8)>ref(COS(S_j*8),1),1.2,0);
y1:=COUNT(S_jA,BARSLAST(S_jA=0))=1;
y2:=COUNT(S_jB,BARSLAST(S_jB=0))=1;
y3:=COUNT(S_jC,BARSLAST(S_jC=0))=1;
y4:=COUNT(S_jD,BARSLAST(S_jD=0))=1;
VERTLINE(barpos=K三浪c&&显示=1),COLORRED;
drawline(barpos=K一浪a&&显示=1,p一浪a,barpos=K二浪b,p二浪b,0),COLORGRAY;
drawline(barpos=K二浪b&&显示=1,p二浪b,barpos=K三浪c,p三浪c,0),COLORGRAY;
VERTLINE(if(Wb&&显示=1,y1,0)),LINEDOT,COLORGRAY;
VERTLINE(if(Wb&&显示=1,y2,0)),LINEDOT,COLORGRAY;
VERTLINE(if(Wb&&显示=1,y3,0)),LINEDOT,COLORGRAY;
VERTLINE(if(Wb&&显示=1,y4,0)),LINEDOT,COLORGRAY;
{======= 江恩角度分割 =======}
N:=IF(P=DATACOUNT,IF(DATACOUNT>300,300,DATACOUNT),DATACOUNT-P+1);
HH:=HHV(H,N); LL:=LLV(L,N); VN:=N;
FOR i=DATACOUNT DOWNTO DATACOUNT-VN+1 DO BEGIN
HH:=HH[DATACOUNT];
LL:=LL[DATACOUNT];
END;
高:=SETLBOUND(HH,DATACOUNT-VN+1); 低:=SETLBOUND(LL,DATACOUNT-VN+1);
KKH:=BARSSINCE(H=HH); KKL:=BARSSINCE(L=LL);
上角:=FILTER(COUNT(KKH+1,BARSLAST(KKH=0))=1,1);
下角:=FILTER(COUNT(KKL+1,BARSLAST(KKL=0))=1,1);
K:=((SYSPARAM(4)-SYSPARAM(5))/(SYSPARAM(3)-SYSPARAM(2)));
{}
DRAWSL(上角&&显示=2,H,(0 - ((15 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((30 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((45 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((60 * K) / 60)),0,0),colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((85 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((120 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((165 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((240 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((360 * K) / 60)),0,0),POINTDOT,colorFFFF00;
DRAWSL(上角&&显示=2,H,(0 - ((600 * K) / 60)),0,0),POINTDOT,colorFFFF00;
{}
DRAWSL(下角&&显示=2,L,((10 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((30 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((60 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((90 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((120 * K) / 60),0,0),colorFF00FF;
DRAWSL(下角&&显示=2,L,((180 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((300 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((540 * K) / 60),0,0),POINTDOT,colorFF00FF;
DRAWSL(下角&&显示=2,L,((1020 * K) / 60),0,0),POINTDOT,colorFF00FF;

{======= 费波纳茨时间周期 =======}
VERTLINE(BARPOS=P&&显示=2),shift3,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift5,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift8,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift13,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift21,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift34,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift55,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift89,LINEDOT,COLORGRAY;
VERTLINE(BARPOS=P&&显示=2),shift144,LINEDOT,COLORGRAY;
DRAWTEXT(BARPOS=P&&显示=2,P4,'天数'),align2,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'3'),shift3,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'5'),shift5,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'8'),shift8,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'13'),shift13,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'21'),shift21,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'34'),shift34,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'55'),shift55,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'89'),shift89,Color0095BC;
DRAWTEXT(BARPOS=P&&显示=2,P4,'144'),shift144,Color0095BC;

//
请教老师分割套装公式TROUGHBARS(4,10,2)中4是什么意思?
{======= 江恩时间循环 =======}
x1:=TROUGHBARS(4,10,2); x2:=TROUGHBARS(4,10,1); x3:=PEAKBARS(4,10,2); x4:=PEAKBARS(4,10,1);
 

 
解答如下:
TROUGHBARS(X,N,M)表示之字转向ZIG(X,N)的前M个波谷到当前的周期数,M必须大于等于1

X为序列或常数,为常数时表示0:开盘价,1:最高价,2:最低价,3:收盘价,4:高点用最高价、低点用最低价

 

相关文章