通達信頂底倉位主圖指標公式
- 指標類別: 通達信指標公式
- 授權方式: 免費版
- 指標評級: ★★★★★
- 指標分類: 策略
- 畫線方法: 主圖
- 日期:2023-10-25 來源:互聯網
通達信頂底倉位主圖指標公式:
N:=10;
P:=3;
{背景位置 }
TT:=IF(ISLASTBAR,240/FROMOPEN,1);
NN:=120;
HH:=HHV(V*TT,NN);
LL:=LLV(V,NN);
最高:=CONST(HH);
最低:=CONST(LL);
最高2:=CONST(HHV(H,NN));
最低2:=CONST(LLV(L,NN));
PP:=IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,20)),0.9,IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,50)),0.7,0.6)),NODRAW;
RCC1:=最高2*0.9-(最高2-最低2)*PP;
最低R:=MIN(RCC1,最低2);
RCC:=最低R;
AAA:=CONST(HHV(H,60));
STICKLINE(CURRBARSCOUNT=46 ,RCC*1.1,RCC*1.04,100,0),COLOR333555;
{大盤趨勢定倉位 }
RSVD:=(INDEXC-LLV(INDEXL,9))/(HHV(INDEXH,9)-LLV(INDEXL,9))*100;
KD:=SMA(RSVD,3,1);
ZJD:=(INDEXO+INDEXH+INDEXL+INDEXC)/4;
YZD:=IF(BARSCOUNT(INDEXC)>60,VOL/SUM(INDEXV,60),VOL/SUM(INDEXV,BARSCOUNT(INDEXC)));
CYC50D:=DMA(ZJD,YZD/0.50);
CYC0D:=DMA(ZJD,YZD);
KPXSD:=(CYC50D/CYC0D-1)*100;
KPD:=IF(KPXSD<0,85,IF(KPXSD>=0 AND KPXSD<5,60,IF(KPXSD>=5 AND KPXSD<15,35,IF(KPXSD>=15,15,90))));
大盤風險:=(KD+KPD)/2,NODRAW;
大盤M3:=MA(REF(INDEXC,1),3);
總漲家:="SZ399001$ADVANCE"+"SH999999$ADVANCE",COLORRED,NODRAW;
總跌家:="SZ399001$DECLINE"+"SH999999$DECLINE",COLORGREEN,NODRAW;
總漲家5日:=SUM(("SZ399001$ADVANCE"+"SH999999$ADVANCE"),5);
總跌家5日:=SUM(("SZ399001$DECLINE"+"SH999999$DECLINE"),5);
總五日比:=(總漲家5日/總跌家5日);
ZWB:=總五日比>REF(總五日比,1)OR 大盤M3>REF(大盤M3,1);
大盤持股: ZWB,NODRAW,COLORRED;
總倉位%:(100-大盤風險),NODRAW;
{個股倉位 }
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
ZJ:=(O+H+L+C)/4;
YZ:=IF(BARSCOUNT(C)>60,VOL/SUM(VOL,60),VOL/SUM(VOL,BARSCOUNT(C)));
CYC50:=DMA(ZJ,YZ/0.50);
CYC0:=DMA(ZJ,YZ);
KPXS:=(CYC50/CYC0-1)*100;
KP:=IF(KPXS<0,85,IF(KPXS>=0 AND KPXS<5,60,IF(KPXS>=5 AND KPXS<15,35,IF(KPXS>=15,15,90))));
個風險:(K+KP)/2,NODRAW;
SHORT:=ATAN((EMA(C,7)/REF(EMA(C,7),1)-1)*100)*57.3;
LONG:=ATAN((EMA(C,21)/REF(EMA(C,21),1)-1)*100)*57.3;
個持股:SHORT>LONG,NODRAW,COLORYELLOW;
個倉位%:100-個風險,COLORRED,NODRAW;
{BOLL+K線 }
BBI:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;
DWN:BBI-P*STD(BBI,N),COLORYELLOW,LINETHICK1;
UPR:BBI+P*STD(BBI,N),COLORFF50FF,LINETHICK1;
MA5:MA(C,5),COLORWHITE,LINETHICK1;
IF(MA5>REF(MA5,1),MA5,DRAWNULL),COLORRED,LINETHICK1;
M10:MA(C,10),COLORA08888;
M89:=MA(INDEXC,89),COLORMAGENTA;
{乖離均線 }
AA05:=MA(C,5),COLOR0099CC;
五乖:=(C-AA05)/AA05*100;
BB05:=ATAN((AA05/REF(AA05,1)-1)*100)*180/3.1416;
速度5:=SMA(EMA((AA05-REF(AA05,1))/REF(AA05,1),3)*100,3,1);
加速度5:=EMA((速度5-REF(速度5,1)),3),LINETHICK0;
AA10:=MA(C,10);AA20:=MA(C,20);
BB10:=ATAN((AA10/REF(AA10,1)-1)*100)*180/3.1416;
AA30:=MA(C,30),LINETHICK2;
三拾乖:=(C-AA30)/AA30*100,LINETHICK0;
VAR1G:=(AA20-AA30)>REF((AA20-AA30),1) AND AA20>REF(AA20,1) AND AA30>REF(AA30,1);
VAR2G:=(AA30-AA20)<REF((AA30-AA20),1) AND AA20<REF(AA20,1) AND AA30<REF(AA30,1);
BB30:=ATAN((AA30/REF(AA30,1)-1)*100)*180/3.1416;
清倉:=FILTER(COUNT(CROSS(30,BB05),5)>=1 AND (C>AA30 OR O>AA30) AND AA05<REF(AA05,1) AND 三拾乖<REF(三拾乖,1) AND AA10<REF(AA10,1),10);
JCG:=CROSS(0,五乖) AND 三拾乖<REF(三拾乖,1) AND AA10>REF(AA10,1) ;
減倉:=FILTER(JCG,10);
MR:=COUNT(CROSS(五乖,0),3)>=1 AND 三拾乖>REF(三拾乖,1) AND AA05>REF(AA05,1) AND (C/REF(C,1)-1)*100>5 AND REF(C,1)<AA30;
買入:=FILTER(MR,10);
DRAWICON(減倉,H*1.01,12);
日均價:=AMOUNT/VOL/100;
JF1:=SMA(SMA(EMA(日均價,5)*2-MA(日均價,5),3,1),3,1),COLOR999900;
補償:=FLOOR(((JF1-MA(JF1,5))/MA(JF1,5)*100));
趨勢:=SMA(SMA((EMA(日均價,(5+ABS(補償)))),2,1),2,1),COLOR666666;
多方趨勢:=7*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1)-3*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1),3,1)-SMA(SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1),3,1),2,1);
天線:=78.89;
頂:=CROSS(天線,多方趨勢) AND C>趨勢;
DRAWICON(頂,H*1.02,2);
VAR1B:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
VAR2B:=REF(VAR1B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR3B:=REF(VAR2B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR4B:=REF(VAR3B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR5B:=REF(VAR4B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR6B:=REF(VAR5B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR7B:=REF(VAR6B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR8B:=REF(VAR7B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR9B:=REF(VAR8B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARAB:=REF(VAR9B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VARBB:=REF(VARAB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARCB:=REF(VARBB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VARDB:=CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2);
VAREB:=REF(VARDB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARFB:=REF(VAREB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR10B:=REF(VARFB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR11B:=REF(VAR10B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR12B:=REF(VAR11B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR13B:=REF(VAR12B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR14B:=REF(VAR13B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR15B:=REF(VAR14B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR16B:=REF(VAR15B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR17B:=REF(VAR16B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR18B:=REF(VAR17B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR19B:=REF(VARDB OR VAREB OR VARFB OR VAR10B OR VAR11B OR VAR12B OR VAR13B OR
VAR14B OR VAR15B OR VAR16B OR VAR17B OR VAR18B,1) AND VAR1B;
VAR1AB:=REF(VAR1B OR VAR2B OR VAR3B OR VAR4B OR VAR5B OR VAR6B OR VAR7B OR
VAR8B OR VAR9B OR VARAB OR VARBB OR VARCB,1) AND VARDB;
DRAWTEXT(VAR1AB,H*1.03,'↓'),COLORGREEN;
{波段極品}
JD:=MA(CLOSE,20)+2*STD(CLOSE,20);
YD:=MA(CLOSE,20)-2*STD(CLOSE,20);
DRAWICON(CROSS(YD,(REF(HIGH,1)+REF(LOW,1))/2),L/1.035,1);
{精準操盤 }
AAJ:=EMA(C,5)-EMA(C,13);
BBJ:=EMA(AAJ,3);
X:=AAJ>REF(AAJ,1);
Y:=REF(AAJ,3)>=REF(AAJ,2);
ZZ:=REF(AAJ,2)>=REF(AAJ,1);
ZZ1:=AAJ<BBJ;
注意:=X AND Y AND ZZ AND ZZ1 ;
DRAWTEXT(注意,L*0.99,'→?'),COLORYELLOW;{'→?'表示趨勢轉換};
{大盤逃頂抄底 }
Z:=MA(C,120);
VAR3:=(MA(H,5)-Z)/Z;
VAR4:=MA((CLOSE-LLV(LOW,10))/(HHV(HIGH,10)-LLV(LOW,10))*100,3);
VAR5:=MA((CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100,3);
D1:DRAWTEXT(CROSS(95,VAR4) AND VAR3>0.3 AND C>200,H*1.04 ,'★S'),COLORCYAN;
D2:DRAWTEXT( CROSS(93,VAR4) AND HHV(H,30)/LLV(L,30)>1.1 AND REF(Z,1)/Z>0.997 AND C>200,H*1.04 ,'★S'),COLORGREEN;
D3:DRAWTEXT(CLOSE<Z AND Z<REF(Z,1) AND REF(VAR4,1)>90 AND VAR4<REF(VAR4,1) AND REF(VAR4,1)>REF(VAR4,2) AND C>200 ,H*1.04,'★S'),COLORBLUE;
D4:DRAWTEXT(CLOSE>Z AND REF(VAR5,1)<30 AND VAR5>REF(VAR5,1) AND REF(VAR5,1)<REF(VAR5,2)AND C>200 ,L*0.97 ,'★B'),COLORRED;
D5:DRAWTEXT(REF(VAR5,1)<7 AND VAR5>REF(VAR5,1) AND REF(VAR5,1)<REF(VAR5,2) AND VAR3<-0.1 AND C>200,L*0.97,'★B'),COLORYELLOW;
D6:DRAWTEXT(CROSS(VAR5,5) AND VAR3<-0.3 AND C>200,L*0.97 ,'★B'),COLORWHITE;
{個股逃頂抄底 }
VAR55:=(MA(AMOUNT,5)/MA(VOL,5)/100-MA(AMOUNT,120)/MA(VOL,120)/100)/(MA(AMOUNT,5)/MA(VOL,5)/100);
D11:DRAWTEXT(CLOSE<Z AND Z<REF(Z,1) AND REF(VAR4,1)>80 AND VAR4<REF(VAR4,1) AND REF(VAR4,1)>REF(VAR4,2),H*1.02,'S'),COLORBLUE;
D22:DRAWTEXT(CROSS(90,VAR4) AND VAR55>0.2,H*1.02,'S'),COLORGREEN;
D33:DRAWTEXT(CROSS(95,VAR4) AND VAR3>0.5,H*1.02 ,'S'),COLORLIGREEN;
VAR555:=(MA(AMOUNT,5)/MA(VOL,5)/100-MA(AMOUNT,120)/MA(VOL,120)/100)/(MA(AMOUNT,5)/MA(VOL,5)/100);
D111:DRAWTEXT(CLOSE>Z AND REF(VAR5,1)<30 AND VAR5>REF(VAR5,1) AND REF(VAR5,1)<REF(VAR5,2) ,LOW*0.98 ,'B'),COLORRED;
D222:DRAWTEXT(REF(VAR555,1)<5 AND VAR555>REF(VAR555,1) AND REF(VAR555,1)<REF(VAR555,2) AND VAR3<-0.3,LOW*0.98 ,'B'),COLORGREEN;
D333:DRAWTEXT(CROSS(VAR555,5) AND VAR3<-0.4,LOW*0.98 ,'B'),COLORBLUE;
{以下是文字解盤,可以刪去不要}
A74:=MA(CLOSE,20);
A75:=(CLOSE > MA(CLOSE,5));
A76:=(MA(CLOSE,5) > MA(CLOSE,10));
A77:=(CLOSE > MA(CLOSE,10));
A78:=(MA(CLOSE,5) > MA(CLOSE,20));
A79:=(CLOSE > MA(CLOSE,20));
A710:=REF(A74,1);
A711:=(A74 > A710);
AVX:=(((((IF(A75,10,(0 - 10)) + IF(A76,10,(0 - 10))) + IF(A77,10,(0 - 10)))
+ IF(A78,10,(0 - 10))) + IF(A79,10,(0 - 10))) + IF(A711,10,(0 - 10)));
DSLX:=(CLOSE / INDEXC);
DSLX1:=MA(DSLX,5);
DSLX2:=MA(DSLX,10);
V1:=MA(VOL,5);
V2:=MA(VOL,10);
T20:=CONST(IF(C>200 AND (CROSS(1,AVX) AND (V1 >= V2)),1,0));
T21:=CONST(IF(C>200 AND (CROSS(1,AVX) AND (V1 < V2)),1,0));
T22:=CONST(IF(C>200 AND (((AVX >= 1) AND (REF(AVX,1) > 0)) AND (V1 >= V2)),1,0));
T23:=CONST(IF(C>200 AND (((AVX >= 1) AND (REF(AVX,1) > 0)) AND (V1 < V2)),1,0));
T24:=CONST(IF(C>200 AND (((AVX < 1) AND (REF(AVX,1) < 0)) AND (V1 >= V2)),1,0));
T25:=CONST(IF(C>200 AND (((AVX < 1) AND (REF(AVX,1) < 0)) AND (V1 < V2)),1,0));
DRAWTEXT(T20=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤形態走壞,重倉者可以減去大部分倉位。'),COLORYELLOW ;
DRAWTEXT(T21=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤縮量調整,注意風險,短線清倉觀望。'),COLORYELLOW ;
DRAWTEXT(T22=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤走勢良好,量能理想,可以繼續持有強勢股。'),COLORYELLOW ;
DRAWTEXT(T23=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤形態良好,但量能稍顯不足,隨時準備減倉。'),COLORYELLOW;
DRAWTEXT(T24=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤趨勢不明,注意成交量變化,目前不適宜進場。'),COLORYELLOW;
DRAWTEXT(T25=1 AND CURRBARSCOUNT=55,RCC*1.05
,'大盤趨勢向下,量能萎縮,不適合進場。'),COLORYELLOW;
DRAWTEXT(C>200 AND CONST(INDEXC<M89) AND CURRBARSCOUNT=30,RCC*1.05,'滬深日K在89線下運行宜觀望!'),COLORYELLOW;
{趨勢狀態提示}
{N1:2,100,14}
N1:=14;
TR1:=SMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N1,1);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
DMP:=SMA(IF(HD>0 AND HD>LD,HD,0),N1,1);
DMM:=SMA(IF(LD>0 AND LD>HD,LD,0),N1,1);
PDI:=DMP*100/TR,COLORRED;
MDI:=DMM*100/TR,COLORGREEN;
ADX:=SMA(ABS(MDI-PDI)/(MDI+PDI)*100,N1,1),COLORYELLOW;
階段線1:=16;
階段線2:=30;
DMI1:=PDI>MDI AND ADX>=30;
DMI2:=PDI<MDI AND ADX>=30;
DMI3:=PDI>MDI AND 16<ADX<30;
DMI4:=PDI<MDI AND 16<ADX<30;
DMI5:=ADX<=16 AND (PDI>MDI OR PDI<MDI);
DMI6:=ADX>60;
DRAWTEXT(C>0 AND CURRBARSCOUNT=55,RCC*1.07,'☆大盤同紅才進!破頂底非強;價不昨高上影太長莫入'),COLORWHITE;
DRAWTEXT(DMI1 AND ISLASTBAR,HHV(H,50),'強上升勢(在牛市)'),COLOR00FFFF;
DRAWTEXT(DMI2 AND ISLASTBAR,HHV(H,50),'強下降勢(在熊市)'),COLOR00FFFF;
DRAWTEXT(DMI3 AND ISLASTBAR,HHV(H,50)*0.98,'略牛盤整期'),COLOR00FFFF;
DRAWTEXT(DMI4 AND ISLASTBAR,HHV(H,50)*0.98,'略熊盤整期'),COLOR00FFFF;
DRAWTEXT(DMI5 AND ISLASTBAR,HHV(H,50)*0.96,'處于靜寂期'),COLOR00FFFF;
DRAWTEXT(DMI6 AND ISLASTBAR,HHV(H,50)*0.96,'注意ADX已>60,在牛市可能回調'),COLOR00FFFF;
DRAWTEXT(CONST(大盤持股=1) AND CURRBARSCOUNT=55,RCC*1.1,'大盤持股=1提示參與(總倉位%見頂欄)'),COLORRED;
DRAWTEXT(CONST(大盤持股=0) AND CURRBARSCOUNT=55,RCC*1.1,'大盤持股=0提示觀望(總倉位%無效)'),COLORCYAN;
通達信頂底倉位主圖指標公式實例圖解:
通達信頂底倉位主圖指標公式