以文本方式查看主题

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

--  作者:acerap
--  发布时间:2012/6/1 9:59:30
--  资金管理
谁会写资金亏损额度达到开仓前总资金的5%是自动平仓?
--  作者:jinzhe
--  发布时间:2012/6/1 10:17:07
--  

if c>enterprice*1.05 then sellshort(holding<0,0,market);

if c<enterprice*0.95 then sell(holding>0,0,market);


--  作者:acerap
--  发布时间:2012/6/1 10:21:08
--  
我不是满仓打,比如说我开40%的仓,这40%的仓亏损达到总资金的5%时系统自动平仓,然后下次按照资金的95%继续40%开仓计算
--  作者:jinzhe
--  发布时间:2012/6/1 13:22:35
--  
想不出了。。。等高人解答
--  作者:zg611029
--  发布时间:2012/6/4 10:01:09
--  

r1:=barslast(holding<>0);

r2:=ref(asset,r1);

if asset/r2<0.95 then

   begin

   sell(holding>0,0,thisclose);

   sellshort(holding<0,0,thisclose);

   end

 

 

自己调试一下

 

用下列可能更好(固定轮询,高频扫描)

r1:=barslast(holding<>0);

r2:=ref(asset,r1);

if asset/r2<0.95 then

begin

sell(holding>0,0,limitr,c);

sellshort(holding<0,0,limitr,c);

end

[此贴子已经被作者于2012-6-4 10:04:41编辑过]