Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:老师帮忙指点一下

1楼
2457146251 发表于:2017/4/7 15:24:18
            
现在有两个进场条件 CondA  和 CondB  


我想实现的进场方式的,,1,CondA 条件进场 2 手, 当cond 2 条件 满足之后,,, 再 进场  2 手 , 总共4手,   

                                  2,  当condB 满足,而CondA不满足时候,只进场CondB 2 手, 也就是说,,,CondB进场 不受 CondA 限制  不管有没有持仓, 满足CondB 则进场( 即便CondA 已经进场了),而 CondA 进场 的前提是 holding 必须= 0 ,也就是空仓!

我写语句是这样的

if time > 093000 then begin

             if holding = 0 and CondA then buyshort( 1 , 2 , limitr,  open   * mindiff ), ignorecheckprice ;
             
             if holding = -2 or holding = 0 and CondB then buyshort( 1 , 2 , limitr,  open   * mindiff ), ignorecheckprice ;

end

这样造成的问题就是,,,条件 CondB 满足之后,,一下子进 4 手, 我只想要进2手,怎么改,,也就是说,不过有没有持仓, 条件Cond B 进场 就 2 手,只进场一次

                          条件Cond A 进场的前提是 空仓

麻烦老师帮忙理清一下表达思路,,,谢谢


2楼
wenarm 发表于:2017/4/7 15:43:07

你的需求表述总结

1,在没有仓位时,并且CondA成立则开仓,若cond2 满足则加仓2手。

2.condB满足就开仓2手。

 

如果上述理解没有问题就是

if condA and HOLDING=0 then buy();
if cond2 then buy();

if condB  then buy();

共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.00000 s, 3 queries.