以文本方式查看主题

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

--  作者:whong
--  发布时间:2015/6/24 15:50:43
--  这样止损怎么写
请问一下老师几个止损止赢的问题

1.多头开仓 亏损  20 就止损 。   多头开仓 赢利 1% 就  止赢。
   空头开仓  亏损 20 就止损。    空头开仓  赢利 1%  就止赢

2.(多空)开仓 在N个周期后,如果赢利持有, 亏损就止损



--  作者:jinzhe
--  发布时间:2015/6/24 15:53:40
--  

if holding>0 and l<enterprice-20 then sell(1,0,market);

if holding<0 and h>enterprice+20 then sellshort(1,0,maarket);

 

if holding>0 and h>enterprice*1.01 then sell(1,0,market);

if holding<0 and l<enterprice*0.99 then sellshort(1,0,market);

 

if enterbars>n and openprofit<0  and holding>0 then sell(1,0,market);

if enterbars>n and openprofit<0 and holding<0 then sellshort(1,0,market);


--  作者:whong
--  发布时间:2015/6/25 10:16:07
--  
十分谢谢jinzhe老师帅哥,在线噢!