以文本方式查看主题

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

--  作者:sjz123
--  发布时间:2016/9/30 16:38:25
--  加仓问题
平仓为亏损,则开仓手数x=x+1,怎么写。
--  作者:jinzhe
--  发布时间:2016/10/8 8:50:15
--  

variable:ss=1;//开仓手数为ss手

if 平多条件 and holding>0 then begin

  sell(1,0,market);

  if numprofit(1)<0 then ss:=ss+1;

end

 

if 平空条件 and holding<0 then begin

  sellshort(1,0,market);

  if numprofit(1)<0 then ss:=ss+1;

end