以文本方式查看主题

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

--  作者:threefootcat
--  发布时间:2015/2/12 23:02:17
--  请教大家几个止损条件的写法
  1. 目标周期在开仓后 10 周期后,无论涨跌都平仓 
  2. 目标利润:在开仓后利润率到 15% 平仓 
  3. 最大损失 :在开仓后,损失达到 6% 平仓 
  4. 横盘平仓 : 与开仓后相比在 8 周期内有利幅度小于 4% 平仓
  5. 回吐平仓:与开仓利润相比,最高价位回吐 8% 平仓 
  6. 资产平仓:浮动亏损占总资产 20% 后全部平仓

--  作者:jinzhe
--  发布时间:2015/2/13 8:55:12
--  

1 if enterbars>10 then begin

    sell(1,0,marketr);

    sellshort(1,0,marketr);

   end

 

2 此测评功能无法用代码实现

 

3 if holding>0 and (enterprice-c)/c>0.06 then sell(1,0,marketr);

   if holding<0 and (c-enterprice)/enterprice>0.06 then sellshort(1,0,marketr);

 

4 此测评功能无法用代码实现

 

5 if holding>0 and (hhv(h,enterbars+1)-c)/c>0.08 then sell(1,0,marketr);

   if holding<0 and (c-llv(l,enterbars+1))/llv(l,enterbars+1)>0.08  then sellshort(1,0,marketr);

 

6 if openprofit<0 and abs(openprofit)/asset>0.2 then begin

      sell(1,0,marketr);

      sellshort(1,0,marketr);

  end