以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 求一个多条件BUY函数的最佳实例 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=68970) |
-- 作者:lzdanjian -- 发布时间:2014/8/20 10:48:04 -- 求一个多条件BUY函数的最佳实例 满足多个条件逻辑或,然后入场。还有一个要求就是只开仓1次对应平仓一次。随便什么条件都行,想求个最佳的实例 |
-- 作者:jinzhe -- 发布时间:2014/8/20 11:01:51 -- 以3个条件为例 variable:n1=0,n2=0,n3=0; if 开仓条件1 and n1=0 and holding=0 then begin buy........; n1:=1; end
if 平仓条件1 and n1=1 and holding>0 then begin sell........; n1:=0; end
if 开仓条件2 and n2=0 and holding=0 then begin buy........; n2:=1; end
if 平仓条件2 and n2=1 and holding>0 then begin sell........; n2:=0; end
if 开仓条件3 and n3=0 and holding=0 then begin buy........; n3:=1; end
if 平仓条件3 and n3=1 and holding>0 then begin sell........; n3:=0; end |