以文本方式查看主题

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

--  作者:lnjsqh
--  发布时间:2014/4/2 10:42:21
--  [求助]判断

if a and m then begin
平空:SELLSHORT(h>mm,ss,LIMITR,max(o,mm));  
开多:BUY(h>mm AND HOLDING=0,ss,LIMITR,max(o,mm));
end

 

单根K线上出现信号后进行平空开多操作,代码如上,这个没什么问题

我想解决的是是在开多后再进行一次判断,

条件是开多后如果本周期收盘价大于进场价格就继续持仓,如果小于进场价格,就以本周期收盘价平仓,请问如何实现?



--  作者:jinzhe
--  发布时间:2014/4/2 10:52:58
--  

if a and m then begin
平空:SELLSHORT(h>mm,ss,LIMITR,max(o,mm));  
开多:BUY(h>mm AND HOLDING=0,ss,LIMITR,max(o,mm));

 if enterbars=0 and c<enterprice then 平多:sell(1,ss,thisclose);
end


--  作者:lnjsqh
--  发布时间:2014/4/2 11:05:09
--  

非常感谢