以文本方式查看主题

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

--  作者:厦门股指期货
--  发布时间:2011/4/1 16:39:35
--  代码错误
开多 BUY((CLOSE-CB2)<15,10,THISCLOSE),TFILTER 提示说左括号不完整
--  作者:董小球
--  发布时间:2011/4/1 17:00:43
--  
应该是你最后少了分号的缘故
--  作者:fly
--  发布时间:2011/4/1 17:30:40
--  

TFILTER函数.

用于交易系统公式ENTERLONG, EXITLONG, ENTERSHORT, EXITSHORT后,以ENTER和EXIT为间隔,过滤连续的同种信号.

 

不要把TFILTER用于BUY系统过滤信号.

BUY系统的可以用HOLDING,可参考以下写法

//用于1分钟K线

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

a1:asset,linethick0;
if CROSS(ma5,ma15) and time>090100 and time<145000 then
begin
sellshort(holding<0,1,thisclose);
buy(holding=0,1,limit,c);
end

if CROSS(ma15,ma5) and time>090100 and time<145000 then
begin
sell(holding>0,1,thisclose);
buyshort(holding=0,1,limit,c);
end

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

[此贴子已经被作者于2011-4-1 17:30:59编辑过]