Logic problem -- missing initial signal after filter

  •  04-06-2007, 0:31

    Logic problem -- missing initial signal after filter

    The following will tell me when a signal is in effect:

    Code:

    Buy:=Cross(RSI(14),30);
    Sell:=Cross(70,RSI(14));
    init:=Cum(IsDefined(Buy+Sell))=1;
    flag:=ValueWhen(1,Buy-Sell<>0,Buy)*2-1;
    flag;

    But, when I try to filter for redundant signals, the following is missing the 1st signal:

    Code:

    Buy:=Cross(RSI(14),30);
    Sell:=Cross(70,RSI(14));
    init:=Cum(IsDefined(Buy+Sell))=1;
    flag:=ValueWhen(1,Buy-Sell<>0,Buy)*2-1;
    If(flag<>Ref(flag,-1),flag,0);

    Can anyone suggest a fix?  Thanks!

     


    --Johnathan
View Complete Thread