Indicator · Pine Script v6 · On the chart

Daily Floor Pivots

by TamaraKGreen· code credited to npg

The Daily Floor Pivots indicator calculates standard daily pivot points alongside support and resistance levels up to five tiers.

View on GitHub

Repaints

GitHub stars46on the repository
Pine versionv6current
Lines of code1,200
Settings40inputs
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

1,200 lines of Pine Script v6 from Daily Floor Pivots.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Daily Floor Pivots.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ 
// © npg

//@version=6
indicator('Daily Floor Pivots', shorttitle = 'Daily Floor Pivots', overlay = true, max_lines_count = 500, max_labels_count = 500)

// ——— Input fields ———
look_back = input.int(title = 'Number of Periods Back', defval = 3, minval = 1, maxval = 20)
position_labels = input.string('Right', 'Labels Position', options = ['Left', 'Right'])
line_width = input.int(title = 'Line Width', defval = 2, minval = 1, maxval = 5)

// ——— Golden Zone Customisation ———
gz_show = input.bool(true, 'Show Daily Golden Zone (0.5-0.618)', group = 'Golden Zone')
gz_show_all = input.bool(true, 'Master Toggle - Show All Golden Zones', group = 'Golden Zone')
gz_color = input.color(color.new(color.purple, 0), 'Line Color', group = 'Golden Zone')
gz_fill_color = input.color(color.new(color.purple, 80), 'Fill Color', group = 'Golden Zone')
gz_show_labels = input.bool(true, 'Show Labels', group = 'Golden Zone')
gz_show_prices = input.bool(true, 'Show Prices', group = 'Golden Zone')
gz_from_top = input.bool(false, 'Calculate from Top (instead of Bottom)', group = 'Golden Zone')  

// ——— Inter-Pivot Golden Zones ———
gz_pp_r1_show = input.bool(true, 'PP to R1', group = 'Inter-Pivot Golden Zones', inline = 'gz1')
gz_pp_s1_show = input.bool(true, 'PP to S1', group = 'Inter-Pivot Golden Zones', inline = 'gz1')

gz_r1_r2_show = input.bool(true, 'R1 to R2', group = 'Inter-Pivot Golden Zones', inline = 'gz2')
gz_s1_s2_show = input.bool(true, 'S1 to S2', group = 'Inter-Pivot Golden Zones', inline = 'gz2')

gz_r2_r3_show = input.bool(true, 'R2 to R3', group = 'Inter-Pivot Golden Zones', inline = 'gz3')
gz_s2_s3_show = input.bool(true, 'S2 to S3', group = 'Inter-Pivot Golden Zones', inline = 'gz3')

gz_r3_r4_show = input.bool(true, 'R3 to R4', group = 'Inter-Pivot Golden Zones', inline = 'gz4')
gz_s3_s4_show = input.bool(true, 'S3 to S4', group = 'Inter-Pivot Golden Zones', inline = 'gz4')

gz_r4_r5_show = input.bool(true, 'R4 to R5', group = 'Inter-Pivot Golden Zones', inline = 'gz5')
gz_s4_s5_show = input.bool(true, 'S4 to S5', group = 'Inter-Pivot Golden Zones', inline = 'gz5')

gz_inter_color = input.color(color.new(color.orange, 0), 'Line Color', group = 'Inter-Pivot Golden Zones')
gz_inter_fill = input.color(color.new(color.orange, 85), 'Fill Color', group = 'Inter-Pivot Golden Zones')
gz_inter_labels = input.bool(true, 'Show Labels', group = 'Inter-Pivot Golden Zones')
gz_inter_prices = input.bool(true, 'Show Prices', group = 'Inter-Pivot Golden Zones')

// ——— Pivot Customisation ———
sr_show = input.bool(true, 'Show Support/Resistance Levels', group = 'Pivot Display')
sr_show_labels = input.bool(true, 'Show SR Labels', group = 'Pivot Display')
sr_show_prices = input.bool(true, 'Show SR Prices', group = 'Pivot Display')

// PP (Pivot Point)
pp_show = input.bool(true, '', inline = 'PP', group = 'Pivot Display')
pp_color = input.color(color.gray, 'PP', inline = 'PP', group = 'Pivot Display')

// R1/S1
s1_show = input.bool(true, '', inline = 'S1/R1', group = 'Pivot Display')
s1_color = input.color(color.blue, 'S1', inline = 'S1/R1', group = 'Pivot Display')
r1_show = input.bool(true, '', inline = 'S1/R1', group = 'Pivot Display')
r1_color = input.color(color.blue, 'R1', inline = 'S1/R1', group = 'Pivot Display')

// R2/S2
s2_show = input.bool(true, '', inline = 'S2/R2', group = 'Pivot Display')
s2_color = input.color(color.blue, 'S2', inline = 'S2/R2', group = 'Pivot Display')
r2_show = input.bool(true, '', inline = 'S2/R2', group = 'Pivot Display')
r2_color = input.color(color.blue, 'R2', inline = 'S2/R2', group = 'Pivot Display')

// R3/S3
s3_show = input.bool(true, '', inline = 'S3/R3', group = 'Pivot Display')
s3_color = input.color(color.blue, 'S3', inline = 'S3/R3', group = 'Pivot Display')
r3_show = input.bool(true, '', inline = 'S3/R3', group = 'Pivot Display')
r3_color = input.color(color.blue, 'R3', inline = 'S3/R3', group = 'Pivot Display')

// R4/S4 - NEW
s4_show = input.bool(true, '', inline = 'S4/R4', group = 'Pivot Display')
s4_color = input.color(color.blue, 'S4', inline = 'S4/R4', group = 'Pivot Display')
r4_show = input.bool(true, '', inline = 'S4/R4', group = 'Pivot Display')
r4_color = input.color(color.blue, 'R4', inline = 'S4/R4', group = 'Pivot Display')

// R5/S5 - NEW
s5_show = input.bool(true, '', inline = 'S5/R5', group = 'Pivot Display')
s5_color = input.color(color.blue, 'S5', inline = 'S5/R5', group = 'Pivot Display')
r5_show = input.bool(true, '', inline = 'S5/R5', group = 'Pivot Display')
r5_color = input.color(color.blue, 'R5', inline = 'S5/R5', group = 'Pivot Display')

// ——— Overall Statistics Table Options ———
overall_table_show = input.bool(true, 'Show Overall Statistics Table', group = 'Overall Statistics Table')
overall_table_size = input.string('small', 'Table Size', group = 'Overall Statistics Table', options = ['tiny', 'small', 'normal', 'large', 'huge', 'auto'])
overall_table_position = input.string('Top Left', 'Table Position', group = 'Overall Statistics Table', options = ['Top Left', 'Top Right', 'Bottom Left', 'Bottom Right'])

