input:rg(100,1,400),zj(50,1,1000,0.01);//rg是统计范围,zj是资金,单位是万
con:c>1.03*ref(c,1) and c<1.15*ref(c,1);
v1:if(con,amount,0);
con_count:sum(con,rg);
//满足成交额条件的 成交额均值
amt_av:sum(v1,rg)/con_count;
ss:intpart(zj*10000/c/100);//按照资金计算手数,向下取值 实际资金占用小于等于zj (单位万)
if tbuyholdingex('','',2)=0 and amount>amt_av*5 then tbuy(1,ss,mkt);