OPEN-SOURCE SCRIPT

CBC Flip - Volume Profile Context

177
CBC Flip - Volume Profile Context answers two questions at once: who is in control of the tape right now, and where did that control change hands relative to value.

The control engine is the Candle-By-Candle (CBC) method popularized by maplestax. When a candle closes above the previous candle's high, bulls take control. When a candle closes below the previous candle's low, bears take control. When neither happens, whoever held control keeps it. That hysteresis is the point: it ignores the noisy up-down flicker of individual candles and only acknowledges confirmed closes beyond the prior candle's range.

What this script adds is location. It builds a rolling master volume profile of the trailing window (point of control and value area, calculated as described below), and then keeps only the two control changes that interact with that profile:

BRK - value-area breakout. A bull flip that closes above mVAH, or a bear flip that closes below mVAL: control changed hands where price is being accepted beyond value. The initiative read. A breakout whose flip close is already extended more than 10 percent of the edge-to-POC distance past the edge is hidden as too-late chase noise (the "BRK: max extension past the edge" setting tunes or disables this).

REV - mean reversion. A bull flip from the mVAL side of value, or a bear flip from the mVAH side: responsive activity turning price back toward the master POC. A short dotted guide from the flip price to the current mPOC shows the level the reversion leg is rotating toward. It is a structural readout, not a target.

Everything else - a flip in the dead zone between the POC and the value edge on its own side - is balanced-market noise and is hidden by default ("Show in-value (VA) flips" in the settings brings those back), so every marker you see is structurally tied to the profile.

The same signal never prints twice in a row. A second BRK-long straight after a BRK-long is the same information repeated, so it is suppressed; a signal of the other class or direction re-arms it.

A tilde suffix (~) means the flip fired into an absorbed, two-sided volume node - a price zone where heavy trade has already gone both ways and the flow that would power a follow-through has largely exhausted itself.

What It Draws

Flip labels - a triangle at each control change that matters, tagged BRK or REV. Bright green or red marks a value-area breakout; softer tones mark the reversion case.

REV guide - on a reversion flip, a dotted line from the flip price to the master POC. The target end tracks the POC live as it moves, and the guide disappears on its own when the rotation is finished (price reaches the POC) or has failed (price breaks the flip candle's high or low, or the opposite signal fires). A structural readout, not a target line.

Invalidation dash - while bulls hold control, a dashed line sits at the low of the candle that flipped them in; while bears hold, at the flip candle's high. That is the price a confirmed close beyond would break the structure that armed the current state.

Master profile levels - mPOC (the price the window traded the most volume at), mVAH and mVAL (the edges of the 70 percent value area), each tagged with its live node state: an up or down arrow while one side's flow dominates the node, a tilde when the node has gone balanced and heavily traded (absorbed), flat otherwise.

Optional bar tint - bars can be tinted by the current control state. Off by default.

How the Profile Is Calculated

Over a trailing window (default 100 bars x a 3x master multiplier), 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 equal bins (default 40), each sample drops into its bin, and the fullest bin is the POC. The value area grows outward from the POC, always taking the heavier adjacent bin, until it encloses the configured share of total volume (default 70 percent, the market-profile convention).

This is a bar-resolution profile, not a tick-resolution one. On most forex and CFD feeds the volume figure is tick volume - a count of price updates, not executed contracts - so read it as a map of activity rather than a ledger of size. That is a property of the data feed, not a setting.

Repaint Policy

Flips register only on confirmed bar closes, strictly beyond the prior candle's high or low (equal closes do not flip), and only when control actually changes hands - continuation breaks in the direction already in control print nothing, which is what keeps the chart readable. By default a flip candle must also close in the flip direction (green for a bull flip, red for a bear flip); switch that off for the bare canonical engine. An optional ATR filter can additionally require the flip candle to have a minimum range. Node states update on confirmed bars only. Labels, once printed, are never moved or removed by later price action.

Settings (defaults as published)

CBC engine - strict breaks (on), minimum flip-candle range in ATR (0 = off), flip candle must close in the flip direction (on), invalidation dash (on), show in-value VA flips (off), BRK maximum extension past the edge (10 percent of the edge-to-POC distance, 0 = off), REV guide to mPOC (on).

Volume profile context - local window 100 bars, master window 3x local (300 bars), 40 price bins, value area 70 percent.

Visuals - master profile levels (on), flip labels (on), bar tint by control state (off).

Alerts - two alert conditions, CBC bull flip and CBC bear flip. They fire on bar close, only for the flips that are displayed.

Limitations

- Bar-resolution profile: each bar contributes one hlc3 sample, so the levels are coarser than a tick-built profile.
- Tick volume on most forex and CFD feeds; two brokers' feeds can disagree.
- The master levels describe the trailing window only and move as the window rolls forward.
- A flip is only known when its candle closes, so it always prints after the move that caused it has started.
- Node states (arrow / tilde / flat) are a synthetic estimate from bar shape, not order flow.

What It Is Not

This indicator does not trade, does not place or suggest orders, and does not draw entries, stops, or targets. It is a passive readout of control and location for your own study. Nothing here is financial advice, and a flip label is not a recommendation to buy or sell.

Disclaimer

This script is a technical indicator and charting tool. It is NOT financial advice, NOT investment advice and NOT a recommendation to enter or exit any position. Trading leveraged products such as CFDs and forex carries a high level of risk and you may lose more than your initial deposit. You are solely responsible for your own trading decisions and their outcomes.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.