overall_show_current = input.bool(true, 'Current Session Info', group = 'Overall Table Sections')
overall_show_touch_close = input.bool(true, 'Touch & Close Rates', group = 'Overall Table Sections')
overall_show_continue_reject = input.bool(true, 'Continue & Reject Rates', group = 'Overall Table Sections')
overall_show_first_touch = input.bool(true, 'First Touch Statistics', group = 'Overall Table Sections')
overall_show_gz = input.bool(true, 'Golden Zone Statistics', group = 'Overall Table Sections')
overall_show_close_dist = input.bool(true, 'Daily Close Distribution', group = 'Overall Table Sections')
overall_show_highest_lowest = input.bool(true, 'Highest/Lowest Levels Reached', group = 'Overall Table Sections')

// ——— Context Statistics Table Options ———
context_table_show = input.bool(true, 'Show Context Statistics Table', group = 'Context Statistics Table')
context_table_size = input.string('small', 'Table Size', group = 'Context Statistics Table', options = ['tiny', 'small', 'normal', 'large', 'huge', 'auto'])
context_table_position = input.string('Bottom Right', 'Table Position', group = 'Context Statistics Table', options = ['Top Left', 'Top Right', 'Bottom Left', 'Bottom Right'])

context_show_current_zone = input.bool(true, 'Current Opening Zone', group = 'Context Table Sections')
context_show_zone_stats = input.bool(true, 'Opening Zone Statistics', group = 'Context Table Sections')
context_show_gap_context = input.bool(true, 'Previous Day Gap Context', group = 'Context Table Sections')

// Map position strings to table position constants
overall_pos = overall_table_position == 'Top Left' ? position.top_left : overall_table_position == 'Top Right' ? position.top_right : overall_table_position == 'Bottom Left' ? position.bottom_left : position.bottom_right
context_pos = context_table_position == 'Top Left' ? position.top_left : context_table_position == 'Top Right' ? position.top_right : context_table_position == 'Bottom Left' ? position.bottom_left : position.bottom_right

// ——— Variables ———
var arr_time = array.new_int()
var pp = array.new_float()
var r1 = array.new_float()
var s1 = array.new_float()
var r2 = array.new_float()
var s2 = array.new_float()
var r3 = array.new_float()
var s3 = array.new_float()
var r4 = array.new_float() 
var s4 = array.new_float() 
var r5 = array.new_float() 
var s5 = array.new_float() 
var gz_50 = array.new_float()
var gz_618 = array.new_float()

// Inter-pivot golden zone arrays
var gz_pp_r1_low = array.new_float()
var gz_pp_r1_high = array.new_float()
var gz_pp_s1_low = array.new_float()
var gz_pp_s1_high = array.new_float()
var gz_r1_r2_low = array.new_float()
var gz_r1_r2_high = array.new_float()
var gz_s1_s2_low = array.new_float()
var gz_s1_s2_high = array.new_float()
var gz_r2_r3_low = array.new_float()
var gz_r2_r3_high = array.new_float()
var gz_s2_s3_low = array.new_float()
var gz_s2_s3_high = array.new_float()
var gz_r3_r4_low = array.new_float()  
var gz_r3_r4_high = array.new_float()  
var gz_s3_s4_low = array.new_float()  
var gz_s3_s4_high = array.new_float()  
var gz_r4_r5_low = array.new_float()  
var gz_r4_r5_high = array.new_float()  
var gz_s4_s5_low = array.new_float()  
var gz_s4_s5_high = array.new_float()  

var lines = array.new_line()
var labels = array.new_label()
var boxes = array.new_box()

// ——— Series state ———
pivotX_prev_high = float(na)
pivotX_prev_high := nz(pivotX_prev_high[1])
pivotX_prev_low = float(na)
pivotX_prev_low := nz(pivotX_prev_low[1])
pivotX_prev_close = float(na)
pivotX_prev_close := nz(pivotX_prev_close[1])

// ——— Get Daily data ———
[prev_high, prev_low, prev_close, prev_time] = request.security(syminfo.tickerid, 'D', [high[1], low[1], close[1], time[1]], lookahead = barmerge.lookahead_on)
sec_open_gaps_on = request.security(syminfo.tickerid, 'D', open, gaps = barmerge.gaps_on, lookahead = barmerge.lookahead_on)

// ——— Helper functions ———
can_draw(a, i) =>
    i >= 0 and i < array.size(a) and not na(array.get(a, i))

val_at(a, i) =>
    can_draw(a, i) ? array.get(a, i) : na

draw_line(i, pivot, col, is_current = false) =>
    line aLine = na
    okArrTime = array.size(arr_time) > 1 and i >= 0 and i < array.size(arr_time) - 1
    okPivot = i >= 0 and i < array.size(pivot)
    if okArrTime and okPivot
        y = array.get(pivot, i)
        if not na(y)
            x2 = is_current ? time : array.get(arr_time, i + 1)
            aLine := line.new(array.get(arr_time, i), y, x2, y, xloc = xloc.bar_time, color = col, width = line_width)
            array.push(lines, aLine)
    aLine

