以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  白盘收盘10秒内平所有持仓怎么写?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=188070)

--  作者:qq代人发帖
--  发布时间:2021/4/27 13:17:41
--  白盘收盘10秒内平所有持仓怎么写?
请教:白盘收盘10秒内平所有持仓怎么写?
--  作者:FireScript
--  发布时间:2021/4/27 13:49:30
--  
//运行条件:非日线+固定轮训模式下。
abb:=timetot0(CLOSETIME(0))-time0,NODRAW;//当前K线时间距离收盘K线结束倒计时
abb3:=timetot0(CLOSETIME(0))-timetot0(dynainfo(207)),NODRAW;//当前时间距离收盘K时间    
cd:(abb<=10 and abb>=0 and (not(ISLASTBAR))) or (ISLASTBAR and  abb3>=0 and abb3<=10);//秒数可以在这里调整就行了。

if  cd then
begin
sell(holding>0,holding,market);
sellshort(holding<0,holding,market);    
end