以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  老师 帮忙看看  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=147856)

--  作者:望海潮
--  发布时间:2017/2/16 16:16:24
--  老师 帮忙看看
老师,判断昨日行情的涨幅要怎么写
比如 一只股票  比如昨日涨幅超过5%吧假设  那么今天就买进去,这个怎么写,然后设置一个条件在明天平仓  这个条件不一定   但是  即使条件不满足,也要让这只股票在明天收盘前 强制平仓掉   这个要怎么写

--  作者:jinzhe
--  发布时间:2017/2/16 16:28:31
--  

 比如昨日涨幅超过5%吧假设  那么今天就买进去,

 

h1:=callstock(stklabel,vthigh,6,-1);

l1:=callstock(stklabel,vtlow,6,-1);

cc:=callstock(stklabel,vtclose,6,-2);

if (h1-l1)/cc>=0.05 and todaybar=1 then begin

   dd:=date;

   buy(holding=0,100,marketr);

end

 

 

后设置一个条件在明天平仓  这个条件不一定   但是  即使条件不满足,也要让这只股票在明天收盘前 强制平仓掉   这个要怎么写

if 平仓条件 and dd>=date+1 and todayholding>0 then sell(1,0,marketr);

if dd>=date+1 and todayholding>0 and time0>=timetot0(closetime(0)) -5*60 then sell(1,0,marketr);//收盘前5分钟平仓