Skip to content
Prev 4500 / 15274 Next

Preventing active-neutral-active bouncing signals by staying neutral

The rules are not clear but maybe this code will help in
constructing whatever it is. newstate takes the current state
and action and produces the new state from those two such
that the state is the signed number of signals in the current
direction (since the last signal in the other direction).

newstate <- function(state, action) {
	if (action == 0) state
	else if (action * state > 0) state <- state+action
	else action
}
Reduce(newstate, coredata(x), 0, acc = TRUE)
On Wed, Jul 8, 2009 at 6:38 AM, <Murali.MENON at fortisinvestments.com> wrote: