Indicator · Pine Script v6 · On the chart

Daily Bias Indicator

by Timonkru

Daily Bias Indicator evaluates price relative to the previous day's high, low, and midpoint, along with the opening range breakout to compute a directional score.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code94
Settings9inputs
LicenceMIT
Last update9 months ago20 Feb 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

94 lines of Pine Script v6 from daily-bias-indicator.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

daily-bias-indicator.pine
//@version=6
indicator("Daily Bias Indicator", overlay=true, max_lines_count=500, max_labels_count=500)

// === INPUTS ===
showPDHL     = input.bool(true, "Show Previous Day High/Low")
showOR       = input.bool(true, "Show Opening Range")
orMinutes    = input.int(30, "Opening Range Minutes", minval=5, maxval=120)
tz           = input.string("Europe/Berlin", "Timezone")
pdHighColor  = input.color(color.new(color.green, 40), "PD High Color")
pdLowColor   = input.color(color.new(color.red, 40), "PD Low Color")
orColor      = input.color(color.new(color.aqua, 60), "OR Color")
bullColor    = input.color(color.new(color.green, 85), "Bullish Bias BG")
bearColor    = input.color(color.new(color.red, 85), "Bearish Bias BG")

// === PREVIOUS DAY DATA ===
pdHigh = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_on)
pdLow  = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_on)
pdClose = request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)
pdMid  = (pdHigh + pdLow) / 2

// === OPENING RANGE ===
isNewDay = ta.change(time("D")) != 0
var float orHigh = na
var float orLow = na
var bool orComplete = false
var int dayBarCount = 0

if isNewDay
    orHigh := high
    orLow := low
    orComplete := false
    dayBarCount := 1
else
    dayBarCount += 1

// Calculate bars in OR period
barsInOR = math.ceil(orMinutes / timeframe.multiplier)

if not orComplete and dayBarCount <= barsInOR
    orHigh := math.max(nz(orHigh, high), high)
    orLow := math.min(nz(orLow, low), low)

if dayBarCount > barsInOR and not orComplete
    orComplete := true

// === BIAS CALCULATION ===
abovePDH  = close > pdHigh
belowPDL  = close < pdLow
abovePDM  = close > pdMid
aboveOR_H = orComplete and close > orHigh
belowOR_L = orComplete and close < orLow

// Bias scoring: +1 bullish, -1 bearish per condition
biasScore = 0
biasScore += abovePDH ? 1 : (belowPDL ? -1 : 0)
biasScore += abovePDM ? 1 : -1
biasScore += aboveOR_H ? 1 : (belowOR_L ? -1 : 0)

biasText = biasScore >= 2 ? "BULLISH" : biasScore <= -2 ? "BEARISH" : "NEUTRAL"
biasClr  = biasScore >= 2 ? color.green : biasScore <= -2 ? color.red : color.gray

// === PLOTS ===
plot(showPDHL ? pdHigh : na, "PD High", pdHighColor, 1, plot.style_stepline)
plot(showPDHL ? pdLow : na, "PD Low", pdLowColor, 1, plot.style_stepline)
plot(showPDHL ? pdMid : na, "PD Mid", color.new(color.gray, 50), 1, plot.style_stepline)
plot(showOR and orComplete ? orHigh : na, "OR High", orColor, 1, plot.style_stepline)
plot(showOR and orComplete ? orLow : na, "OR Low", orColor, 1, plot.style_stepline)

// Background tint
bgcolor(biasScore >= 2 ? bullColor : biasScore <= -2 ? bearColor : na)

// === INFO TABLE ===
var table t = table.new(position.top_right, 2, 7, border_width=1)
if barstate.islast
    table.cell(t, 0, 0, "Daily Bias", text_color=color.yellow, bgcolor=color.new(color.black, 70), text_size=size.small)
    table.cell(t, 1, 0, biasText, text_color=biasClr, bgcolor=color.new(color.black, 70), text_size=size.small)

    table.cell(t, 0, 1, "PD High:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 1, str.tostring(pdHigh, format.mintick), text_color=pdHighColor, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 2, "PD Low:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 2, str.tostring(pdLow, format.mintick), text_color=pdLowColor, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 3, "PD Mid:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 3, str.tostring(pdMid, format.mintick), text_color=color.gray, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 4, "OR High:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 4, orComplete ? str.tostring(orHigh, format.mintick) : "building...", text_color=orColor, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 5, "OR Low:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 5, orComplete ? str.tostring(orLow, format.mintick) : "building...", text_color=orColor, bgcolor=color.new(color.black, 70), text_size=size.tiny)

    table.cell(t, 0, 6, "Score:", text_color=color.white, bgcolor=color.new(color.black, 70), text_size=size.tiny)
    table.cell(t, 1, 6, str.tostring(biasScore) + "/3", text_color=biasClr, bgcolor=color.new(color.black, 70), text_size=size.tiny)

Overview

Daily Bias Indicator plots step lines for previous day levels and opening range boundaries directly on the price chart. The background fills with color when bias criteria reach bullish or bearish thresholds. An on-chart dashboard table summarizes current levels and the overall daily bias direction.

Details

Published by

Timonkru on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

M1-M5, M15-H1

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.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show Previous Day High/LowbooltrueshowPDHL
Show Opening RangebooltrueshowOR
Opening Range Minutesint30orMinutes
TimezonestringEurope/Berlintz
PD High Colorcolorcolor.new(color.green, 40)pdHighColor
PD Low Colorcolorcolor.new(color.red, 40)pdLowColor
OR Colorcolorcolor.new(color.aqua, 60)orColor
Bullish Bias BGcolorcolor.new(color.green, 85)bullColor
Bearish Bias BGcolorcolor.new(color.red, 85)bearColor
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

IB / ORB Live Stats

by TamaraKGreen
47 stars

This overlay indicator marks the New York initial balance and a configurable opening range on the price chart and reports live range statistics in two tables. It builds an IB box for a default 09:30–10:30 ET window, an ORB box from 09:30 for a set number of mi

Indicator v6 Sessions & timeBreakout
Updated 2 months ago · None stated GitHub repository of IB / ORB Live Stats
34 stars

This indicator calculates and plots multi-stage Opening Range Breakout high, low, and mid-range levels for 5, 15, 30, and 60 minute intervals on the price chart. It draws shaded range boxes and labels breakouts, retests, and failed breaks with cycle counting,

Indicator v6 BreakoutSessions & time
Updated 2 weeks ago · MIT GitHub repository of Luxy BIG beautiful Dynamic ORB

ORB Pro - Research-Based ORB

by Mrshahidali420
16 stars

The ORB Pro indicator calculates and plots Opening Range Breakout levels, stop-loss and take-profit zones, signal labels, and an status dashboard on the price chart. Built on academic research, it evaluates trades using an opening-candle direction filter, open

Indicator v6 BreakoutSessions & time Repaints
Updated 4 months ago · None stated GitHub repository of ORB Pro - Research-Based ORB
575 stars

This indicator builds Market Profile Time Price Opportunity (TPO) structures across defined session timeframes directly on the main price chart. It visualizes the Point of Control (POC) and Value Area boundaries using dynamic box drawings. An integrated multi-

Indicator v5 Support & resistanceScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of Market Profile with Screener
257 stars

This indicator overlays an intraday SPX and ES chart with a midnight session range, regular-trading-hours opening levels, and a VWAP projection box. It draws the midnight high, mid, and low, flags edge rejections within an absolute tolerance, and plots optiona

Indicator v6 TrendSupport & resistance
Updated 2 months ago · None stated GitHub repository of SPX Midnight Box + Snag Logic

More Support & resistance 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