Indicator · Pine Script v5 · On the chart

Weekly IB

by TamaraKGreen· code credited to notprofessorgreen

Weekly IB is an overlay indicator that tracks and visualizes the weekly initial balance levels on the main price chart.

View on GitHub

GitHub stars46on the repository
Pine versionv5runs as is
Lines of code366
Settings19inputs
LicenceNone statedfile: MPL-2.0
Last update7 weeks ago4 Sep 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

366 lines of Pine Script v5 from Weekly Initial Balance.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Weekly Initial Balance.txt
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © notprofessorgreen

//@version=5
indicator("Weekly IB", overlay = true, max_boxes_count = 500, max_labels_count = 500, max_lines_count = 500, max_bars_back = 5000)

//Beginning of the day every day
bod=input(true, title='Show beginning of the day', group = 'Day of week display')
t5 = time(timeframe.period, "1700-1701:1234567","America/New_York")
bgcolor(bod and t5 ? color.new(color.silver, 80) : na)

// Show stats option
show_stats = input(true, "Show statistics table", group="Hit Tracking")


//WHite for black background
showDOW = input(false, title='Dark background')
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.sunday : false, text='Beginning\nof week\nSunday', char = ".", color=color.new(color.white, 20), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.monday : false, text='Monday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.tuesday : false, text='Tuesday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.wednesday : false, text='Wednesday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.thursday : false, text='Thursday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.friday : false, text='Friday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)
plotchar(showDOW ? hour == 9 and minute == 0 and dayofweek == dayofweek.saturday : false, text='Saturday', char = ".", color=color.new(color.white, 50), location=location.bottom, offset=-10)

//Black for white background
showDOWB = input(true, title='Light background')
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.sunday : false, text='Beginning\nof week\nSunday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.monday : false, text='Monday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.tuesday : false, text='Tuesday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.wednesday : false, text='Wednesday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.thursday : false, text='Thursday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.friday : false, text='Friday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)
plotchar(showDOWB ? hour == 9 and minute == 0 and dayofweek == dayofweek.saturday : false, text='Saturday', char = ".", color=color.rgb(45, 46, 48, 11), location=location.bottom, offset=-10)


// Session Configuration
session  = input.session("2200-2100", title="Trading Session", group = 'Weekly IB settings')
timeZone = input.string("UTC", title="Time Zone",group = 'Weekly IB settings')
monSession = input.bool(true, title="Mon ", group="Weekly IB settings", inline="d1")
tueSession = input.bool(true, title="Tue ", group="Weekly IB settings", inline="d1")

// Function to get session low
SessionLow(sessionTime, sessionTimeZone=syminfo.timezone) =>
    insideSession = not na(time(timeframe.period, sessionTime, sessionTimeZone))
    var float sessionLowPrice = na
    if insideSession and not insideSession[1]
        sessionLowPrice := low
    else if insideSession
        sessionLowPrice := math.min(sessionLowPrice, low)
    sessionLowPrice

// Function to get session high
SessionHigh(sessionTime, sessionTimeZone=syminfo.timezone) =>
    insideSession = not na(time(timeframe.period, sessionTime, sessionTimeZone))
    var float sessionHighPrice = na
    if insideSession and not insideSession[1]
        sessionHighPrice := high
    else if insideSession
        sessionHighPrice := math.max(sessionHighPrice, high)
    sessionHighPrice

// Function to check if a bar is inside the session
InSession(sessionTimes, sessionTimeZone=syminfo.timezone) =>
    not na(time(timeframe.period, sessionTimes, sessionTimeZone))

// Make a string representing the session days
sessionDays = ""
if monSession
    sessionDays += "2"
if tueSession
    sessionDays += "3"

// Construct the session string by combining time and days
tradingSession = session + ":" + sessionDays

// Fetch the session low and high
sessLow = SessionLow(tradingSession, timeZone)
sessHigh = SessionHigh(tradingSession, timeZone)

