以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  策略编写求助区  (http://weistock.com/bbs/list.asp?boardid=11)
----  [原创]求高手帮助编写一下,先谢谢了!  (http://weistock.com/bbs/dispbbs.asp?boardid=11&id=11212)

--  作者:xiyue
--  发布时间:2012/4/21 21:39:39
--  [原创]求高手帮助编写一下,先谢谢了!

 

(注:开平仓按1手,非日内交易模型)


  空仓时 :15分钟macd 上穿0,买入开仓,
               15分钟macd 下穿0, 卖出开仓;
  持有多单时: 如果15分钟macd <0,如果最新价格低于开仓价格则平仓(止损);
                    如果60分钟macd下穿0 ,则立即平仓;
  持有空单时: 如果15分钟macd >0,如果最新价格高于开仓价格则平仓(止损);
                    如果60分钟macd上穿0,则立刻平仓


--  作者:zg611029
--  发布时间:2012/4/21 22:23:34
--  

r1:=stkindi(\'\',\'macd.macd1\',0,3);

r2:=stkindi(\'\',\'macd.macd1\',0,5);

 

if r1>0 then buy(holding=0,1,thisclose);

if r1<0 then buyshort(holding=0,1,thisclose);

if holding>0 and ((r1<0 and c<enterprice) or r2<0) then sell(1,1,thisclose);

if holding<0 and ((r1>0 and c>enterprice) or r2>0) then sellshort(1,1,thisclose);