draw_label(i, y, txt, txt_color, is_gz = false, is_inter_gz = false) =>
    if na(y)
        na
    else
        _showLbl = is_gz ? gz_show_labels : is_inter_gz ? gz_inter_labels : sr_show_labels
        _showPrc = is_gz ? gz_show_prices : is_inter_gz ? gz_inter_prices : sr_show_prices
        if _showLbl or _showPrc
            display = ''
            if _showLbl and _showPrc and txt != ''
                display := str.format('                                {0} - {1}', txt, math.round_to_mintick(y))
            else if _showLbl and txt != ''
                display := '                           ' + txt
            else
                display := str.format('                                {0}', math.round_to_mintick(y))
            rightIndex = math.min(i + 1, array.size(arr_time) - 1)
            leftIndex = math.min(i, array.size(arr_time) - 1)
            if rightIndex >= 0 and leftIndex >= 0
                x = position_labels == 'Left' ? array.get(arr_time, leftIndex) : array.get(arr_time, rightIndex)
                array.push(labels, label.new(x = x, y = y, text = display, textcolor = txt_color, style = label.style_none, color = #00000000, xloc = xloc.bar_time))

// ——— Floor Pivot calculation ———
floor_pivots() =>
    pivot_point = (pivotX_prev_high + pivotX_prev_low + pivotX_prev_close) / 3
    _r1 = (2 * pivot_point) - pivotX_prev_low
    _r2 = pivot_point + (pivotX_prev_high - pivotX_prev_low)
    _r3 = pivotX_prev_high + 2 * (pivot_point - pivotX_prev_low)
    _s1 = (2 * pivot_point) - pivotX_prev_high
    _s2 = pivot_point - (pivotX_prev_high - pivotX_prev_low)
    _s3 = pivotX_prev_low - 2 * (pivotX_prev_high - pivot_point)
    
    array.push(pp, pivot_point)
    array.push(r1, _r1)
    array.push(s1, _s1)
    array.push(r2, _r2)
    array.push(s2, _s2)
    array.push(r3, _r3)
    array.push(s3, _s3)
    
    // PP to R1 Golden Zone
    _pp_r1_range = _r1 - pivot_point
    if gz_from_top
        array.push(gz_pp_r1_high, _r1 - 0.5 * _pp_r1_range)
        array.push(gz_pp_r1_low, _r1 - 0.618 * _pp_r1_range)
    else
        array.push(gz_pp_r1_low, pivot_point + 0.5 * _pp_r1_range)
        array.push(gz_pp_r1_high, pivot_point + 0.618 * _pp_r1_range)
    
    // PP to S1 Golden Zone
    _pp_s1_range = pivot_point - _s1
    if gz_from_top
        array.push(gz_pp_s1_high, _s1 + 0.618 * _pp_s1_range)
        array.push(gz_pp_s1_low, _s1 + 0.5 * _pp_s1_range)
    else
        array.push(gz_pp_s1_high, pivot_point - 0.5 * _pp_s1_range)
        array.push(gz_pp_s1_low, pivot_point - 0.618 * _pp_s1_range)
    
    // R1 to R2 Golden Zone
    _r1_r2_range = _r2 - _r1
    if gz_from_top
        array.push(gz_r1_r2_high, _r2 - 0.5 * _r1_r2_range)
        array.push(gz_r1_r2_low, _r2 - 0.618 * _r1_r2_range)
    else
        array.push(gz_r1_r2_low, _r1 + 0.5 * _r1_r2_range)
        array.push(gz_r1_r2_high, _r1 + 0.618 * _r1_r2_range)
    
    // S1 to S2 Golden Zone
    _s1_s2_range = _s1 - _s2
    if gz_from_top
        array.push(gz_s1_s2_high, _s2 + 0.618 * _s1_s2_range)
        array.push(gz_s1_s2_low, _s2 + 0.5 * _s1_s2_range)
    else
        array.push(gz_s1_s2_high, _s1 - 0.5 * _s1_s2_range)
        array.push(gz_s1_s2_low, _s1 - 0.618 * _s1_s2_range)
    
    // R2 to R3 Golden Zone
    _r2_r3_range = _r3 - _r2
    if gz_from_top
        array.push(gz_r2_r3_high, _r3 - 0.5 * _r2_r3_range)
        array.push(gz_r2_r3_low, _r3 - 0.618 * _r2_r3_range)
    else
        array.push(gz_r2_r3_low, _r2 + 0.5 * _r2_r3_range)
        array.push(gz_r2_r3_high, _r2 + 0.618 * _r2_r3_range)
    
    // S2 to S3 Golden Zone
    _s2_s3_range = _s2 - _s3
    if gz_from_top
        array.push(gz_s2_s3_high, _s3 + 0.618 * _s2_s3_range)
        array.push(gz_s2_s3_low, _s3 + 0.5 * _s2_s3_range)
    else
        array.push(gz_s2_s3_high, _s2 - 0.5 * _s2_s3_range)
        array.push(gz_s2_s3_low, _s2 - 0.618 * _s2_s3_range)

    // Calculate R4/S4
    _r4 = _r3 + (pivotX_prev_high - pivotX_prev_low)
    _s4 = _s3 - (pivotX_prev_high - pivotX_prev_low)
    array.push(r4, _r4)
    array.push(s4, _s4)
    
    // Calculate R5/S5
    _r5 = _r4 + (pivotX_prev_high - pivotX_prev_low)
    _s5 = _s4 - (pivotX_prev_high - pivotX_prev_low)
    array.push(r5, _r5)
    array.push(s5, _s5)
    
    // R3 to R4 Golden Zone
    _r3_r4_range = _r4 - _r3
    if gz_from_top
        array.push(gz_r3_r4_high, _r4 - 0.5 * _r3_r4_range)
        array.push(gz_r3_r4_low, _r4 - 0.618 * _r3_r4_range)
    else
        array.push(gz_r3_r4_low, _r3 + 0.5 * _r3_r4_range)
        array.push(gz_r3_r4_high, _r3 + 0.618 * _r3_r4_range)
    
    // S3 to S4 Golden Zone
    _s3_s4_range = _s3 - _s4
    if gz_from_top
        array.push(gz_s3_s4_high, _s4 + 0.618 * _s3_s4_range)
        array.push(gz_s3_s4_low, _s4 + 0.5 * _s3_s4_range)
    else
        array.push(gz_s3_s4_high, _s3 - 0.5 * _s3_s4_range)
        array.push(gz_s3_s4_low, _s3 - 0.618 * _s3_s4_range)
    
    // R4 to R5 Golden Zone
    _r4_r5_range = _r5 - _r4
    if gz_from_top
        array.push(gz_r4_r5_high, _r5 - 0.5 * _r4_r5_range)
        array.push(gz_r4_r5_low, _r5 - 0.618 * _r4_r5_range)
    else
        array.push(gz_r4_r5_low, _r4 + 0.5 * _r4_r5_range)
        array.push(gz_r4_r5_high, _r4 + 0.618 * _r4_r5_range)
    
    // S4 to S5 Golden Zone
    _s4_s5_range = _s4 - _s5
    if gz_from_top
        array.push(gz_s4_s5_high, _s5 + 0.618 * _s4_s5_range)
        array.push(gz_s4_s5_low, _s5 + 0.5 * _s4_s5_range)
    else
        array.push(gz_s4_s5_high, _s4 - 0.5 * _s4_s5_range)
        array.push(gz_s4_s5_low, _s4 - 0.618 * _s4_s5_range)

calc_golden_zone() =>
    _range = pivotX_prev_high - pivotX_prev_low
    if gz_from_top
        // Calculate from top down (61.8% and 50% from the high)
        gz_50_level = pivotX_prev_high - 0.5 * _range
        gz_618_level = pivotX_prev_high - 0.618 * _range
        array.push(gz_50, gz_50_level)
        array.push(gz_618, gz_618_level)
    else
        // Calculate from bottom up (50% and 61.8% from the low)
        gz_50_level = pivotX_prev_low + 0.5 * _range
        gz_618_level = pivotX_prev_low + 0.618 * _range
        array.push(gz_50, gz_50_level)
        array.push(gz_618, gz_618_level)
        
calc_pivot() =>
    floor_pivots()
    calc_golden_zone()

// ——— Detect new day ———
var is_change = false
var change_time = int(na)
is_time_change = ta.change(time('D')) != 0

if is_time_change
    change_time := time

var start_time = time
without_time_change = barstate.islast and array.size(arr_time) == 0
is_can_calc_pivot = is_time_change or without_time_change
enough_bars_for_calculate = prev_time >= start_time

if is_can_calc_pivot and enough_bars_for_calculate
    if array.size(arr_time) == 0
        pivotX_prev_high := prev_high[1]
        pivotX_prev_low := prev_low[1]
        pivotX_prev_close := prev_close[1]
        array.push(arr_time, start_time)
        calc_pivot()
    pivotX_prev_high := prev_high
    pivotX_prev_low := prev_low
    pivotX_prev_close := prev_close
    if barstate.islast and not is_change and array.size(arr_time) > 0 and not without_time_change
        array.set(arr_time, array.size(arr_time) - 1, change_time)
    else if without_time_change
        array.push(arr_time, start_time)
    else
        array.push(arr_time, nz(change_time, time))
    calc_pivot()
    if array.size(arr_time) > look_back
        if array.size(arr_time) > 0
            array.shift(arr_time)
        if array.size(pp) > 0
            array.shift(pp)
        if array.size(r1) > 0
            array.shift(r1)
        if array.size(s1) > 0
            array.shift(s1)
        if array.size(r2) > 0
            array.shift(r2)
        if array.size(s2) > 0
            array.shift(s2)
        if array.size(r3) > 0
            array.shift(r3)
        if array.size(s3) > 0
            array.shift(s3)
        if array.size(r4) > 0  
            array.shift(r4)
        if array.size(s4) > 0  
            array.shift(s4)
        if array.size(r5) > 0  
            array.shift(r5)
        if array.size(s5) > 0  
            array.shift(s5)
        if array.size(gz_50) > 0
            array.shift(gz_50)
        if array.size(gz_618) > 0
            array.shift(gz_618)
        if array.size(gz_pp_r1_low) > 0
            array.shift(gz_pp_r1_low)
        if array.size(gz_pp_r1_high) > 0
            array.shift(gz_pp_r1_high)
        if array.size(gz_pp_s1_low) > 0
            array.shift(gz_pp_s1_low)
        if array.size(gz_pp_s1_high) > 0
            array.shift(gz_pp_s1_high)
        if array.size(gz_r1_r2_low) > 0
            array.shift(gz_r1_r2_low)
        if array.size(gz_r1_r2_high) > 0
            array.shift(gz_r1_r2_high)
        if array.size(gz_s1_s2_low) > 0
            array.shift(gz_s1_s2_low)
        if array.size(gz_s1_s2_high) > 0
            array.shift(gz_s1_s2_high)
        if array.size(gz_r2_r3_low) > 0
            array.shift(gz_r2_r3_low)
        if array.size(gz_r2_r3_high) > 0
            array.shift(gz_r2_r3_high)
        if array.size(gz_s2_s3_low) > 0
            array.shift(gz_s2_s3_low)
        if array.size(gz_s2_s3_high) > 0
            array.shift(gz_s2_s3_high)
        if array.size(gz_r3_r4_low) > 0  
            array.shift(gz_r3_r4_low)
        if array.size(gz_r3_r4_high) > 0  
            array.shift(gz_r3_r4_high)
        if array.size(gz_s3_s4_low) > 0  
            array.shift(gz_s3_s4_low)
        if array.size(gz_s3_s4_high) > 0  
            array.shift(gz_s3_s4_high)
        if array.size(gz_r4_r5_low) > 0  
            array.shift(gz_r4_r5_low)
        if array.size(gz_r4_r5_high) > 0  
            array.shift(gz_r4_r5_high)
        if array.size(gz_s4_s5_low) > 0  
            array.shift(gz_s4_s5_low)
        if array.size(gz_s4_s5_high) > 0  
            array.shift(gz_s4_s5_high)
        is_change := true

if barstate.islast and array.size(arr_time) > 0 and is_change
    is_change := false
    array.push(arr_time, time)
    for idx = 0 to array.size(lines) - 1
        if array.size(lines) > 0
            line.delete(array.shift(lines))
        if array.size(labels) > 0
            label.delete(array.shift(labels))
        if array.size(boxes) > 0
            box.delete(array.shift(boxes))
    
    j = array.size(arr_time) - 2
    
    for idx = 0 to j
        is_current_period = (idx == j)
        if array.size(pp) > 0 and pp_show and can_draw(pp, idx)
            draw_line(idx, pp, pp_color, is_current_period)
    
    for idx = 0 to j
        if gz_show and gz_show_all and can_draw(gz_50, idx) and can_draw(gz_618, idx)
            is_current_period = (idx == j)
            gz_50_val = array.get(gz_50, idx)
            gz_618_val = array.get(gz_618, idx)
            gz_50_line = draw_line(idx, gz_50, gz_color, is_current_period)
            gz_618_line = draw_line(idx, gz_618, gz_color, is_current_period)
            x1 = array.get(arr_time, idx)
            x2 = is_current_period ? time : array.get(arr_time, idx + 1)
            gz_box = box.new(left = x1, top = gz_618_val, right = x2, bottom = gz_50_val, xloc = xloc.bar_time, border_color = color.new(gz_color, 100), bgcolor = gz_fill_color)
            array.push(boxes, gz_box)
            if idx == j
                draw_label(idx, gz_50_val, '0.5', gz_color, true, false)
                draw_label(idx, gz_618_val, '0.618', gz_color, true, false)
    
    for idx = 0 to j
        is_current_period = (idx == j)
        x1 = array.get(arr_time, idx)
        x2 = is_current_period ? time : array.get(arr_time, idx + 1)
        
        if gz_show_all and gz_pp_r1_show and can_draw(gz_pp_r1_low, idx) and can_draw(gz_pp_r1_high, idx)
            _low = array.get(gz_pp_r1_low, idx)
            _high = array.get(gz_pp_r1_high, idx)
            draw_line(idx, gz_pp_r1_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_pp_r1_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _low, 'PP-R1 0.5', gz_inter_color, false, true)
                draw_label(idx, _high, 'PP-R1 0.618', gz_inter_color, false, true)
        
        if gz_show_all and gz_pp_s1_show and can_draw(gz_pp_s1_low, idx) and can_draw(gz_pp_s1_high, idx)
            _low = array.get(gz_pp_s1_low, idx)
            _high = array.get(gz_pp_s1_high, idx)
            draw_line(idx, gz_pp_s1_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_pp_s1_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _high, 'PP-S1 0.5', gz_inter_color, false, true)
                draw_label(idx, _low, 'PP-S1 0.618', gz_inter_color, false, true)
        
        if gz_show_all and gz_r1_r2_show and can_draw(gz_r1_r2_low, idx) and can_draw(gz_r1_r2_high, idx)
            _low = array.get(gz_r1_r2_low, idx)
            _high = array.get(gz_r1_r2_high, idx)
            draw_line(idx, gz_r1_r2_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_r1_r2_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _low, 'R1-R2 0.5', gz_inter_color, false, true)
                draw_label(idx, _high, 'R1-R2 0.618', gz_inter_color, false, true)
        
        if gz_show_all and gz_s1_s2_show and can_draw(gz_s1_s2_low, idx) and can_draw(gz_s1_s2_high, idx)
            _low = array.get(gz_s1_s2_low, idx)
            _high = array.get(gz_s1_s2_high, idx)
            draw_line(idx, gz_s1_s2_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_s1_s2_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _high, 'S1-S2 0.5', gz_inter_color, false, true)
                draw_label(idx, _low, 'S1-S2 0.618', gz_inter_color, false, true)
        
        if gz_show_all and gz_r2_r3_show and can_draw(gz_r2_r3_low, idx) and can_draw(gz_r2_r3_high, idx)
            _low = array.get(gz_r2_r3_low, idx)
            _high = array.get(gz_r2_r3_high, idx)
            draw_line(idx, gz_r2_r3_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_r2_r3_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _low, 'R2-R3 0.5', gz_inter_color, false, true)
                draw_label(idx, _high, 'R2-R3 0.618', gz_inter_color, false, true)
        
        if gz_show_all and gz_s2_s3_show and can_draw(gz_s2_s3_low, idx) and can_draw(gz_s2_s3_high, idx)
            _low = array.get(gz_s2_s3_low, idx)
            _high = array.get(gz_s2_s3_high, idx)
            draw_line(idx, gz_s2_s3_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_s2_s3_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _high, 'S2-S3 0.5', gz_inter_color, false, true)
                draw_label(idx, _low, 'S2-S3 0.618', gz_inter_color, false, true)
        // R3 to R4 Golden Zone
        if gz_show_all and gz_r3_r4_show and can_draw(gz_r3_r4_low, idx) and can_draw(gz_r3_r4_high, idx)
            _low = array.get(gz_r3_r4_low, idx)
            _high = array.get(gz_r3_r4_high, idx)
            draw_line(idx, gz_r3_r4_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_r3_r4_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _low, 'R3-R4 0.5', gz_inter_color, false, true)
                draw_label(idx, _high, 'R3-R4 0.618', gz_inter_color, false, true)
        
        // S3 to S4 Golden Zone
        if gz_show_all and gz_s3_s4_show and can_draw(gz_s3_s4_low, idx) and can_draw(gz_s3_s4_high, idx)
            _low = array.get(gz_s3_s4_low, idx)
            _high = array.get(gz_s3_s4_high, idx)
            draw_line(idx, gz_s3_s4_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_s3_s4_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _high, 'S3-S4 0.5', gz_inter_color, false, true)
                draw_label(idx, _low, 'S3-S4 0.618', gz_inter_color, false, true)
        
        // R4 to R5 Golden Zone
        if gz_show_all and gz_r4_r5_show and can_draw(gz_r4_r5_low, idx) and can_draw(gz_r4_r5_high, idx)
            _low = array.get(gz_r4_r5_low, idx)
            _high = array.get(gz_r4_r5_high, idx)
            draw_line(idx, gz_r4_r5_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_r4_r5_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _low, 'R4-R5 0.5', gz_inter_color, false, true)
                draw_label(idx, _high, 'R4-R5 0.618', gz_inter_color, false, true)
        
        // S4 to S5 Golden Zone
        if gz_show_all and gz_s4_s5_show and can_draw(gz_s4_s5_low, idx) and can_draw(gz_s4_s5_high, idx)
            _low = array.get(gz_s4_s5_low, idx)
            _high = array.get(gz_s4_s5_high, idx)
            draw_line(idx, gz_s4_s5_low, gz_inter_color, is_current_period)
            draw_line(idx, gz_s4_s5_high, gz_inter_color, is_current_period)
            gz_box = box.new(left = x1, top = _high, right = x2, bottom = _low, xloc = xloc.bar_time, border_color = color.new(gz_inter_color, 100), bgcolor = gz_inter_fill)
            array.push(boxes, gz_box)
            if idx == j and gz_inter_labels
                draw_label(idx, _high, 'S4-S5 0.5', gz_inter_color, false, true)
                draw_label(idx, _low, 'S4-S5 0.618', gz_inter_color, false, true)

    for idx = 0 to j
        is_current_period = (idx == j)
        if sr_show
            if r1_show and can_draw(r1, idx)
                draw_line(idx, r1, r1_color, is_current_period)
                draw_label(idx, val_at(r1, idx), 'R1', r1_color, false, false)
            if s1_show and can_draw(s1, idx)
                draw_line(idx, s1, s1_color, is_current_period)
                draw_label(idx, val_at(s1, idx), 'S1', s1_color, false, false)
            if r2_show and can_draw(r2, idx)
                draw_line(idx, r2, r2_color, is_current_period)
                draw_label(idx, val_at(r2, idx), 'R2', r2_color, false, false)
            if s2_show and can_draw(s2, idx)
                draw_line(idx, s2, s2_color, is_current_period)
                draw_label(idx, val_at(s2, idx), 'S2', s2_color, false, false)
            if r3_show and can_draw(r3, idx)
                draw_line(idx, r3, r3_color, is_current_period)
                draw_label(idx, val_at(r3, idx), 'R3', r3_color, false, false)
            if s3_show and can_draw(s3, idx)
                draw_line(idx, s3, s3_color, is_current_period)
                draw_label(idx, val_at(s3, idx), 'S3', s3_color, false, false)
            if r4_show and can_draw(r4, idx)
                draw_line(idx, r4, r4_color, is_current_period)
                draw_label(idx, val_at(r4, idx), 'R4', r4_color, false, false)
            if s4_show and can_draw(s4, idx)
                draw_line(idx, s4, s4_color, is_current_period)
                draw_label(idx, val_at(s4, idx), 'S4', s4_color, false, false)
            if r5_show and can_draw(r5, idx)
                draw_line(idx, r5, r5_color, is_current_period)
                draw_label(idx, val_at(r5, idx), 'R5', r5_color, false, false)
            if s5_show and can_draw(s5, idx)
                draw_line(idx, s5, s5_color, is_current_period)
                draw_label(idx, val_at(s5, idx), 'S5', s5_color, false, false)
    
    i = array.size(arr_time) - 2
    if array.size(pp) > 0 and pp_show and can_draw(pp, i)
        draw_label(i, val_at(pp, i), 'PP', pp_color, false, false)

// Get current pivot values
i = array.size(arr_time) - 2
curr_pp = val_at(pp, i)
curr_r1 = val_at(r1, i)
curr_r2 = val_at(r2, i)
curr_r3 = val_at(r3, i)
curr_s1 = val_at(s1, i)
curr_s2 = val_at(s2, i)
curr_s3 = val_at(s3, i)
curr_gz_low = val_at(gz_50, i)
curr_gz_high = val_at(gz_618, i)
curr_gz_pp_r1_low = val_at(gz_pp_r1_low, i)
curr_gz_pp_r1_high = val_at(gz_pp_r1_high, i)
curr_gz_pp_s1_low = val_at(gz_pp_s1_low, i)
curr_gz_pp_s1_high = val_at(gz_pp_s1_high, i)

var float rth_open = na
var string opening_zone = na
rth_session = "0930-1600"
t_newRTH = ta.change(time(timeframe.period, rth_session)) != 0

if t_newRTH
    rth_open := open
    
    if not na(rth_open) and not na(curr_pp)
        threshold = curr_pp * 0.001
        
        if math.abs(rth_open - curr_pp) <= threshold
            opening_zone := "AT_PP"
        else if not na(curr_gz_low) and not na(curr_gz_high) and rth_open >= curr_gz_low and rth_open <= curr_gz_high
            opening_zone := "IN_GZ"
        else if rth_open > curr_pp
            if not na(curr_r3) and rth_open >= curr_r3
                opening_zone := "ABOVE_R3"
            else if not na(curr_r2) and not na(curr_r3) and rth_open >= curr_r2 and rth_open < curr_r3
                opening_zone := "R2_TO_R3"
            else if not na(curr_r1) and not na(curr_r2) and rth_open >= curr_r1 and rth_open < curr_r2
                opening_zone := "R1_TO_R2"
            else if not na(curr_gz_pp_r1_high) and rth_open > curr_gz_pp_r1_high and rth_open < curr_r1
                opening_zone := "GZ_TO_R1"
            else if not na(curr_gz_pp_r1_low) and not na(curr_gz_pp_r1_high) and rth_open >= curr_gz_pp_r1_low and rth_open <= curr_gz_pp_r1_high
                opening_zone := "GZ_PP_R1"
            else
                opening_zone := "PP_TO_R1"
        else
            if not na(curr_s3) and rth_open <= curr_s3
                opening_zone := "BELOW_S3"
            else if not na(curr_s2) and not na(curr_s3) and rth_open > curr_s3 and rth_open <= curr_s2
                opening_zone := "S3_TO_S2"
            else if not na(curr_s1) and not na(curr_s2) and rth_open > curr_s2 and rth_open <= curr_s1
                opening_zone := "S2_TO_S1"
            else if not na(curr_gz_pp_s1_low) and rth_open < curr_gz_pp_s1_low and rth_open > curr_s1
                opening_zone := "S1_TO_GZ"
            else if not na(curr_gz_pp_s1_low) and not na(curr_gz_pp_s1_high) and rth_open >= curr_gz_pp_s1_low and rth_open <= curr_gz_pp_s1_high
                opening_zone := "GZ_PP_S1"
            else
                opening_zone := "PP_TO_S1"

current_zone = ""
if not na(close) and not na(curr_pp)
    threshold = curr_pp * 0.001
    
    if math.abs(close - curr_pp) <= threshold
        current_zone := "AT_PP"
    else if not na(curr_gz_low) and not na(curr_gz_high) and close >= curr_gz_low and close <= curr_gz_high
        current_zone := "IN_GZ"
    else if close > curr_pp
        if not na(curr_r3) and close >= curr_r3
            current_zone := "ABOVE_R3"
        else if not na(curr_r2) and not na(curr_r3) and close >= curr_r2 and close < curr_r3
            current_zone := "R2_TO_R3"
        else if not na(curr_r1) and not na(curr_r2) and close >= curr_r1 and close < curr_r2
            current_zone := "R1_TO_R2"
        else if not na(curr_gz_pp_r1_high) and close > curr_gz_pp_r1_high and close < curr_r1
            current_zone := "GZ_TO_R1"
        else if not na(curr_gz_pp_r1_low) and not na(curr_gz_pp_r1_high) and close >= curr_gz_pp_r1_low and close <= curr_gz_pp_r1_high
            current_zone := "GZ_PP_R1"
        else
            current_zone := "PP_TO_R1"
    else
        if not na(curr_s3) and close <= curr_s3
            current_zone := "BELOW_S3"
        else if not na(curr_s2) and not na(curr_s3) and close > curr_s3 and close <= curr_s2
            current_zone := "S3_TO_S2"
        else if not na(curr_s1) and not na(curr_s2) and close > curr_s2 and close <= curr_s1
            current_zone := "S2_TO_S1"
        else if not na(curr_gz_pp_s1_low) and close < curr_gz_pp_s1_low and close > curr_s1
            current_zone := "S1_TO_GZ"
        else if not na(curr_gz_pp_s1_low) and not na(curr_gz_pp_s1_high) and close >= curr_gz_pp_s1_low and close <= curr_gz_pp_s1_high
            current_zone := "GZ_PP_S1"
        else
            current_zone := "PP_TO_S1"

session_direction = na(rth_open) ? "N/A" : close > rth_open ? "Bull" : close < rth_open ? "Bear" : "Flat"

// Determine previous day gap context
var string gap_context = na
if t_newRTH and not na(rth_open) and not na(prev_high) and not na(prev_low)
    if rth_open > prev_high
        gap_context := "ABOVE_PREV_HIGH"
    else if rth_open < prev_low
        gap_context := "BELOW_PREV_LOW"
    else
        gap_context := "WITHIN_PREV_RANGE"

t_bg_header = color.black
t_text_header = color.white
t_bg_cell = color.white
t_text_cell = color.black
t_border = color.gray

// ==================================================================================
// TABLE 1: OVERALL STATISTICS
// ==================================================================================

overall_row_count = 1
if overall_show_current
    overall_row_count += 3
if overall_show_touch_close
    overall_row_count += 3
if overall_show_continue_reject
    overall_row_count += 3
if overall_show_first_touch
    overall_row_count += 5
if overall_show_gz
    overall_row_count += 4
if overall_show_close_dist
    overall_row_count += 3
if overall_show_highest_lowest
    overall_row_count += 3

var table overall_t = table.new(position = overall_pos, columns = 8, rows = overall_row_count, bgcolor = t_bg_cell, frame_color = t_border, frame_width = 1, border_color = t_border, border_width = 1)

if barstate.islast and overall_table_show
    overall_row = 0
    
    // Header
    table.merge_cells(overall_t, 0, overall_row, 7, overall_row)
    table.cell(overall_t, 0, overall_row, "OVERALL STATISTICS (2482 Days)", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
    overall_row += 1
    
    // Current Session Info
    if overall_show_current
        open_label = look_back == 1 ? "Open (Current):" : "Open (Previous):"
        
        table.merge_cells(overall_t, 0, overall_row, 1, overall_row)
        table.cell(overall_t, 0, overall_row, open_label, bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.merge_cells(overall_t, 2, overall_row, 7, overall_row)
        table.cell(overall_t, 2, overall_row, na(opening_zone) ? "N/A" : opening_zone, bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        overall_row += 1
        
        table.merge_cells(overall_t, 0, overall_row, 1, overall_row)
        table.cell(overall_t, 0, overall_row, "Now:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.merge_cells(overall_t, 2, overall_row, 7, overall_row)
        table.cell(overall_t, 2, overall_row, current_zone, bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        overall_row += 1
        
        table.merge_cells(overall_t, 0, overall_row, 1, overall_row)
        table.cell(overall_t, 0, overall_row, "Direction:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.merge_cells(overall_t, 2, overall_row, 7, overall_row)
        table.cell(overall_t, 2, overall_row, session_direction, bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        overall_row += 1
    
    // Touch & Close Rates
    if overall_show_touch_close
        table.cell(overall_t, 0, overall_row, "", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "R3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "R2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "R1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "PP", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "S1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "S2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "S3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Touch %", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "5.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "15.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "38.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "57.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "35.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "16.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "7.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Close %", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "4.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "15.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "39.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "—", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "36.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "15.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "7.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
    
    // Continue & Reject Rates
    if overall_show_continue_reject
        table.cell(overall_t, 0, overall_row, "", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "R3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "R2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "R1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "PP", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "S1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "S2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "S3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Continue %", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "77.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "81.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "81.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "88.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "84.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "83.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "85.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Reject %", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "36.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "41.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "50.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "61.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "62.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "60.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "56.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
    
    // First Touch Statistics
    if overall_show_first_touch
        table.cell(overall_t, 0, overall_row, "", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "R3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "R2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "R1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "PP", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "S1", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "S2", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "S3", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "1st Touch %", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "5.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "10.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "26.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "37.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "10.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "1.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "0.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "1st→Continue", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "77.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "73.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "72.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "84.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "95.6%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "95.8%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "100%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Avg Time", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "3h 19m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "2h 25m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "1h 55m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "1h 6m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "55m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "49m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "19m", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Multi-Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "93.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "94.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "92.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "94.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "93.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "94.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "95.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
    
    // Golden Zone Statistics
    if overall_show_gz
        table.merge_cells(overall_t, 0, overall_row, 7, overall_row)
        table.cell(overall_t, 0, overall_row, "GOLDEN ZONE STATISTICS", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Main GZ", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.merge_cells(overall_t, 1, overall_row, 7, overall_row)
        table.cell(overall_t, 1, overall_row, "58.5% touch rate", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Inter-Pivot", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "PP-R1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "60.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "PP-S1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "50.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "R1-R2", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "25.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "S1-S2 24%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "R2-R3", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "9.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "S2-S3", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "10.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.merge_cells(overall_t, 5, overall_row, 7, overall_row)
        table.cell(overall_t, 5, overall_row, "", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
    
    // Daily Close Distribution
    if overall_show_close_dist
        table.merge_cells(overall_t, 0, overall_row, 7, overall_row)
        table.cell(overall_t, 0, overall_row, "DAILY CLOSE DISTRIBUTION", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Above PP", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "58.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "Below PP", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "41.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "Above R1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "24.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "Below S1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "18.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "In GZ", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "6.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "Above R2", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "10.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "Below S2", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "8.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "Above R3", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "3.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
    
    // Highest/Lowest Levels Reached
    if overall_show_highest_lowest
        table.merge_cells(overall_t, 0, overall_row, 7, overall_row)
        table.cell(overall_t, 0, overall_row, "HIGHEST/LOWEST LEVELS REACHED", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "High Resist", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "R1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "26.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "R2", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "10.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "R3", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "5.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1
        
        table.cell(overall_t, 0, overall_row, "Low Support", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = overall_table_size)
        table.cell(overall_t, 1, overall_row, "S1", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 2, overall_row, "35.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 3, overall_row, "S2", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 4, overall_row, "1.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 5, overall_row, "S3", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 6, overall_row, "0.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        table.cell(overall_t, 7, overall_row, "", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = overall_table_size)
        overall_row += 1

// ==================================================================================
// TABLE 2: CONTEXT STATISTICS
// ==================================================================================

context_row_count = 1
if context_show_current_zone
    context_row_count += 1
if context_show_zone_stats
    context_row_count += 3
if context_show_gap_context
    context_row_count += 4

var table context_t = table.new(position = context_pos, columns = 8, rows = context_row_count, bgcolor = t_bg_cell, frame_color = t_border, frame_width = 1, border_color = t_border, border_width = 1)

if barstate.islast and context_table_show
    context_row = 0
    
    // Header
    table.merge_cells(context_t, 0, context_row, 7, context_row)
    table.cell(context_t, 0, context_row, "CONTEXT STATISTICS", bgcolor = t_bg_header, text_color = t_text_header, text_halign = text.align_center, text_size = context_table_size)
    context_row += 1
    
    // Current Opening Zone
    if context_show_current_zone
        table.merge_cells(context_t, 0, context_row, 7, context_row)
        zone_display = na(opening_zone) ? "N/A" : opening_zone
        table.cell(context_t, 0, context_row, "OPENING ZONE: " + zone_display, bgcolor = color.new(color.blue, 90), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
        context_row += 1
    
    // Opening Zone Statistics
    if context_show_zone_stats and not na(opening_zone)
        // Different stats based on opening zone
        if opening_zone == "GZ_TO_R1"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "38.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "50.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "49.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Balanced", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "R1: 49%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "PP: 52.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "GZ: 56.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "S1: 21.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "R2: 16%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "S2: 6.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "R3: 3.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if opening_zone == "AT_PP"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "12.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "56.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "43.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Sl. Bull", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "PP: 92.8%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "GZ: 90.3%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "S1: 38.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "R1: 36.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "S2: 14.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "R2: 11.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "S3: 6.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if opening_zone == "S1_TO_GZ"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "24.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "54.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "45.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Sl. Bull", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "PP: 63.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "S1: 57.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "GZ: 56.6%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "S2: 22.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "R1: 18.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "S3: 7.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "R2: 3.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if opening_zone == "R1_TO_R2"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "9.4%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "58.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "41.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Bullish", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "R1: 76.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "R2: 58.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "GZ: 35.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "PP: 30.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "R3: 20.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "S1: 13.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "S2: 5.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if opening_zone == "S2_TO_S1"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "6.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "59.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "40.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Bullish", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "S1: 82.8%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "S2: 61.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "PP: 42.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "GZ: 42.0%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "S3: 24.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "R1: 11.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "R2: 3.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if opening_zone == "IN_GZ"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "3.8%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "Bull:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "58.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "Bear:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "41.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.merge_cells(context_t, 6, context_row, 7, context_row)
            table.cell(context_t, 6, context_row, "Bullish", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.cell(context_t, 0, context_row, "Levels Hit", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "GZ: 100%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "PP: 75.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "R1: 41.9%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "S1: 16.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "R2: 6.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "S2: 2.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "S3: 1.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else
            // Generic for other zones
            table.merge_cells(context_t, 0, context_row, 7, context_row)
            table.cell(context_t, 0, context_row, "Detailed stats available for major zones", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.merge_cells(context_t, 0, context_row, 7, context_row)
            table.cell(context_t, 0, context_row, "(GZ_TO_R1, AT_PP, S1_TO_GZ, R1_TO_R2, S2_TO_S1, IN_GZ)", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
    
    // Previous Day Gap Context
    if context_show_gap_context and not na(gap_context)
        table.merge_cells(context_t, 0, context_row, 7, context_row)
        gap_label = gap_context == "ABOVE_PREV_HIGH" ? "GAP UP: Opened Above Yesterday's High" : gap_context == "BELOW_PREV_LOW" ? "GAP DOWN: Opened Below Yesterday's Low" : "NO GAP: Opened Within Yesterday's Range"
        table.cell(context_t, 0, context_row, gap_label, bgcolor = color.new(color.orange, 90), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
        context_row += 1
        
        if gap_context == "ABOVE_PREV_HIGH"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "20.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "R1 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "65.9%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "R2 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "42.1%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "S1 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "15.0%", bgcolor = color.new(color.red, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.merge_cells(context_t, 0, context_row, 7, context_row)
            table.cell(context_t, 0, context_row, "Bias: Bullish continuation (avoid shorting)", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if gap_context == "BELOW_PREV_LOW"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "11.3%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "S1 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "71.5%", bgcolor = color.new(color.green, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "S2 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "55.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "R1 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "12.1%", bgcolor = color.new(color.red, 80), text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.merge_cells(context_t, 0, context_row, 7, context_row)
            table.cell(context_t, 0, context_row, "Bias: Bearish continuation (avoid longing)", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
        else if gap_context == "WITHIN_PREV_RANGE"
            table.cell(context_t, 0, context_row, "Occurs:", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_left, text_size = context_table_size)
            table.cell(context_t, 1, context_row, "68.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 2, context_row, "PP Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 3, context_row, "69.5%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 4, context_row, "GZ Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 5, context_row, "71.7%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 6, context_row, "R1 Touch", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            table.cell(context_t, 7, context_row, "35.2%", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1
            
            table.merge_cells(context_t, 0, context_row, 7, context_row)
            table.cell(context_t, 0, context_row, "Bias: Balanced (watch for direction at PP/GZ)", bgcolor = t_bg_cell, text_color = t_text_cell, text_halign = text.align_center, text_size = context_table_size)
            context_row += 1

Overview

In addition to standard pivot lines, it projects Fibonacci Golden Zone channels between adjacent pivot levels such as PP to R1 or S1 to S2. Lines and customizable shaded zones are plotted directly on the main price chart. Inputs allow traders to select specific inter-pivot zones, toggle level visibility, adjust lookback history, and customize label positions. The script utilizes higher-timeframe daily data retrieval.

Details

Published by

TamaraKGreen on GitHub

Code credit

npg, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

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

SettingTypeDefaultVariable
Number of Periods Backint3look_back
Labels PositionstringRightposition_labels
Line Widthint2line_width
Show Daily Golden Zone (0.5-0.618)booltruegz_show
Master Toggle - Show All Golden Zonesbooltruegz_show_all
Line Colorcolorcolor.new(color.purple, 0)gz_color
Fill Colorcolorcolor.new(color.purple, 80)gz_fill_color
Show Labelsbooltruegz_show_labels
Show Pricesbooltruegz_show_prices
Calculate from Top (instead of Bottom)boolfalsegz_from_top
PP to R1booltruegz_pp_r1_show
PP to S1booltruegz_pp_s1_show
Show all 40 settings
SettingTypeDefaultVariable
R1 to R2booltruegz_r1_r2_show
S1 to S2booltruegz_s1_s2_show
R2 to R3booltruegz_r2_r3_show
S2 to S3booltruegz_s2_s3_show
R3 to R4booltruegz_r3_r4_show
S3 to S4booltruegz_s3_s4_show
R4 to R5booltruegz_r4_r5_show
S4 to S5booltruegz_s4_s5_show
Line Colorcolorcolor.new(color.orange, 0)gz_inter_color
Fill Colorcolorcolor.new(color.orange, 85)gz_inter_fill
Show Labelsbooltruegz_inter_labels
Show Pricesbooltruegz_inter_prices
Show Support/Resistance Levelsbooltruesr_show
Show SR Labelsbooltruesr_show_labels
Show SR Pricesbooltruesr_show_prices
pp_showbooltruepp_show
PPcolorcolor.graypp_color
s1_showbooltrues1_show
S1colorcolor.blues1_color
r1_showbooltruer1_show
R1colorcolor.bluer1_color
s2_showbooltrues2_show
S2colorcolor.blues2_color
r2_showbooltruer2_show
R2colorcolor.bluer2_color
s3_showbooltrues3_show
S3colorcolor.blues3_color
r3_showbooltruer3_show
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

948 stars

Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us

Indicator v4 Moving averagesSupport & resistance
Updated 10 days ago · GPL-3.0 GitHub repository of Moving Average Channel

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

BZ-tracker

by Allen1212
303 stars

The BZ-tracker indicator marks ARK Invest buy and sell transactions on stock charts with labels. It plots green labels for purchases and red labels for sales, each annotated with a multiplier such as X1 or X2 to show the number of ARK ETFs trading the stock on

Indicator v4 Support & resistanceScreeners & dashboards
Updated 2 years ago · None stated GitHub repository of BZ-tracker

Function - Linear Regression

by ricardosantos79
261 stars

This indicator fits a linear regression through stored pivot highs and lows and draws the resulting channel on the price chart. A function returns predicted values, maximum and minimum deviations, and the average absolute deviation. Confirmed two-bar pivots up

Indicator v5 TrendSupport & resistance
Updated 4 years ago · None stated GitHub repository of Function - Linear Regression

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