From a pattern you see to a rule you can test: the CBC Flip, step by step
· #rule-design #volume-profile #open-source #systematic-trading
"Buyers just took control." I said that sentence to myself thousands of times as a manual trader, and for years it was useless, because I could not tell you exactly what it meant.
Part 3 of 15: From discretionary to systematic
That is the gap this chapter is about. A pattern is something you see. A rule is something a computer can check without asking how you feel. Everything systematic starts with getting from one to the other, and most discretionary edges quietly disappear at exactly this step. That is information, not defeat.
I will walk through it with a real example: CBC Flip - Volume Profile Context, a script I published free and open source on TradingView under my profile, kenkemdayfx. It is the most liked of my scripts, and because the code is public I can show every input and every decision. The control engine is the Candle-By-Candle method popularised by maplestax. What I added is location.
Step 1: write the sentence down
Start with the plain-language version. "When buyers take control near the edge of value, something worth noticing is happening." It is vague, and that is fine. The job now is to remove every vague word, one at a time.
Step 2: define "took control"
In CBC, control changes hands on a close, not a touch. A candle that closes above the previous candle's high hands control to the bulls. A candle that closes below the previous candle's low hands it to the bears. If neither happens, whoever held control keeps it.
That last line is the clever part. It is hysteresis: the state ignores the up-down flicker of individual candles and only changes on a confirmed close beyond the prior range.
Then the edge cases, because a rule is mostly edge cases. With "strict breaks" on (the default), the close must be strictly beyond the prior high or low, and an equal close does not count. With "flip candle must close in the flip direction" on (also default), a bull flip needs a green candle and a bear flip a red one, which filters closes that technically broke the level while the candle itself was fading. An optional filter, off by default, can demand a minimum flip-candle range measured in ATR.
Step 3: only use what was knowable at the time
A rule that looks at information from the future is not a rule, it is a mistake you have not found yet. So flips register only on confirmed bar closes. Labels, once printed, are never moved or removed. Continuation breaks in the direction already in control print nothing.
Step 4: define "near the edge of value"
This needs a volume profile, and the profile needs exact construction. The script takes a trailing window, 100 bars local times a master multiplier of 3, so 300 bars by default. Every confirmed bar contributes its hlc3 as the price sample and its volume as the weight. The window's high-low range is split into 40 equal bins. The fullest bin is the point of control. The value area grows outward from it, always adding the heavier neighbouring bin, until it holds 70 percent of the volume, the market-profile convention.
Now location is a definition, and the flips split into classes. BRK: a bull flip that closes above mVAH, or a bear flip that closes below mVAL. Control changed hands where price is being accepted outside value. REV: a bull flip from the mVAL side, or a bear flip from the mVAH side, responsive activity turning price back toward the master point of control, drawn as a dotted guide to mPOC. Everything in the dead zone between the POC and the edge on its own side is hidden by default as balanced-market noise.
Step 5: define what "wrong" looks like
A rule without a failure condition is an opinion. While bulls hold control, the script draws a dashed line at the low of the candle that flipped them in. While bears hold, at its high. A confirmed close beyond that line breaks the structure that armed the state.
Step 6: remove the noise you already know about
Two filters. The same signal never prints twice in a row, because a second BRK long straight after the first is the same information repeated. And a breakout whose close is already more than 10 percent of the edge-to-POC distance beyond the edge is hidden as too-late chase.
Step 7: make it countable
Two alert conditions, bull flip and bear flip, fire on bar close and only for the flips that are displayed. Now the pattern produces a list of timestamps. A list can be counted, costed and compared against chance. A feeling cannot.
The honest limits
The profile is bar resolution, not tick resolution, so it is coarser than a tick-built one. On most forex and CFD feeds, gold included, "volume" is tick volume, a count of price updates, not executed contracts, and two brokers can disagree. A flip is only known when its candle closes, so it always prints after the move has started.
And one lesson from my own research that surprised me. That anti-chase filter makes the chart much more readable, so it stays in the free script. But when I tested a similar idea, declining entries that are far from the move's start, as a trading rule inside my MasterVP research, it went 0 for 4 formulations across 3 data feeds. A rule that cleans up a chart and a rule that adds edge are different jobs. Only a test tells you which one you wrote.
The takeaway
You dont need to be a programmer to do steps 1 to 6. You need a pen and the patience to answer "what exactly do I mean?" until nothing vague is left. The code is the easy part. The definitions are the work.
The script is free and the source is open, so read it, break it, and keep only what earns its place on your chart. My question for you: what is the one pattern you trade by eye that you have never managed to write down as a rule?
From discretionary to systematic, part 3 of 15.
Previous: Same chart, different decisions: what emotion does to a discretionary trader
Next: ATR is the unit: why every distance in my systems is measured in volatility
Part 3 of the From discretionary to systematic series, also published as an X Article. Educational purpose only. Not financial advice. Figures cited are backtest and research results unless stated as live, and past performance does not guarantee future results. Every trader remains responsible for their own risk settings and decisions.