「翔博精选指标」做盘分析(通达信公式 主图 源码 测试图)通达信公式
2020-06-14 来源:原创 编辑:翔博软件
{做盘分析 主图源码} 天顶线:CONST(COST(99.999)),LINETHICK9; 中轴线:CONST(COST(50)),LINETHICK9; 地底线:CONST(COST(0.001)),LINETHICK9; 比例10:CONST(COST(10)),LINETHICK
{做盘分析 主图源码}
天顶线:CONST(COST(99.999)),LINETHICK9;
中轴线:CONST(COST(50)),LINETHICK9;
地底线:CONST(COST(0.001)),LINETHICK9;
比例10:CONST(COST(10)),LINETHICK3;
比例20:CONST(COST(20)),LINETHICK3;
比例30:CONST(COST(30)),LINETHICK3;
比例40:CONST(COST(40)),LINETHICK3;
比例50:CONST(COST(50)),LINETHICK3;
比例60:CONST(COST(60)),LINETHICK3;
比例70:CONST(COST(70)),LINETHICK3;
比例80:CONST(COST(80)),LINETHICK3;
比例90:CONST(COST(90)),LINETHICK3;
N:=13;M:=1;P:=3;P2:=5;P3:=36;P4:=13;P5:=65;
QQ1:=REF(HIGH,3)=HHV(HIGH,2*3+1);
PP1:=FILTER(QQ1,3);
C1:=BACKSET(PP1,3+1);
D1:=FILTER(C1,3);{高点}
QQ2:=REF(LOW,3)=LLV(LOW,2*3+1);
PP2:=FILTER(QQ2,3);
C2:=BACKSET(PP2,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)));
H2:=D1 AND NOT((D2 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),COLORGRAY,LINETHICK3;
DRAWLINE(HD,H,LD,L,0),COLORGRAY,LINETHICK3;
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),COLORGRAY,LINETHICK2;
{以下是两条趋势线原码}
UU:=BACKSET(ISLASTBAR ,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
UU2:=BACKSET(ISLASTBAR ,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
前一低:REF(L,BARSLAST(VV)),COLORRED,LINETHICK6;
前二低:REF(L,BARSLAST(XX)),COLORLIRED,LINETHICK6;
前一高:REF(H,BARSLAST(VV2)),COLORBROWN,LINETHICK6;
前二高:REF(H,BARSLAST(XX2)),COLORLIGRAY,LINETHICK6;
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA,LINETHICK2;
DRAWLINE(XX2,H,VV2,H,1),COLORMAGENTA,LINETHICK2;
{通达信波浪尺主图指标}
高点:=10;
低点:=10;
高点选择:=1;
低点选择:=1;
波浪尺1:=0;
波浪尺2:=1;
PURC:=CONST(FINDHIGH(H,0,高点*10,高点选择));
PLZ:=CONST(BARSLAST(PURC=H))+1;
顶X:=CONST(IF(PLZ=1,H,REF(H,PLZ-1)));
QQT:=CONST(FINDLOW(L,0,低点*10,低点选择));
PLL:=CONST(BARSLAST(QQT=L))+1;
低X:=CONST(IF(PLL=1,L,REF(L,PLL-1)));
DRAWKLINE(H,O,L,C);
顶点:顶X,COLORRED;
底点:低X,COLORRED;
波动速率:=100*((顶X-低X)/(IF(PLL>PLZ,低X,顶X)))/(PLL-PLZ),NODRAW,COLORMAGENTA;
波动幅度:=((顶X-低X)/(IF(PLL>PLZ,低X,顶X)))*100;
波动价位:=(顶X-低X)*(IF(PLL>PLZ,1,-1));
BPURC:=CONST(FINDHIGH(H,0,(IF(波浪尺1>0,波浪尺1,IF(PLZ<PLL,高点,低点)))*5,波浪尺2));
BPLZ:=CONST(BARSLAST(BPURC=H))+1;
BQQT:=CONST(FINDLOW(L,0,(IF(波浪尺1>0,波浪尺1,IF(PLZ<PLL,高点,低点)))*5,波浪尺2));
BPLL:=CONST(BARSLAST(BQQT=L))+1;
BLC1:=CONST(FINDHIGH(H,0,(IF(波浪尺1>0,波浪尺1,IF(PLZ<PLL,高点,低点)))*5,波浪尺2));
BLC2:=CONST(BARSLAST(BPURC=H))+1;
BLC顶X:=CONST(IF(BPLZ=1,H,REF(H,BPLZ-1)));
BLC3:=CONST(FINDLOW(L,0,(IF(波浪尺1>0,波浪尺1,IF(PLZ<PLL,高点,低点)))*5,波浪尺2));
B6C4:=CONST(BARSLAST(BQQT=L))+1;
BLC低X:=CONST(IF(BPLL=1,L,REF(L,BPLL-1)));
BASE:=IF(波动速率<0,BLC顶X,BLC低X)COLORRED;
BLCX:=IF(波动速率<0,-1,1);
BLCZ:=(顶点-底点)*(IF(PLL>PLZ,1,-1));
B618:=BASE+(BLCZ*0.618)COLORRED,DOTLINE;
B382:=BASE+(BLCZ*0.382)COLORRED,DOTLINE;
B05:=BASE+(BLCZ*0.5)COLORRED,DOTLINE;
B809:=BASE+(BLCZ*0.809)COLORRED,DOTLINE;
B191:=BASE+(BLCZ*0.191)COLORRED,DOTLINE;
B100:=BASE+(BLCZ*1)COLORRED;
B200:=BASE+(BLCZ*2)COLORRED;
B11:=BASE+(BLCZ*1.191)COLORRED;
B12:=BASE+(BLCZ*1.382)COLORRED;
B13:=BASE+(BLCZ*1.5)COLORRED;
B14:=BASE+(BLCZ*1.618)COLORRED;
B15:=BASE+(BLCZ*1.809)COLORRED;
BZ1:=BASE+(BLCZ*0.236)COLORRED;
BZ2:=BASE+(BLCZ*1.236)COLORRED;
BZ3:=BASE+(BLCZ*2.236)COLORRED;
B11B:=BASE+(BLCZ*2.191)COLORRED;
B12B:=BASE+(BLCZ*2.382)COLORRED;
B13B:=BASE+(BLCZ*2.5)COLORRED;
B14B:=BASE+(BLCZ*2.618)COLORRED;
B15B:=BASE+(BLCZ*2.809)COLORRED;
B300:=BASE+(BLCZ*3)COLORRED;
XZDD:=IF(PLL>PLZ,BPLL,BPLZ);
STICKLINE(CURRBARSCOUNT=XZDD ,BASE,B300,0,0),COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B05,'---------0.500')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,BASE,'---------BASE')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B618,'---------0.618')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B809,'---------0.809')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B382,'---------0.382')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B191,'---------0.191')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B100,'---------1.000')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B11,'---------1.191')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B12,'---------1.382')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B13,'---------1.500')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B14,'---------1.618')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B15,'---------1.809')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B200,'---------2.000')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B11B,'---------2.191')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B12B,'---------2.382')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B13B,'---------2.500')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B14B,'---------2.618')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B15B,'---------2.809')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,B300,'---------3.000')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,BZ1,'---------0.236')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,BZ2,'---------1.236')COLORRED;
DRAWTEXT(CURRBARSCOUNT=XZDD,BZ3,'---------2.236')COLORRED;
QADQ:=IF(PLL>PLZ,PLL,PLZ);
QADH:=IF(PLL>PLZ,PLZ,PLL);
QHL1:=IF(PLL>PLZ,L,H);
QHL2:=IF(PLL>PLZ,H,L);
DRAWLINE(CURRBARSCOUNT=QADQ,QHL1,CURRBARSCOUNT=QADH,QHL2,0)COLORRED;
DRAWLINE(CURRBARSCOUNT=QADH,QHL2,CURRBARSCOUNT=XZDD,QHL1,0)COLORRED;
HB:=COST(99.999);
LB:=COST(0.001);
B3:=(HB-LB)/50;
B31:=HB-B3;
B32:=HB-2*B3;
B33:=HB-3*B3;
B34:=HB-4*B3;
B35:=HB-5*B3;
B36:=HB-6*B3;
B37:=HB-7*B3;
B38:=HB-8*B3;
B39:=HB-9*B3;
B310:=HB-10*B3;
B311:=HB-11*B3;
B312:=HB-12*B3;
B313:=HB-13*B3;
B314:=HB-14*B3;
B315:=HB-15*B3;
B316:=HB-16*B3;
B317:=HB-17*B3;
B318:=HB-18*B3;
B319:=HB-19*B3;
B320:=HB-20*B3;
B321:=HB-21*B3;
B322:=HB-22*B3;
B323:=HB-23*B3;
B324:=HB-24*B3;
B325:=HB-25*B3;
B326:=HB-26*B3;
B327:=HB-27*B3;
B328:=HB-28*B3;
B329:=HB-29*B3;
B330:=HB-30*B3;
B331:=HB-31*B3;
B332:=HB-32*B3;
B333:=HB-33*B3;
B334:=HB-34*B3;
B335:=HB-35*B3;
B336:=HB-36*B3;
B337:=HB-37*B3;
B338:=HB-38*B3;
B339:=HB-39*B3;
B340:=HB-40*B3;
B341:=HB-41*B3;
B342:=HB-42*B3;
B343:=HB-43*B3;
B344:=HB-44*B3;
B345:=HB-45*B3;
B346:=HB-46*B3;
B347:=HB-47*B3;
B348:=HB-48*B3;
B349:=HB-49*B3;
A1:=WINNER(HB)*100-WINNER(B31)*100;
A2:=WINNER(B31)*100-WINNER(B32)*100;
A3:=WINNER(B32)*100-WINNER(B33)*100;
A4:=WINNER(B33)*100-WINNER(B34)*100;
A5:=WINNER(B34)*100-WINNER(B35)*100;
A6:=WINNER(B35)*100-WINNER(B36)*100;
A7:=WINNER(B36)*100-WINNER(B37)*100;
A8:=WINNER(B37)*100-WINNER(B38)*100;
A9:=WINNER(B38)*100-WINNER(B39)*100;
A10:=WINNER(B39)*100-WINNER(B310)*100;
A11:=WINNER(B310)*100-WINNER(B311)*100;
A12:=WINNER(B311)*100-WINNER(B312)*100;
A13:=WINNER(B312)*100-WINNER(B313)*100;
A14:=WINNER(B313)*100-WINNER(B314)*100;
A15:=WINNER(B314)*100-WINNER(B315)*100;
A16:=WINNER(B315)*100-WINNER(B316)*100;
A17:=WINNER(B316)*100-WINNER(B317)*100;
A18:=WINNER(B317)*100-WINNER(B318)*100;
A19:=WINNER(B318)*100-WINNER(B319)*100;
A20:=WINNER(B319)*100-WINNER(B320)*100;
A21:=WINNER(B320)*100-WINNER(B321)*100;
A22:=WINNER(B321)*100-WINNER(B322)*100;
A23:=WINNER(B322)*100-WINNER(B323)*100;
A24:=WINNER(B323)*100-WINNER(B324)*100;
A25:=WINNER(B324)*100-WINNER(B325)*100;
A26:=WINNER(B325)*100-WINNER(B326)*100;
A27:=WINNER(B326)*100-WINNER(B327)*100;
A28:=WINNER(B327)*100-WINNER(B328)*100;
A29:=WINNER(B328)*100-WINNER(B329)*100;
A30:=WINNER(B329)*100-WINNER(B330)*100;
A31:=WINNER(B330)*100-WINNER(B331)*100;
A32:=WINNER(B331)*100-WINNER(B332)*100;
A33:=WINNER(B332)*100-WINNER(B333)*100;
A34:=WINNER(B333)*100-WINNER(B334)*100;
A35:=WINNER(B334)*100-WINNER(B335)*100;
A36:=WINNER(B335)*100-WINNER(B336)*100;
A37:=WINNER(B336)*100-WINNER(B337)*100;
A38:=WINNER(B337)*100-WINNER(B338)*100;
A39:=WINNER(B338)*100-WINNER(B339)*100;
A40:=WINNER(B339)*100-WINNER(B340)*100;
A41:=WINNER(B340)*100-WINNER(B341)*100;
A42:=WINNER(B341)*100-WINNER(B342)*100;
A43:=WINNER(B342)*100-WINNER(B343)*100;
A44:=WINNER(B343)*100-WINNER(B344)*100;
A45:=WINNER(B344)*100-WINNER(B345)*100;
A46:=WINNER(B345)*100-WINNER(B346)*100;
A47:=WINNER(B346)*100-WINNER(B347)*100;
A48:=WINNER(B347)*100-WINNER(B348)*100;
A49:=WINNER(B348)*100-WINNER(B349)*100;
A50:=WINNER(B349)*100-WINNER(LB)*100;
STICKLINE(ISLASTBAR,HB ,HB ,A1*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B31 ,B31 ,A1*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B32 ,B32 ,A2*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B33 ,B33 ,A3*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B34 ,B34 ,A4*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B35 ,B35 ,A5*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B36 ,B36 ,A6*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B37 ,B37 ,A7*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B38 ,B38 ,A8*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B39 ,B39 ,A9*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B310 ,B310 ,A10*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B311 ,B311 ,A11*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B312 ,B312 ,A12*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B313 ,B313 ,A13*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B314 ,B314 ,A14*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B315 ,B315 ,A15*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B316 ,B316 ,A16*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B317 ,B317 ,A17*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B318 ,B318 ,A18*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B319 ,B319 ,A19*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B320 ,B320 ,A20*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B321 ,B321 ,A21*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B322 ,B322 ,A22*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B323 ,B323 ,A23*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B324 ,B324 ,A24*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B325 ,B325 ,A25*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B326 ,B326 ,A26*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B327 ,B327 ,A27*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B328 ,B328 ,A28*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B329 ,B329 ,A29*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B330 ,B330 ,A30*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B331 ,B331 ,A31*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B332 ,B332 ,A32*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B333 ,B333 ,A33*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B334 ,B334 ,A34*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B335 ,B335 ,A35*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B336 ,B336 ,A36*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B337 ,B337 ,A37*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B338 ,B338 ,A38*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B339 ,B339 ,A39*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B340 ,B340 ,A40*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B341 ,B341 ,A41*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B342 ,B342 ,A42*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B343 ,B343 ,A43*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B344 ,B344 ,A44*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B345 ,B345 ,A45*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B346 ,B346 ,A46*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B347 ,B347 ,A47*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,B348 ,B348 ,A48*100 ,0 ),COLORRED;
STICKLINE(ISLASTBAR,LB ,LB ,A50*100 ,0 ),COLORLIMAGENTA;
{画K线}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);