公式源码说明:1.大盘逃顶抄底(★s,★b);2.个股逃顶抄底(s,b);3.→?(表示趋势转换)。
“顶底仓位”公式源码
{参数n:1,60,10;p:1,20,3 }
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;
上一指标公式:金牌威廉指标下载 通达信源码金牌
下一指标公式:私募机构进场加仓日指标下载 通达信源码私募
☉ 好公式网发布的指标公式主要用于软件技术面分析,仅供参考,勿用于实际操作,据此操作风险自负!
☉ 解压密码:www.goodgongshi.com 就是好公式网域名,希望大家看清楚,切勿输错。
☉ tnc和tni格式指标公式,仅可以用通达信软件引入使用,例如可以用通达信软件引入使用指标公式;
☉ tne格式指标公式,仅可以用通达信软件公式编辑器5.0版导入,高版本兼容低版本;
☉ fnc格式指标公式,可以用大智慧软件新一代高速行情分析系统股票软件使用,少部分可以用分析家软件引入使用;
☉ alg格式指标公式,仅仅可以用飞狐交易师软件引入使用;exp格式指标公式,仅可以用大智慧经典版软件引入使用;
☉ hxf格式指标公式,仅可以用同花顺软件引入使用。
☉ 如果您发现下载软件链接错误,请联系管理员报告错误。
☉ 好公式网欢迎各位网友帮忙宣传转发本站网址,有您的支持,我们会做得更好!
☉ 本文顶底仓位--看大盘定个股主图说明指标下载 通达信仓位仅供学习研究。