// Check if we are currently in the session
inSession = InSession(tradingSession, timeZone)

// If we are in session, set the plot value to `na`, else plot the session low and high
plotLow = inSession ? na : sessLow
plotHigh = inSession ? na : sessHigh

// Function to calculate the midpoint (50% Fibonacci level)
get_fibonacci_midpoint(high_price, low_price) =>
    (plotHigh + plotLow) / 2

// Calculate 50% Fibonacci levels for each session
midpoint = get_fibonacci_midpoint(plotHigh, plotLow)

ib_range = plotHigh - plotLow


// Plot the session low, high & midpoint only after the session closes
plot(plotLow, color=color.rgb(177, 5, 5), title="Weekly IB Low", style=plot.style_steplinebr, linewidth = 2)
plot(plotHigh, color=color.rgb(4, 131, 93), title="Weekly IB High", style=plot.style_steplinebr, linewidth = 2)
plot(midpoint, color=color.rgb(79, 11, 189), title="Weekly IB 50%", style=plot.style_cross, linewidth = 1)

// Calculate measured moves

fib_levels = input(true, 'Show fib retracements', group="Fib settings") 
fib1 = input.float(0.3, 'Fib retracement level 1', group="Fib settings")
fib2 = input.float(0.7, 'Fib retracement level 1', group="Fib settings")

// Fibonacci Retracement Levels

fib_214 = plotHigh - fib1 * ib_range
fib_293 = plotHigh - fib2 * ib_range

// Plot the Fibonacci levels
plot(fib_levels ? fib_214 : na, color=color.rgb(4, 50, 201), title="Fib 21.4%", linewidth=1, style=plot.style_linebr)
plot(fib_levels ? fib_293 : na, color=color.rgb(4, 50, 201), title="Fib 29.3%", linewidth=1, style=plot.style_linebr)

// Stats

// Hit tracking arrays - adding fib levels
var float[] high_hits_sun = array.new_float(0)
var float[] high_hits_mon = array.new_float(0)
var float[] high_hits_tue = array.new_float(0)
var float[] high_hits_wed = array.new_float(0)
var float[] high_hits_thu = array.new_float(0)
var float[] high_hits_fri = array.new_float(0)
var float[] high_hits_sat = array.new_float(0)

var float[] low_hits_sun = array.new_float(0)
var float[] low_hits_mon = array.new_float(0)
var float[] low_hits_tue = array.new_float(0)
var float[] low_hits_wed = array.new_float(0)
var float[] low_hits_thu = array.new_float(0)
var float[] low_hits_fri = array.new_float(0)
var float[] low_hits_sat = array.new_float(0)

var float[] mid_hits_sun = array.new_float(0)
var float[] mid_hits_mon = array.new_float(0)
var float[] mid_hits_tue = array.new_float(0)
var float[] mid_hits_wed = array.new_float(0)
var float[] mid_hits_thu = array.new_float(0)
var float[] mid_hits_fri = array.new_float(0)
var float[] mid_hits_sat = array.new_float(0)

var float[] fib1_hits_sun = array.new_float(0)
var float[] fib1_hits_mon = array.new_float(0)
var float[] fib1_hits_tue = array.new_float(0)
var float[] fib1_hits_wed = array.new_float(0)
var float[] fib1_hits_thu = array.new_float(0)
var float[] fib1_hits_fri = array.new_float(0)
var float[] fib1_hits_sat = array.new_float(0)

var float[] fib2_hits_sun = array.new_float(0)
var float[] fib2_hits_mon = array.new_float(0)
var float[] fib2_hits_tue = array.new_float(0)
var float[] fib2_hits_wed = array.new_float(0)
var float[] fib2_hits_thu = array.new_float(0)
var float[] fib2_hits_fri = array.new_float(0)
var float[] fib2_hits_sat = array.new_float(0)

// Function to check if price hits a level
hit_level(level) =>
    high >= level and low <= level

