IF(PERIODNAME<>"日线")//判断周期
{
机构控盘度:"本指标只适用于日线周期";
RETURN;
}
b1=IF(ISNULL(BIGBUYCOUNT1[-1]),0,BIGBUYCOUNT1[-1])+IF(ISNULL(WAITBUYCOUNT1[-1]),0,WAITBUYCOUNT1[-1]);
s1=IF(ISNULL(BIGSELLCOUNT1[-1]),0,BIGSELLCOUNT1[-1])+IF(ISNULL(WAITSELLCOUNT1[-1]),0,WAITSELLCOUNT1[-1]);
b2=IF(ISNULL(BIGBUYCOUNT2[-1]),0,BIGBUYCOUNT2[-1])+IF(ISNULL(WAITBUYCOUNT2[-1]),0,WAITBUYCOUNT2[-1]);
s2=IF(ISNULL(BIGSELLCOUNT2[-1]),0,BIGSELLCOUNT2[-1])+IF(ISNULL(WAITSELLCOUNT2[-1]),0,WAITSELLCOUNT2[-1]);
pos:=-2;
//--------------------------------------------------------
IF(LV_D_SUPER_HLD_RATIO[pos]==NULL)//控盘度、超户曲线
{
m=JGCGS/(TV_D_PUBLIC_SHARES*LV_D_SUPER_HLD_RATIO);
IF(ISNULL(m) OR m==0) m=0.4663866413;
IF(m>0.9) m=0.9;
ddx:=((b1-s1)+(b2-s2)*0.7)/TV_D_PUBLIC_SHARES *100;//控盘度变化
ddx1:=((b1-s1)+(b2-s2)*0.7*m)/TV_D_PUBLIC_SHARES *100;//超户变化
IF(ISNULL(LV_D_SUPER_HLD_RATIO))//判断新股
{
RET=(B1+b2)/TV_D_PUBLIC_SHARES *100;
RET1=B1/TV_D_PUBLIC_SHARES *100;
}
ELSE
{
X1=LV_D_SUPER_HLD_RATIO*100;//昨天控盘度
ret:=X1+ddx;//今天控盘度
X11=LV_D_CH_HLD_RATIO*100;//昨天超户
Ret1:=X11+ddx1;//今天超户
//-------------------------------控盘度,超户同步调整
IF(ddx > 0)//增加,控盘度调整,超户同步调整
{
IF(x1>95)
{
ret := x1+ddx*0.1;
Ret1 := x11+ddx1*0.1;
}
ELSE IF(x1>90)
{
ret := x1+ddx*0.5;
Ret1 := x11+ddx1*0.5;
}
ELSE IF(x1>85)
{
ret := x1+ddx*0.8;
Ret1 := x11+ddx1*0.8;
}
}
IF(ddx < 0 )//减少,控盘度调整,超户同步
{
IF(x1<5)
{
ret := x1+ddx*0.1;
Ret1 := x11+ddx1*0.1;
}
ELSE IF(x1<10)
{
ret := x1+ddx*0.5;
Ret1 := x11+ddx1*0.5;
}
ELSE IF(x1<15)
{
ret := x1+ddx*0.8;
Ret1 := x11+ddx1*0.8;
}
}
}
//-----------------------------------控盘度超户绝对值调整
IF(ISNULL(ret))
ret := LV_D_SUPER_HLD_RATIO*100;
IF(ISNULL(ret1))
Ret1 := LV_D_CH_HLD_RATIO*100;
IF(ret > 97.18)
ret := 97.18;
IF(ret < 2.08)
ret := 2.08;
IF(ret1 > 96)
Ret1 := 96;
IF(ret1 < 0)
Ret1 :=0;
}
ELSE
{
ret=LV_D_SUPER_HLD_RATIO*100;
Ret1=LV_D_CH_HLD_RATIO*100;
}
//---------------------------------------------------------大户持仓比
ret2=ret-ret1;
//-----------------------------------------------------------中户持仓比
A3=100-ret;//a为实时的散户持仓比例
IF(LV_D_ZH_HLD_RATIO[pos]==NULL)
{
DY=LV_D_ZH_HLD_RATIO;//日中户持股占比
BB1= BIGBUYCOUNT3;//主动中单买入股数
SS1=BIGSELLCOUNT3;//主动中单卖出股数
BB2= WAITBUYCOUNT3;//被动中单买入股数
SS2= WAITSELLCOUNT3;//被动中单卖出股数
ZZ1=( BB1+ BB2- SS1- SS2);//当天中户净买入股数
ZZ2=( BB1+ BB2- SS1- SS2)/ TV_D_PUBLIC_SHARES *100;//当天中户净买入占比
IF(ISNULL(LV_D_ZH_HLD_RATIO))
{
RET3=(BB1+BB2)/TV_D_PUBLIC_SHARES *100;
}
ELSE
{
XX1=DY *100;
Ret3:=XX1+(ZZ1/TV_D_PUBLIC_SHARES*100);
IF(ZZ2>=0)
{
IF ( XX1>0.9*a3)//a是实时的原散户持仓比
RET3=XX1+ZZ2*0.1;
ELSE IF (XX1>0.85*a3)
RET3=XX1+ZZ2*0.5;
}
IF(ZZ2< 0)
{
IF (XX1<0.05*a3)
RET3=XX1+ZZ2*0.1;
ELSE IF (XX1<0.1*a3)
RET3=XX1+ZZ2*0.5;
}
}
IF (ret3 > 0.95*a3) ret3=0.95 *a3;
IF (ret3 < 0.02*a3) ret3=0.02 *a3;
}
ELSE
{
Ret3= LV_D_ZH_HLD_RATIO *100;
}
//--------------------------------------------------------------输出
IF(N1>0 AND LV_D_SUPER_HLD_RATIO!=NULL)
{
控盘度:ret;
IF(LV_D_SUPER_HLD_RATIO[1]!=NULL)
{
IF(COUNT(ret>0,0)<20)
{
STICKLINE(ret>ret[1],ret,ret*2-ret[1],5),colorred;
STICKLINE(ret<ret[1],ret,ret*2-ret[1],5),colorgreen;
DRAWICON((TV_D_PUBLIC_SHARES>1.05*TV_D_PUBLIC_SHARES[1] OR TV_D_PUBLIC_SHARES<0.95*TV_D_PUBLIC_SHARES[1]),ret*2-ret[1],"kaka");
}
ELSE
{
STICKLINE(ret>ret[1],MA(ret,20),MA(ret,20)+(ret-ret[1]),5),colorred;
STICKLINE(ret<ret[1],MA(ret,20),MA(ret,20)+(ret-ret[1]),5),colorgreen;
DRAWICON((TV_D_PUBLIC_SHARES>1.05*TV_D_PUBLIC_SHARES[1] OR TV_D_PUBLIC_SHARES<0.95*TV_D_PUBLIC_SHARES[1]),MA(ret,20)+(ret-ret[1]),"kaka");
}
}
}
//IF(n2>0 AND LV_D_SUPER_HLD_RATIO!=NULL)
//超级: ret1;
//IF(n3>0 AND LV_D_SUPER_HLD_RATIO!=NULL)
//机构: ret2;
//IF(n4>0 AND LV_D_SUPER_HLD_RATIO!=NULL)
//中户:ret3;
//DRAWICON((TV_D_PUBLIC_SHARES>1.05*TV_D_PUBLIC_SHARES[1] OR TV_D_PUBLIC_SHARES<0.95*TV_D_PUBLIC_SHARES[1]),MA(ret,20),"kaka")