连续信号过滤
代码片段(通达信):
{过滤前的买卖信号}
BUY:= 你的买进信号;
SELL:= 你的卖出信号;
B2:=BARSLAST(BUY);
S2:=BARSLAST(SELL);
{过滤多余买卖信号的条件}
FBUY:=CROSS(S2,B2);
FSELL:=CROSS(B2,S2);
过滤后的买进信号:= BUY AND FBUY;
过滤后的卖出信号:= SELL AND FSELL;
示例代码:
过滤前:C;
{过滤前的买卖信号}
BUY:= C>REF(C,1)*1.05;
SELL:= C<REF(C,1)*0.97;
B2:=BARSLAST(BUY);
S2:=BARSLAST(SELL);
{过滤多余买卖信号的条件}
FBUY:=CROSS(S2,B2);
FSELL:=CROSS(B2,S2);
BUYNEW:= BUY AND FBUY;
SELLNEW:= SELL AND FSELL;
过滤后: 过滤前+5;
DRAWICON(BUYNEW,过滤后,1);
DRAWICON(SELLNEW,过滤后,2);
DRAWICON(BUY, 过滤前,1);
DRAWICON(SELL, 过滤前,2);