// Track hits
new_day = dayofweek != dayofweek[1]
if new_day
    array.push(high_hits_sun, 0)
    array.push(high_hits_mon, 0)
    array.push(high_hits_tue, 0)
    array.push(high_hits_wed, 0)
    array.push(high_hits_thu, 0)
    array.push(high_hits_fri, 0)
    array.push(high_hits_sat, 0)
    array.push(low_hits_sun, 0)
    array.push(low_hits_mon, 0)
    array.push(low_hits_tue, 0)
    array.push(low_hits_wed, 0)
    array.push(low_hits_thu, 0)
    array.push(low_hits_fri, 0)
    array.push(low_hits_sat, 0)
    array.push(mid_hits_sun, 0)
    array.push(mid_hits_mon, 0)
    array.push(mid_hits_tue, 0)
    array.push(mid_hits_wed, 0)
    array.push(mid_hits_thu, 0)
    array.push(mid_hits_fri, 0)
    array.push(mid_hits_sat, 0)
    array.push(fib1_hits_sun, 0)
    array.push(fib1_hits_mon, 0)
    array.push(fib1_hits_tue, 0)
    array.push(fib1_hits_wed, 0)
    array.push(fib1_hits_thu, 0)
    array.push(fib1_hits_fri, 0)
    array.push(fib1_hits_sat, 0)
    array.push(fib2_hits_sun, 0)
    array.push(fib2_hits_mon, 0)
    array.push(fib2_hits_tue, 0)
    array.push(fib2_hits_wed, 0)
    array.push(fib2_hits_thu, 0)
    array.push(fib2_hits_fri, 0)
    array.push(fib2_hits_sat, 0)

// Record hits for current day
if hit_level(plotHigh)
    switch dayofweek
        dayofweek.sunday => array.set(high_hits_sun, array.size(high_hits_sun)-1, array.get(high_hits_sun, array.size(high_hits_sun)-1) + 1)
        dayofweek.monday => array.set(high_hits_mon, array.size(high_hits_mon)-1, array.get(high_hits_mon, array.size(high_hits_mon)-1) + 1)
        dayofweek.tuesday => array.set(high_hits_tue, array.size(high_hits_tue)-1, array.get(high_hits_tue, array.size(high_hits_tue)-1) + 1)
        dayofweek.wednesday => array.set(high_hits_wed, array.size(high_hits_wed)-1, array.get(high_hits_wed, array.size(high_hits_wed)-1) + 1)
        dayofweek.thursday => array.set(high_hits_thu, array.size(high_hits_thu)-1, array.get(high_hits_thu, array.size(high_hits_thu)-1) + 1)
        dayofweek.friday => array.set(high_hits_fri, array.size(high_hits_fri)-1, array.get(high_hits_fri, array.size(high_hits_fri)-1) + 1)
        dayofweek.saturday => array.set(high_hits_sat, array.size(high_hits_sat)-1, array.get(high_hits_sat, array.size(high_hits_sat)-1) + 1)

if hit_level(plotLow)
    switch dayofweek
        dayofweek.sunday => array.set(low_hits_sun, array.size(low_hits_sun)-1, array.get(low_hits_sun, array.size(low_hits_sun)-1) + 1)
        dayofweek.monday => array.set(low_hits_mon, array.size(low_hits_mon)-1, array.get(low_hits_mon, array.size(low_hits_mon)-1) + 1)
        dayofweek.tuesday => array.set(low_hits_tue, array.size(low_hits_tue)-1, array.get(low_hits_tue, array.size(low_hits_tue)-1) + 1)
        dayofweek.wednesday => array.set(low_hits_wed, array.size(low_hits_wed)-1, array.get(low_hits_wed, array.size(low_hits_wed)-1) + 1)
        dayofweek.thursday => array.set(low_hits_thu, array.size(low_hits_thu)-1, array.get(low_hits_thu, array.size(low_hits_thu)-1) + 1)
        dayofweek.friday => array.set(low_hits_fri, array.size(low_hits_fri)-1, array.get(low_hits_fri, array.size(low_hits_fri)-1) + 1)
        dayofweek.saturday => array.set(low_hits_sat, array.size(low_hits_sat)-1, array.get(low_hits_sat, array.size(low_hits_sat)-1) + 1)

