Use the ExRemSpan function: Buy = ExRemSpan(condition1, 6);
However, it depends on exactly what you want. This fixes what you describe as the problem, but doesn't match your proposed solution. Your problem indicates you want to ignore any more signals for the next six bars after a signal, but your solution is looking for a signal that is not preceded by any other signals for the previous bars. If you do want the latter option, then I think your statement below should work with a little correcting: buy=condition1 and ref(condition1,-1)==0 and ref(condition1,-2)==0 and and ref(condition1,-3)==0 and ref(condition1,-4)==0. Unless Buy has already been set to condition1 before this, then you can't test Buy within this statement. And secondly, you need the '==' operator for comparison. Single '=' is an assignment operator. GP --- In [email protected], "Padhu" <[EMAIL PROTECTED]> wrote: > > Folks, > > Say i have buy = condition1; > Alert gets generated...Now few bars later again condition1 matches and another alert gets generated. > So i'd like add a filter that says Buy=condition1 and this is the first Buy in the past six bars so that buy signals don't repeat every other bar if the condition matches. > > I tried something like this > > buy=condition1 and ref(buy,-1)=0 and and ref(buy,-2)=0 and and ref(buy,-3)=0 and and ref(buy,-4)=0. > > But its not working. > > How do I code this in AB 4.9?. Thanks. > > cheers,Padhu >
