[PEL] 复制代码
input:x(1,0.01,100,0.01);//单位是%
if islastbar then
begin
所属行业:=hyblock;
explain(1,所属行业);//后台里运行时候,请注释掉这行代码
行业品种数量:stkcount(所属行业);//所属行业对应的板块品种数量
up_count:=0;//满足指定涨幅品种数量
for i=1 to 行业品种数量 do
begin
code:=stkfromblk(所属行业,i);//品种代码
d1:=callstock(code,vtclose,6,-1);//昨收盘价
c0:=callstock(code,vtclose,-1,0);//最新价
//利用日期过滤当前日期下没有行情的品种,需最新7.0版才能使用这个函数
//如果是其他版本则不能直接调用到指定品种的最新日期,就只能跨指标调用了
date_:=callstock(code,vtdate,6,0);
if valid(d1)=0 or valid(c0)=0 or date>date_ then continue;
zdf:=100*(c0-d1)/d1;
if zdf>=x then up_count:=up_count+1;
end
end
上涨总数:up_count;
[PEL] 复制代码
所属行业:=hyblock;
hy_count:=0;
//某股票池筛选出来的板块
股票池品种数量:stkcount('自选股');//股票池筛选出来的品种所在的板块
for i=1 to 股票池品种数量 do
begin
code:=stkfromblk('自选股',i);//品种代码
行业:=fincomswhy2014(code,'industryname2');
if 所属行业=行业 then hy_count:=hy_count+1;
end
前50的某行业品种个数:hy_count;
[PEL] 复制代码
涨速:100*dynainfo(24);//工具-选项-常规-涨速比较时间 这里设置涨速具体比较的时间区间,默认是300秒
input:zj(10000,1,1000000,1);
ss1:intpart(zj/(100*c));//根据资金zj计算的开仓手数
//ss1可能会有计算出为0 的情况,而恰好为手数参数为0在函数中是满仓开的含义。
//因此再次处理下,当ss1为0情况下默认按下一手处理。或者你也可以直接判断下ss1为0时候直接不下单也行
ss:if(ss1>0,ss1,100);//最小100
kd:tbuyholdingex('','',2)=0 and 涨速>=3;
tbuy(kd,ss,mkt);