if hit_level(midpoint)
    switch dayofweek
        dayofweek.sunday => array.set(mid_hits_sun, array.size(mid_hits_sun)-1, array.get(mid_hits_sun, array.size(mid_hits_sun)-1) + 1)
        dayofweek.monday => array.set(mid_hits_mon, array.size(mid_hits_mon)-1, array.get(mid_hits_mon, array.size(mid_hits_mon)-1) + 1)
        dayofweek.tuesday => array.set(mid_hits_tue, array.size(mid_hits_tue)-1, array.get(mid_hits_tue, array.size(mid_hits_tue)-1) + 1)
        dayofweek.wednesday => array.set(mid_hits_wed, array.size(mid_hits_wed)-1, array.get(mid_hits_wed, array.size(mid_hits_wed)-1) + 1)
        dayofweek.thursday => array.set(mid_hits_thu, array.size(mid_hits_thu)-1, array.get(mid_hits_thu, array.size(mid_hits_thu)-1) + 1)
        dayofweek.friday => array.set(mid_hits_fri, array.size(mid_hits_fri)-1, array.get(mid_hits_fri, array.size(mid_hits_fri)-1) + 1)
        dayofweek.saturday => array.set(mid_hits_sat, array.size(mid_hits_sat)-1, array.get(mid_hits_sat, array.size(mid_hits_sat)-1) + 1)

if hit_level(fib_214)
    switch dayofweek
        dayofweek.sunday => array.set(fib1_hits_sun, array.size(fib1_hits_sun)-1, array.get(fib1_hits_sun, array.size(fib1_hits_sun)-1) + 1)
        dayofweek.monday => array.set(fib1_hits_mon, array.size(fib1_hits_mon)-1, array.get(fib1_hits_mon, array.size(fib1_hits_mon)-1) + 1)
        dayofweek.tuesday => array.set(fib1_hits_tue, array.size(fib1_hits_tue)-1, array.get(fib1_hits_tue, array.size(fib1_hits_tue)-1) + 1)
        dayofweek.wednesday => array.set(fib1_hits_wed, array.size(fib1_hits_wed)-1, array.get(fib1_hits_wed, array.size(fib1_hits_wed)-1) + 1)
        dayofweek.thursday => array.set(fib1_hits_thu, array.size(fib1_hits_thu)-1, array.get(fib1_hits_thu, array.size(fib1_hits_thu)-1) + 1)
        dayofweek.friday => array.set(fib1_hits_fri, array.size(fib1_hits_fri)-1, array.get(fib1_hits_fri, array.size(fib1_hits_fri)-1) + 1)
        dayofweek.saturday => array.set(fib1_hits_sat, array.size(fib1_hits_sat)-1, array.get(fib1_hits_sat, array.size(fib1_hits_sat)-1) + 1)

if hit_level(fib_293)
    switch dayofweek
        dayofweek.sunday => array.set(fib2_hits_sun, array.size(fib2_hits_sun)-1, array.get(fib2_hits_sun, array.size(fib2_hits_sun)-1) + 1)
        dayofweek.monday => array.set(fib2_hits_mon, array.size(fib2_hits_mon)-1, array.get(fib2_hits_mon, array.size(fib2_hits_mon)-1) + 1)
        dayofweek.tuesday => array.set(fib2_hits_tue, array.size(fib2_hits_tue)-1, array.get(fib2_hits_tue, array.size(fib2_hits_tue)-1) + 1)
        dayofweek.wednesday => array.set(fib2_hits_wed, array.size(fib2_hits_wed)-1, array.get(fib2_hits_wed, array.size(fib2_hits_wed)-1) + 1)
        dayofweek.thursday => array.set(fib2_hits_thu, array.size(fib2_hits_thu)-1, array.get(fib2_hits_thu, array.size(fib2_hits_thu)-1) + 1)
        dayofweek.friday => array.set(fib2_hits_fri, array.size(fib2_hits_fri)-1, array.get(fib2_hits_fri, array.size(fib2_hits_fri)-1) + 1)
        dayofweek.saturday => array.set(fib2_hits_sat, array.size(fib2_hits_sat)-1, array.get(fib2_hits_sat, array.size(fib2_hits_sat)-1) + 1)

