通达信顶底仓位主图指标公式
- 指标类别: 通达信指标公式
- 授权方式: 免费版
- 指标评级: ★★★★★
- 指标分类: 策略
- 画线方法: 主图
- 日期: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;
通达信顶底仓位主图指标公式实例图解:
通达信顶底仓位主图指标公式