以文本方式查看主题

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

--  作者:宁静致远1
--  发布时间:2016/8/16 14:36:13
--  [求助]回撤20点平仓
老师,回撤20点平仓怎么表达
--  作者:jinzhe
--  发布时间:2016/8/16 14:51:01
--  

要分为多和空

多:

if holding>0 and c<hhv(h,enterbars+1)-20 and enterbars>0 then sell(1,0,market);

空:

if holding<0 and c>llv(l,enterbars+1)+20 and enterbars>0 then sellshort(1,0,market);

 

要注意这两句一定要写在开仓语句后面,不然enterbars会判断出错

 

 


--  作者:宁静致远1
--  发布时间:2016/8/16 14:51:24
--  
多单,最高收盘价回撤20点,空单最低收盘价回撤20点
--  作者:jinzhe
--  发布时间:2016/8/16 14:54:00
--  
要用最高收盘价和最低收盘价,那么这样改:hhv(c,enterbars+1)和llv(c,enterbars+1)