// Calculate totals and percentages
total_high_hits = array.sum(high_hits_sun) + array.sum(high_hits_mon) + array.sum(high_hits_tue) + array.sum(high_hits_wed) + array.sum(high_hits_thu) + array.sum(high_hits_fri) + array.sum(high_hits_sat)
total_low_hits = array.sum(low_hits_sun) + array.sum(low_hits_mon) + array.sum(low_hits_tue) + array.sum(low_hits_wed) + array.sum(low_hits_thu) + array.sum(low_hits_fri) + array.sum(low_hits_sat)
total_mid_hits = array.sum(mid_hits_sun) + array.sum(mid_hits_mon) + array.sum(mid_hits_tue) + array.sum(mid_hits_wed) + array.sum(mid_hits_thu) + array.sum(mid_hits_fri) + array.sum(mid_hits_sat)
total_fib1_hits = array.sum(fib1_hits_sun) + array.sum(fib1_hits_mon) + array.sum(fib1_hits_tue) + array.sum(fib1_hits_wed) + array.sum(fib1_hits_thu) + array.sum(fib1_hits_fri) + array.sum(fib1_hits_sat)
total_fib2_hits = array.sum(fib2_hits_sun) + array.sum(fib2_hits_mon) + array.sum(fib2_hits_tue) + array.sum(fib2_hits_wed) + array.sum(fib2_hits_thu) + array.sum(fib2_hits_fri) + array.sum(fib2_hits_sat)

