以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  请教一个模型的写法,谢谢。  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=155630)

--  作者:xuehuihe
--  发布时间:2017/7/3 7:24:31
--  请教一个模型的写法,谢谢。
请教:如果我有条件1,条件2,条件3,共三个条件。如果一条都不满足,开空单2手; 如果满足一条,开空1手;  如果满足两条,开多1手; 如果满足3条,开多单2手。请问以上想法,如果在模型中实现?谢谢。
--  作者:wenarm
--  发布时间:2017/7/3 8:15:52
--  

if 条件1 and 条件2 and 条件3 then buy();

if 条件1 or 条件2 or 条件3 then buyshort();

if not(条件1 and 条件2 and 条件3) then buyshort();

 

 


--  作者:xuehuihe
--  发布时间:2017/7/3 8:45:24
--  
你的模型应该跟我讲的不一致。能麻烦你认真看一下吗?
--  作者:wenarm
--  发布时间:2017/7/3 8:51:11
--  

怎么不一样?除了没写如果满足两条的情况,都是上述的处理逻辑。你可以自己尝试写下

if not(条件1 and 条件2 and 条件3) then buyshort();

if 条件1 or 条件2 or 条件3 then buyshort();

if (条件1 and 条件2) OR (条件2 and 条件3) OR (条件1 and  条件3) then buy();

if 条件1 and 条件2 and 条件3 then buy();


--  作者:xuehuihe
--  发布时间:2017/7/3 21:19:46
--  
谢谢。我思考一下。
--  作者:xuehuihe
--  发布时间:2017/7/3 22:24:52
--  
再请教一下:如果多条件,一个都不满足,应该是: not (A or B or C) 还是not (A and B anc C)? 应该是前者吧?看你的写法,好像是后者?请多指数。
--  作者:wenarm
--  发布时间:2017/7/4 6:38:20
--  
后者,