以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  这段代码不对吗  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=11028)

--  作者:aagg4107
--  发布时间:2012/4/11 15:00:30
--  这段代码不对吗

{if a then begin
 sellshort(holding<0,0,market);
 end
 if b  then begin
 sell(holding>0,0,market);
 end}

金字塔的先平后开这么回事,我不平难道就不能开仓了??


--  作者:jinzhe
--  发布时间:2012/4/11 15:02:11
--  
对,先平后开
--  作者:rushtaotao
--  发布时间:2012/4/11 15:35:07
--  

holding返回没有仓位,为0,程序无法检测到持仓,所以没办法先平。

只有你程序买了1手,holding成了1,程序能检测到了,才给你平

原理就是这样