以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  新交易系统下,平仓前出现多个买入信号  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9868)

--  作者:kingmoonwang
--  发布时间:2012/2/8 12:38:49
--  新交易系统下,平仓前出现多个买入信号

新交易系统下,平仓前出现多个买入信号,怎样才能只确认第一个,忽略其他信号直到平仓再开。


--  作者:fly
--  发布时间:2012/2/8 13:21:07
--  

开仓条件中加入HOLDING=0,限制只有在没有仓位时才开仓

以下为简单示例,供参考.

如果您刚接触金字塔,推荐您多看看"帮助"菜单下的内容,如:视频教程和文档教程

 

ma5:ma(close,5);
ma15:ma(close,15);

if CROSS(ma5,ma15) and time>093000 and time<151000 then
begin
sellshort(holding<0,1,market);
buy(holding=0,1,limit,c+2*mindiff);
end

if CROSS(ma15,ma5) and time>093000 and time<151000 then
begin
sell(holding>0,0,market);
buyshort(holding=0,1,limit,c-2*mindiff);
end

 

//收盘前5分钟平仓
if time > 151000 then
 begin
 sell(holding > 0, 0, thisclose);
 sellshort(holding < 0, 0, thisclose);
 end


--  作者:kingmoonwang
--  发布时间:2012/2/8 15:42:03
--  
多谢