// Table Configuration
var g_TABLE = "Table"
table_position      = input.string('Top Right', "Table Position", options = ['Bottom Center', 'Bottom Left', 'Bottom Right', 'Middle Center', 'Middle Left', 'Middle Right', 'Top Center', 'Top Left', 'Top Right'], group = g_TABLE)
table_size          = input.string('Tiny', "Text Size", options = ['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], group = g_TABLE)
table_text          = input.color(color.black, "Text", group = g_TABLE)
table_bg            = input.color(color.white, "Table Background", group = g_TABLE)
table_frame         = input.color(color.black, "Table Frame", group = g_TABLE)
table_border        = input.color(color.black, "Table Border", group = g_TABLE)
table_border_width  = input.int(1, "Table Border Width", group = g_TABLE)
table_frame_width   = input.int(2, "Table Frame Width", group = g_TABLE)

// Function to get table position
get_table_position(pos) =>
    switch pos
        'Bottom Center' => position.bottom_center
        'Bottom Left' => position.bottom_left
        'Bottom Right' => position.bottom_right
        'Middle Center' => position.middle_center
        'Middle Left' => position.middle_left
        'Middle Right' => position.middle_right
        'Top Center' => position.top_center
        'Top Left' => position.top_left
        'Top Right' => position.top_right

// Function to get text size
get_table_text_size(size) =>
    switch size
        'Auto' => size.auto
        'Tiny' => size.tiny
        'Small' => size.small
        'Normal' => size.normal
        'Large' => size.large
        'Huge' => size.huge

// Create and populate table
// Calculate total days and weeks
total_days = array.size(high_hits_sun)  // Using one array's size since all are synchronized
total_weeks = math.round(total_days / 7, 1)  // Approximate weeks, rounded to 1 decimal

// Create and populate table
if show_stats
    var stats = table.new(get_table_position(table_position), 8, 14, bgcolor = table_bg, frame_color = table_frame, frame_width = table_frame_width, border_color = table_border, border_width = table_border_width)
    
    if barstate.islast
        ts = get_table_text_size(table_size)
        
        // Headers
        table.cell(stats, 0, 0, "Level", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 0, "Sun", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 0, "Mon", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 0, "Tue", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 0, "Wed", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 0, "Thu", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 0, "Fri", text_color=table_text, text_size=ts)
        
        // High Hits
        table.cell(stats, 0, 1, "High", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 1, str.tostring(array.sum(high_hits_sun)) + "\n(" + str.tostring(array.sum(high_hits_sun)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 1, str.tostring(array.sum(high_hits_mon)) + "\n(" + str.tostring(array.sum(high_hits_mon)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 1, str.tostring(array.sum(high_hits_tue)) + "\n(" + str.tostring(array.sum(high_hits_tue)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 1, str.tostring(array.sum(high_hits_wed)) + "\n(" + str.tostring(array.sum(high_hits_wed)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 1, str.tostring(array.sum(high_hits_thu)) + "\n(" + str.tostring(array.sum(high_hits_thu)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 1, str.tostring(array.sum(high_hits_fri)) + "\n(" + str.tostring(array.sum(high_hits_fri)/total_high_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        
        // Low Hits
        table.cell(stats, 0, 2, "Low", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 2, str.tostring(array.sum(low_hits_sun)) + "\n(" + str.tostring(array.sum(low_hits_sun)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 2, str.tostring(array.sum(low_hits_mon)) + "\n(" + str.tostring(array.sum(low_hits_mon)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 2, str.tostring(array.sum(low_hits_tue)) + "\n(" + str.tostring(array.sum(low_hits_tue)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 2, str.tostring(array.sum(low_hits_wed)) + "\n(" + str.tostring(array.sum(low_hits_wed)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 2, str.tostring(array.sum(low_hits_thu)) + "\n(" + str.tostring(array.sum(low_hits_thu)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 2, str.tostring(array.sum(low_hits_fri)) + "\n(" + str.tostring(array.sum(low_hits_fri)/total_low_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        
        // Mid Hits
        table.cell(stats, 0, 3, "Mid", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 3, str.tostring(array.sum(mid_hits_sun)) + "\n(" + str.tostring(array.sum(mid_hits_sun)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 3, str.tostring(array.sum(mid_hits_mon)) + "\n(" + str.tostring(array.sum(mid_hits_mon)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 3, str.tostring(array.sum(mid_hits_tue)) + "\n(" + str.tostring(array.sum(mid_hits_tue)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 3, str.tostring(array.sum(mid_hits_wed)) + "\n(" + str.tostring(array.sum(mid_hits_wed)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 3, str.tostring(array.sum(mid_hits_thu)) + "\n(" + str.tostring(array.sum(mid_hits_thu)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 3, str.tostring(array.sum(mid_hits_fri)) + "\n(" + str.tostring(array.sum(mid_hits_fri)/total_mid_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        
        // Fib 1 Hits (fib_214)
        table.cell(stats, 0, 4, "Fib " + str.tostring(fib1*100, "#.#"), text_color=table_text, text_size=ts)
        table.cell(stats, 1, 4, str.tostring(array.sum(fib1_hits_sun)) + "\n(" + str.tostring(array.sum(fib1_hits_sun)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 4, str.tostring(array.sum(fib1_hits_mon)) + "\n(" + str.tostring(array.sum(fib1_hits_mon)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 4, str.tostring(array.sum(fib1_hits_tue)) + "\n(" + str.tostring(array.sum(fib1_hits_tue)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 4, str.tostring(array.sum(fib1_hits_wed)) + "\n(" + str.tostring(array.sum(fib1_hits_wed)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 4, str.tostring(array.sum(fib1_hits_thu)) + "\n(" + str.tostring(array.sum(fib1_hits_thu)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 4, str.tostring(array.sum(fib1_hits_fri)) + "\n(" + str.tostring(array.sum(fib1_hits_fri)/total_fib1_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        
        // Fib 2 Hits (fib_293)
        table.cell(stats, 0, 5, "Fib " + str.tostring(fib2*100, "#.#"), text_color=table_text, text_size=ts)
        table.cell(stats, 1, 5, str.tostring(array.sum(fib2_hits_sun)) + "\n(" + str.tostring(array.sum(fib2_hits_sun)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 2, 5, str.tostring(array.sum(fib2_hits_mon)) + "\n(" + str.tostring(array.sum(fib2_hits_mon)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 3, 5, str.tostring(array.sum(fib2_hits_tue)) + "\n(" + str.tostring(array.sum(fib2_hits_tue)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 4, 5, str.tostring(array.sum(fib2_hits_wed)) + "\n(" + str.tostring(array.sum(fib2_hits_wed)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 5, 5, str.tostring(array.sum(fib2_hits_thu)) + "\n(" + str.tostring(array.sum(fib2_hits_thu)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        table.cell(stats, 6, 5, str.tostring(array.sum(fib2_hits_fri)) + "\n(" + str.tostring(array.sum(fib2_hits_fri)/total_fib2_hits*100, "#.##") + "%)", text_color=table_text, text_size=ts)
        
        // Totals
        table.cell(stats, 0, 7, "Total Days:", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 7, str.tostring(total_days), text_color=table_text, text_size=ts, text_halign=text.align_left)
        table.cell(stats, 0, 8, "Total Weeks:", text_color=table_text, text_size=ts)
        table.cell(stats, 1, 8, str.tostring(total_weeks), text_color=table_text, text_size=ts, text_halign=text.align_left)

Overview

Weekly IB features customizable day-of-week labels, daily session boundary highlights, configurable timezones, and optional Fibonacci retracement levels. Additionally, it includes a statistics table that displays tracking metrics with customizable table positioning, sizing, frame, border, and text formatting settings.

Details

Published by

TamaraKGreen on GitHub

Code credit

notprofessorgreen, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance, Sessions & time, Screeners & dashboards

Markets

Any symbol

Timeframes

M15-H1, H4 and above

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 beginning of the daybooltruebod
Show statistics tablebooltrueshow_stats
Dark backgroundboolfalseshowDOW
Light backgroundbooltrueshowDOWB
Trading Sessionsession2200-2100session
Time ZonestringUTCtimeZone
Mon booltruemonSession
Tue booltruetueSession
Show fib retracementsbooltruefib_levels
Fib retracement level 1float0.3fib1
Fib retracement level 1float0.7fib2
Table PositionstringTop Righttable_position
Show all 19 settings
SettingTypeDefaultVariable
Text SizestringTinytable_size
Textcolorcolor.blacktable_text
Table Backgroundcolorcolor.whitetable_bg
Table Framecolorcolor.blacktable_frame
Table Bordercolorcolor.blacktable_border
Table Border Widthint1table_border_width
Table Frame Widthint2table_frame_width
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

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 6 weeks ago · None stated GitHub repository of SPX Midnight Box + Snag Logic

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

Session Edge Probabilities

by TraderOracle
61 stars

Session Edge Probabilities tracks eight session-based trading rules using statistical probabilities evaluated on historical chart data. It utilizes a fixed calculation timeframe to evaluate opening ranges, midnight levels, afternoon reversal windows, and price

Indicator v6 Sessions & timeScreeners & dashboards
Updated 9 days ago · None stated GitHub repository of Session Edge Probabilities
56 stars

This indicator marks forex trading sessions and opening ranges on the price chart. It can draw Sydney, Tokyo, Frankfurt, London, and New York session boxes or five- and fifteen-minute opening ranges, plus an optional opening channel and a day-open range. Day r

Indicator v5 Sessions & timeSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Day Trading Booster by DGT

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers