[ {"op": "source", "role": "price", "kind": "F64"}, {"op": "add", "type": "SMA", "name": "fast", "bind": {"length": {"I64": 2}}}, {"op": "add", "type": "SMA", "name": "slow", "bind": {"length": {"I64": 8}}}, {"op": "feed", "role": "price", "into": ["fast.series", "slow.series"]}, {"op": "add", "type": "Gt", "name": "above"}, {"op": "connect", "from": "fast.value", "to": "above.a"}, {"op": "connect", "from": "slow.value", "to": "above.b"}, {"op": "add", "type": "Sub", "name": "spread"}, {"op": "connect", "from": "fast.value", "to": "spread.lhs"}, {"op": "connect", "from": "slow.value", "to": "spread.rhs"}, {"op": "add", "type": "Sign", "name": "dir"}, {"op": "connect", "from": "spread.value", "to": "dir.value"}, {"op": "add", "type": "Const", "name": "one", "bind": {"value": {"F64": 1.0}}}, {"op": "add", "type": "Const", "name": "negone", "bind": {"value": {"F64": -1.0}}}, {"op": "feed", "role": "price", "into": ["one.clock", "negone.clock"]}, {"op": "add", "type": "When", "name": "gated"}, {"op": "connect", "from": "one.value", "to": "gated.value"}, {"op": "connect", "from": "above.value", "to": "gated.gate"}, {"op": "add", "type": "CumSum", "name": "count_above"}, {"op": "connect", "from": "gated.value", "to": "count_above.series"}, {"op": "add", "type": "CumSum", "name": "count_all"}, {"op": "connect", "from": "one.value", "to": "count_all.series"}, {"op": "add", "type": "Select", "name": "mux"}, {"op": "connect", "from": "above.value", "to": "mux.cond"}, {"op": "connect", "from": "one.value", "to": "mux.then"}, {"op": "connect", "from": "negone.value", "to": "mux.otherwise"}, {"op": "add", "type": "Bias", "name": "bias", "bind": {"scale": {"F64": 1.0}}}, {"op": "connect", "from": "dir.value", "to": "bias.signal"}, {"op": "expose", "from": "bias.bias", "as": "bias"} ]