通达信长、短周期都可以进行半对数自动预测的主图指标 源码 附图

天数:=80;
顶底开关:=1;
DRAWTEXT_FIX(1,0.50,0.01,1,'说明: 本指标以设置天数范围作为自动选择高、低点进行两点半对数预测,可按ALT+T键弹出参数调整窗,进行天数调整,缺省为80天。'),COLORYELLOW;
DRAWTEXT_FIX(1,0.30,0.04,1,'标题栏上的买(卖)P4、买(卖)P5是费氏数列1.236、1.618的预测股价'),COLORMAGENTA;
AR1:=BARSCOUNT(C);
AR2:=CONST(AR1);
AR3:=AR2-AR1;
K线根数:AR3+1,NODRAW,COLORYELLOW;
STICKLINE(C>=O,C,O,3,0),COLOR000045;
STICKLINE(C>=O,C,O,2.5,0),COLOR000065;
STICKLINE(C>=O,C,O,2,0),COLOR000085;
STICKLINE(C>=O,C,O,1.5,0),COLOR0000A5;
STICKLINE(C>=O,C,O,1,0),COLOR0000C5;
STICKLINE(C>=O,C,O,0.5,0),COLOR0000E5;
STICKLINE(C>=O,H,L,0,0),COLOR0000F5;
STICKLINE(C<O,C,O,3,0),COLORFF9900;
STICKLINE(C<O,C,O,2.5,0),COLORFF9900;
STICKLINE(C<O,C,O,2,0),COLORFFCC00;
STICKLINE(C<O,C,O,1.5,0),COLORFFCC00;
STICKLINE(C<O,C,O,1,0),COLORCYAN;
STICKLINE(C<O,C,O,0.5,0),COLORCYAN;
JA :=3*SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)-2*SMA(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),3,1),NODRAW;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,3,0),COLOR009CFF;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,2.8,0),COLOR009CFF;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,2.5,0),COLOR00C0FF;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,1.5,0),COLOR00D1FF;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,1,0),COLOR00EAFF;
STICKLINE(顶底开关>0 AND (JA >=90),CLOSE,OPEN,0.7,0),COLORYELLOW;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,3,0),COLORFF0000;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,2.5,0),COLORFF1100;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,2,0),COLORFF2200;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,1.5,0),COLORFF3300;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,1,0),COLORFF4400;
STICKLINE(顶底开关>0 AND (JA <=10),OPEN,CLOSE,0.5,0),COLORFF5500;
STICKLINE(顶底开关>0 AND (JA <=10),H,L,0,0),COLORFF6600;
GGA:=REF(HHV(H,天数),0);
LLA:=REF(LLV(L,天数),0);
A1:=H=CONST(HHV(H,天数)),NODRAW;
B1:=L=CONST(LLV(L,天数)),NODRAW;
GGB:=BARSLAST(A1)+1,NODRAW;
LLB:=BARSLAST(B1)+1,NODRAW;

H1:=IF(GGB<LLB,POW(LLA,0.125)*POW(GGA,0.875),DRAWNULL);
H2:=IF(GGB<LLB,POW(LLA,0.382)*POW(GGA,0.618),DRAWNULL);
H3:=IF(GGB<LLB,SQRT(LLA*GGA),DRAWNULL);
H4:=IF(GGB<LLB,POW(LLA,0.618)*POW(GGA,0.382),DRAWNULL);
H5:=IF(GGB<LLB,POW(LLA,0.875)*POW(GGA,0.125),DRAWNULL);
H6:=IF(GGB<LLB,GGA-(GGA-LLA)*1.236,DRAWNULL)NODRAW;
H7:=IF(GGB<LLB,GGA-(GGA-LLA)*1.618,DRAWNULL)NODRAW;
高点:REFDATE(GGA,DATE),COLORRED,LINETHICK1;
低点:REFDATE(LLA,DATE),COLORGREEN,LINETHICK1;

买甘氏角A:REFDATE(H1,DATE),COLORMAGENTA,CIRCLEDOT,LINETHICK1;
买P1:REFDATE(H2,DATE),COLORRED,DOTLINE,LINETHICK1;
买P2:REFDATE(H3,DATE),COLORGREEN,DOTLINE,LINETHICK1;
买P3:REFDATE(H4,DATE),COLORWHITE,DOTLINE,LINETHICK1;
买甘氏角B:REFDATE(H5,DATE),COLORLIRED,CIRCLEDOT,LINETHICK1;
买P4:CONST(H6),NODRAW,COLORYELLOW;
买P5:CONST(H7),NODRAW,COLORRED;

DRAWTEXT(CURRBARSCOUNT=6,CONST(GGA),VARCAT('高点=',VAR2STR(CONST(GGA),2))),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=9,买甘氏角A,VARCAT('买甘氏价A=',VAR2STR(CONST(H1),2))),DRAWABOVE,COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=6,买P1,VARCAT('买P1=',VAR2STR(CONST(H2),2))),DRAWABOVE,COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=6,买P2,VARCAT('买P2=',VAR2STR(CONST(H3),2))),DRAWABOVE,COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=6,买P3,VARCAT('买P3=',VAR2STR(CONST(H4),2))),DRAWABOVE,COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=9,买甘氏角B,VARCAT('买甘氏角B=',VAR2STR(CONST(H5),2))),DRAWABOVE,COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=6,CONST(LLA),VARCAT('低点=',VAR2STR(CONST(LLA),2))),COLORRED;
STICKLINE(CURRBARSCOUNT=天数,CONST(LLA),CONST(GGA),0.5,1),COLORFF8800;
STICKLINE(CURRBARSCOUNT=1,CONST(LLA),CONST(GGA),0,1),COLORFF8800;
DRAWTEXT(CURRBARSCOUNT=天数,CONST(LLA),VARCAT('天数 ',VAR2STR(CONST(天数),0))),COLORYELLOW;

L1:=IF(GGB>LLB,POW(LLA,0.875)*POW(GGA,0.125),DRAWNULL);
L2:=IF(GGB>LLB,POW(LLA,0.618)*POW(GGA,0.382),DRAWNULL);
L3:=IF(GGB>LLB,SQRT(LLA*GGA),DRAWNULL);
L4:=IF(GGB>LLB,POW(LLA,0.382)*POW(GGA,0.618),DRAWNULL);
L5:=IF(GGB>LLB,POW(LLA,0.125)*POW(GGA,0.875),DRAWNULL);
L6:=IF(GGB>LLB,LLA+(GGA-LLA)*1.236,DRAWNULL)NODRAW;
L7:=IF(GGB>LLB,LLA+(GGA-LLA)*1.618,DRAWNULL)NODRAW;


卖甘氏角A:REFDATE(L1,DATE),COLORMAGENTA,CIRCLEDOT,LINETHICK1;
卖P1:REFDATE(L2,DATE),COLORRED,DOTLINE,LINETHICK1;
卖P2:REFDATE(L3,DATE),COLORGREEN,DOTLINE,LINETHICK1;
卖P3:REFDATE(L4,DATE),COLORWHITE,DOTLINE,LINETHICK1;
卖甘氏角B:REFDATE(L5,DATE),COLORLIRED,CIRCLEDOT,LINETHICK1;
卖P4:CONST(L6),NODRAW,COLORYELLOW;
卖P5:CONST(L7),NODRAW,COLORRED;
DRAWTEXT(CURRBARSCOUNT=9,卖甘氏角A,VARCAT('卖甘氏角A=',VAR2STR(CONST(L1),2))),DRAWABOVE,COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=6,卖P1,VARCAT('卖P1=',VAR2STR(CONST(L2),2))),DRAWABOVE,COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=6,卖P2,VARCAT('卖P2=',VAR2STR(CONST(L3),2))),DRAWABOVE,COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=6,卖P3,VARCAT('卖P3=',VAR2STR(CONST(L4),2))),DRAWABOVE,COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=9,卖甘氏角B,VARCAT('卖甘氏角B=',VAR2STR(CONST(L5),2))),DRAWABOVE,COLORGREEN;



