以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教:在程序运行时,当总资产亏损达到1%时,就全部平仓,怎么写?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=73583)

--  作者:向日葵
--  发布时间:2014/12/26 9:58:56
--  请教:在程序运行时,当总资产亏损达到1%时,就全部平仓,怎么写?
请教:在程序运行时,当总资产亏损达到1%时,就全部平仓,怎么写?
--  作者:pyd
--  发布时间:2014/12/26 10:10:45
--  

VARIABLE:a=0;
if date<>ref(date,1) then a:=asset;
if 开仓条件 then buy(1,1,market);

if a-asset>=0.01*a then  sell(holding>0,holding,market);