Indicator · Pine Script v5 · On the chart

CBC Flip

by theonetrade· code credited to ️ friksa & AsiaRoo

CBC Flip is a price action indicator that tracks market sentiment based on single-bar breakout logic.

View on GitHub

GitHub stars34on the repository
Pine versionv5runs as is
Lines of code22
Settings0inputs
LicenceMIT
Last update2 weeks ago8 Nov 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

22 lines of Pine Script v5 from assets/indicator/bit-exact/cbc_flip_r9fHTyuj.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

cbc_flip_r9fHTyuj.pine
// This Pine Script™️ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// ©️ friksa & AsiaRoo

//@version=5
indicator("CBC Flip", timeframe = "", timeframe_gaps = true, overlay = true)

cbc = false
cbc := cbc[1]
if cbc and close < low[1]
    cbc := false
if not cbc and close > high[1]
    cbc := true

plotshape(not cbc and cbc[1], style=shape.triangledown, location=location.abovebar, color=color.rgb(228, 102, 102), size=size.small, title='Bears', display=display.all - display.status_line)
plotshape(cbc and not cbc[1], style=shape.triangleup, location=location.belowbar, color=color.rgb(120, 206, 176), size=size.small, title='Bulls', display=display.all - display.status_line)


// Background colour
bgcolor(cbc and not cbc[1] ? color.rgb(255, 235, 59, 71)  : not cbc and cbc[1] ? color.rgb(5, 185, 240, 59) : na) 

alertcondition(not cbc and cbc[1], 'Bears', 'Bears in Control')
alertcondition(cbc and not cbc[1], 'Bulls', 'Bulls in Control')

Overview

CBC Flip maintains a state variable that switches to bullish when the closing price exceeds the previous bar's high, and flips to bearish when the closing price drops below the previous bar's low. Operating directly on the main price chart, it plots green upward triangles below bars for bullish turns and red downward triangles above bars for bearish turns, alongside temporary background highlights and customizable alert conditions.

Details

Published by

theonetrade on GitHub

Code credit

️ friksa & AsiaRoo, as written in the script's header

Draws

On the price chart

Category

Trend, Breakout

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Sideway Zones Live

by dearvn
257 stars

Sideway Zones Live is an overlay indicator that estimates inner and outer sideways bands from recent highs and lows with a rational quadratic kernel. It tracks swing pivots over a loopback period and counts bars that remain between the outer high and low. Afte

Indicator v5 TrendSupport & resistance
Updated 2 months ago · None stated GitHub repository of Sideway Zones Live
114 stars

This indicator adapts Michael Chalek's Dual Thrust trading concept to plot breakout levels and overlay bands directly on the price chart. It calculates lookback ranges based on historical price action and provides two algorithmic variations along with multiple

Indicator v4 TrendBreakout Repaints
Updated 2 years ago · None stated GitHub repository of Dual Thrust Trading Algorithm
56 stars

This indicator calculates dynamic upper and lower trendlines from pivot highs and pivot lows across a specified bar length. Trendline slopes are derived using ATR, standard deviation, or linear regression methods. It plots trendlines and breakout signal labels

Indicator v5 TrendSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Trendlines With Breaks [LUX]

Reversal Breakout System

by TamaraKGreen
47 stars

This indicator detects inside candles inside larger parent candles on the price chart. It plots colored boxes around inside and parent candles, fills them with user-adjustable transparency, draws Fibonacci retracement lines and mother candle range lines, and d

Indicator v6 Candlestick patternsBreakout
Updated 2 months ago · None stated GitHub repository of Reversal Breakout System

The Mathematical Indicator calculates session bias by evaluating previous daily and 4-hour closed candles. It draws timeframe support and resistance levels using candle bodies, highlights clean trading zones, and identifies setup patterns involving consolidati

Indicator v6 TrendSupport & resistance Repaints
Updated 3 days ago · MIT GitHub repository of The Mathematical Indicator · 2-Candle Bias

RSC Trend Trading Study

by readysetcryptocodes
43 stars

This indicator plots Donchian Channels alongside fast and slow simple moving averages directly on the price chart. It generates bullish breakout signals when the high reaches the upper channel while the close is above the 50 SMA (and optionally the 200 SMA). B

Indicator v4 TrendBreakout
Updated 2 years ago · None stated GitHub repository of RSC Trend Trading Study

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers