以文本方式查看主题

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

--  作者:yhl99414
--  发布时间:2014/12/25 21:57:55
--  给朋友编个程序
 价格高于开盘价1个点时,做多,0.8个点止盈


价格低于开盘价1个点时,做空,0.8个点止盈



开仓后,不管是多还是空,都在止损1个点的位置反手,反手后止盈仍然是0.8个点。 

没有止损止盈则在收盘清仓。



--  作者:jinzhe
--  发布时间:2014/12/26 9:06:13
--  

oo:=valuewhen(todaybar=1,open);

if h>oo+1 then buy(holding=0,1,market);

if l<oo-1 then buyshort(holding=0,1,market);

 

if holding>0 and h>enterprice+0.8 then sell(1,0,market);

 

if holding<0 and l<enterprice-0.8 then sellshort(1,0,market);

 

if holding>0 and l<enterprice-1 then begin

     sell(1,0,market);

     buyshort(holding=0,1,market);

end

 

if holding<0 and h>enterprice+1 then begin

    sellshort(1,0,market);

    buy(holding=0,1,market);

end