以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 过滤开仓次数 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=78445) |
-- 作者:flushentity -- 发布时间:2015/5/11 7:44:43 -- 过滤开仓次数 每个交易品种每天最多交易两次(开仓平仓合起来算一次),超过两次后出现的交易信号不交易。这个过滤条件应该怎么写? |
-- 作者:jinzhe -- 发布时间:2015/5/11 9:26:01 -- 使用全局变来实现 variable:n=0; if 开多条件 and holding=0 and n<2 then begin buy(1,1,market); N:=n+1; end
if 开空条件 and holding=0 and n<2 then begin buyshort(1,1,market); N:=n+1; end
最后在程序结尾处加一句重置全局变量的代码即可:
if time=closetime(0) then n:=0;
|