以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请老师帮忙写个移动止损  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=99935)

--  作者:fkeeqg
--  发布时间:2016/7/1 14:30:25
--  请老师帮忙写个移动止损
多或空开仓后亏2%止损,盈利3%以上后把止损移致成本价。。。盈利超3%以上后回撤未到成本价不止盈(损)。
[此贴子已经被作者于2016-7-1 14:31:38编辑过]

--  作者:jinzhe
--  发布时间:2016/7/1 14:47:29
--  

if holding>0 and c<=enterprice*0.98 then sell(1,0,market);

if holding<0 and c>=enterprice*1.02 then sellshort(1,0,market);

 

if holding>0 and hhv(h,enterbars+1)>=enterprice*1.03 and c<enterprice then sell(1,0,market);

if holding<0 and llv(l,enterbars+1)<=enterprice*0.97 and c>enterprice then sellshort(1,0,market);