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