顶价:=REF(H,BARSLAST(H>REF(H,1)));
底价:=REF(L,BARSLAST(L<REF(L,1)));
分型顶0:=H>REF(顶价,1) AND L>REF(底价,1);
分型底0:=L<REF(底价,1) AND H<REF(顶价,1);
分型顶1:=分型顶0 AND H=HHV(H,BARSLAST(分型底0));
分型底1:=分型底0 AND L=LLV(L,BARSLAST(分型顶0));
分型顶:=FILTERX(分型顶1,BARSLAST(分型底1));
分型底:=FILTERX(分型底1,BARSLAST(分型顶1));
UP1:=BARSLAST(分型底);
顶力度1:=HHV(L,UP1+1)>LLV(H,UP1+1);
顶包含1:=COUNT(L>REF(L,1),UP1)>2 AND COUNT(H>REF(H,1),UP1)>2;
DN1:=BARSLAST(分型顶);
底力度1:=HHV(L,DN1+1)>LLV(H,DN1+1);
底包含1:=COUNT(H<REF(H,1),DN1)>2 AND COUNT(L<REF(L,1),DN1)>2;
笔顶10:=分型顶 AND UP1>3 AND 顶力度1 AND 顶包含1;
笔底10:=分型底 AND DN1>3 AND 底力度1 AND 底包含1;
笔顶11:=笔顶10 AND H=HHV(H,BARSLAST(笔底10));
笔底11:=笔底10 AND L=LLV(L,BARSLAST(笔顶10));
笔顶12:=笔顶11 AND H=HHV(H,BARSLAST(笔底11));
笔底12:=笔底11 AND L=LLV(L,BARSLAST(笔顶11));
笔顶1:=FILTERX(笔顶12,BARSLAST(笔底12));
笔底1:=FILTERX(笔底12,BARSLAST(笔顶12));
UP2:=BARSLAST(笔底1);
顶力度2:=HHV(L,UP2+1)>LLV(H,UP2+1);
顶包含2:=COUNT(L>REF(L,1),UP2)>2 AND COUNT(H>REF(H,1),UP2)>2;
DN2:=BARSLAST(笔顶1);
底力度2:=HHV(L,DN2+1)>LLV(H,DN2+1);
底包含2:=COUNT(H<REF(H,1),DN2)>2 AND COUNT(L<REF(L,1),DN2)>2;
笔顶20:=分型顶 AND UP2>3 AND 顶力度2 AND 顶包含2;
笔底20:=分型底 AND DN2>3 AND 底力度2 AND 底包含2;
笔顶21:=笔顶20 AND H=HHV(H,BARSLAST(笔底20));
笔底21:=笔底20 AND L=LLV(L,BARSLAST(笔顶20));
笔顶2:=FILTERX(笔顶21,BARSLAST(笔底21));
笔底2:=FILTERX(笔底21,BARSLAST(笔顶21));
笔顶3:=笔顶1 OR 笔顶2;
笔底3:=笔底1 OR 笔底2;
笔顶41:=FILTERX(笔顶3 AND H=HHV(H,BARSLAST(笔底3)),BARSLAST(笔底3));
笔底41:=FILTERX(笔底3 AND L=LLV(L,BARSLAST(笔顶3)),BARSLAST(笔顶3));
笔顶42:=FILTERX(笔顶41 AND H=HHV(H,BARSLAST(笔底41)),BARSLAST(笔底41));
笔底42:=FILTERX(笔底41 AND L=LLV(L,BARSLAST(笔顶41)),BARSLAST(笔顶41));
笔顶431:=笔顶42 AND (BARSLAST(笔底42)>1 OR BARSLAST(笔底42)=DRAWNULL);
笔底431:=笔底42 AND (BARSLAST(笔顶42)>1 OR BARSLAST(笔顶42)=DRAWNULL);
笔顶432:=笔顶431 AND (H=HHV(H,BARSLAST(笔底431)) OR BARSLAST(笔底431)=DRAWNULL);
笔底432:=笔底431 AND (L=LLV(L,BARSLAST(笔顶431)) OR BARSLAST(笔顶431)=DRAWNULL);
笔顶43:=FILTERX(笔顶432,BARSLAST(笔底431));
笔底43:=FILTERX(笔底432,BARSLAST(笔顶431));
笔顶441:=笔顶43 AND (BARSLAST(笔底43)>2 OR BARSLAST(笔底43)=DRAWNULL);
笔底441:=笔底43 AND (BARSLAST(笔顶43)>2 OR BARSLAST(笔顶43)=DRAWNULL);
笔顶442:=笔顶441 AND (H=HHV(H,BARSLAST(笔底441)) OR BARSLAST(笔底441)=DRAWNULL);
笔底442:=笔底441 AND (L=LLV(L,BARSLAST(笔顶441)) OR BARSLAST(笔顶441)=DRAWNULL);
笔顶44:=FILTERX(笔顶442,BARSLAST(笔底441));
笔底44:=FILTERX(笔底442,BARSLAST(笔顶441));
笔顶451:=笔顶44 AND (BARSLAST(笔底44)>3 OR BARSLAST(笔底44)=DRAWNULL);
笔底451:=笔底44 AND (BARSLAST(笔顶44)>3 OR BARSLAST(笔顶44)=DRAWNULL);
笔顶452:=笔顶451 AND (H=HHV(H,BARSLAST(笔底451)) OR BARSLAST(笔底451)=DRAWNULL);
笔底452:=笔底451 AND (L=LLV(L,BARSLAST(笔顶451)) OR BARSLAST(笔顶451)=DRAWNULL);
笔顶45:=FILTERX(笔顶452,BARSLAST(笔底452));
笔底45:=FILTERX(笔底452,BARSLAST(笔顶452));
DN511:=BARSLAST(笔顶45);
底力度511:=HHV(L,DN511+1)>LLV(H,DN511+1);
底包含511:=COUNT(H<REF(H,1),DN511)>2 AND COUNT(L<REF(L,1),DN511)>2;
笔底511:=笔底43 AND (笔底45<>1) AND DN511>3 AND 底力度511 AND 底包含511 AND (L=LLV(L,BARSLAST(笔顶45)));
笔底51:=FILTERX(笔底511,BARSLAST(笔顶45));
UP512:=BARSLAST(笔底45);
顶力度512:=HHV(L,UP512+1)>LLV(H,UP512+1);
顶包含512:=COUNT(L>REF(L,1),UP512)>2 AND COUNT(H>REF(H,1),UP512)>2;
笔顶512:=笔顶43 AND (笔顶45<>1) AND UP512>3 AND 顶力度512 AND 顶包含512 AND (H=HHV(H,BARSLAST(笔底45)));
笔顶51:=FILTERX(笔顶512,BARSLAST(笔底45));
笔顶521:=笔顶45 OR 笔顶51;
笔底521:=笔底45 OR 笔底51;
笔顶52:=FILTERX(笔顶521 AND H=HHV(H,BARSLAST(笔底521)),BARSLAST(笔底521));
笔底52:=FILTERX(笔底521 AND L=LLV(L,BARSLAST(笔顶521)),BARSLAST(笔顶521));
UP53:=BARSLAST(笔底52);
顶力度53:=HHV(L,UP53+1)>LLV(H,UP53+1);
顶包含53:=COUNT(L>REF(L,1),UP53)>2 AND COUNT(H>REF(H,1),UP53)>2;
DN53:=BARSLAST(笔顶52);
底力度53:=HHV(L,DN53+1)>LLV(H,DN53+1);
底包含53:=COUNT(H<REF(H,1),DN53)>2 AND COUNT(L<REF(L,1),DN53)>2;
笔顶53:=笔顶52 AND UP53>3 AND 顶力度53 AND 顶包含53 AND (H=HHV(H,BARSLAST(笔底52)));
笔底53:=笔底52 AND DN53>3 AND 底力度53 AND 底包含53 AND (L=LLV(L,BARSLAST(笔顶52)));
笔顶54:=FILTERX(笔顶53 AND H=HHV(H,BARSLAST(笔底53)),BARSLAST(笔底53));
笔底54:=FILTERX(笔底53 AND L=LLV(L,BARSLAST(笔顶53)),BARSLAST(笔顶53));
笔顶55:=H=HHV(H,BARSLAST(笔底54)) AND L>LLV(L,BARSLAST(笔底54)) AND BARSLAST(笔顶54)<BARSLAST(笔底54) AND (BARSNEXT(笔底54)<BARSNEXT(笔顶54) OR BARSNEXT(笔顶54)=DRAWNULL);
笔底55:=L=LLV(L,BARSLAST(笔顶54)) AND H<HHV(H,BARSLAST(笔顶54)) AND BARSLAST(笔底54)<BARSLAST(笔顶54) AND (BARSNEXT(笔顶54)<BARSNEXT(笔底54) OR BARSNEXT(笔底54)=DRAWNULL);
笔顶56:=笔顶54 OR 笔顶55;
笔底56:=笔底54 OR 笔底55;
笔顶6:=FILTERX(笔顶56 AND H=HHV(H,BARSLAST(笔底56)),BARSLAST(笔底56));
笔底6:=FILTERX(笔底56 AND L=LLV(L,BARSLAST(笔顶56)),BARSLAST(笔顶56));
笔顶7:=笔顶6 AND BARSLAST(笔底6)>3;
笔底7:=笔底6 AND BARSLAST(笔顶6)>3;
笔顶:=BARSLAST(笔顶7),NODRAW;
笔底:=BARSLAST(笔底7),NODRAW;
NOTEXT_上笔:DRAWLINE(笔底=0,L,笔顶=0,H,0),COLOR0000FF,LINETHICK1;
NOTEXT_下笔:DRAWLINE(笔顶=0,H,笔底=0,L,0),COLOR238E23,LINETHICK1;
K:=CURRBARSCOUNT,NODRAW;
DRAWNUMBER(笔顶=0,H,K),COLORLIRED,DRAWABOVE;
DRAWNUMBER(笔底=0,L,K),COLORFFFF00;



未来函数检测结果如下:
该公式包含未来函数:BARSNEXT
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式

联系我们  |  指标公式网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 浙ICP备2024071487号-2 指标公式网别名指标网仅为互联网文章,所有指标公式及文章仅供学习研究,并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。指标公式网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
QQ:88652583 微信 88652583
sitemap站点地图