以文本方式查看主题

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

--  作者:chyhao
--  发布时间:2014/11/25 10:52:52
--  清仓不再开仓的问题

如果最新的动态权益低于某个值或者目前账户总资产的某个百分数,则账户持仓全部清空并且策略不再开仓,这个应该怎么写呢?


--  作者:jinzhe
--  发布时间:2014/11/25 10:53:44
--  
处理中,请稍等
--  作者:pyd
--  发布时间:2014/11/25 10:59:08
--  

VARIABLE:n:=0;
if 开多条件 and n=0 then buy(holding=0,1,market);
if 开空条件 and n=0 then buyshort(holding=0,1,market);

if asset<x then begin
 sell(holding>0,holding,market);
  sellshort(holding<0,holding,market);
  n:=1;
  end