Emibap's Uniswap V3 HEX/USDC 3% Liquidity Pool
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Copyright ® emibap

// Last update on 2023-06-02 16:13:31 UTC

//@version=5
indicator("Emibap's Uniswap V3 HEX/USDC 0.3% Liquidity Pool", "LP", overlay=true, max_lines_count=500)

// Inputs

// Pools to display (Default is HEX/USDC 0.3%)
POOLS_SECTION_TITLE = "Pools (in addition to HEX/USDC 0.3%)"
SHOW_POOL_HEXUSDC_1PCT = input.bool(true, "HEX/USCD 1%", "", "Pools", POOLS_SECTION_TITLE)
// SHOW_POOL_HEXETH_1PCT = input.bool(false, "HEX/ETH 1%", "", "Pools", POOLS_SECTION_TITLE)

// Input for Histogram lines and BG color
COLOR_LP_HISTOGRAM_LINES_03pct = input.color(color.new(color.blue, 20), 'HEX/USDC 0.3% Histogram lines color. Default is blue')
COLOR_LP_HISTOGRAM_LINES_1pct = input.color(color.new(color.yellow, 60), 'HEX/USDC 1% Histogram lines color. Default is yellow')
COLOR_LP_DEFAULT_BG = input.color(color.new(color.black, 80), 'Histogram background color. Default is black at 20% opacity')

// Price Limits histogram visibility
upperBoundFromCurrentPricePct = input.float(200, 'Upper price limit of the diagram. Percentage increase from current price. I.E: 200%', minval = 1, maxval = 3000)
lowerBoundFromCurrentPricePct = input.float(50, 'Lower price limit of the diagram. Percentage decrease from current price. I.E: 99%', minval = 1, maxval = 99.99)

WIDEST_BAR_WIDTH = input.int(200, 'Width of the widest bar', minval=20, maxval=200)

// Constants
var COLOR_LP_TRANSPARENT = color.new(color.black, 100)
var COLOR_LP_TEXT_UPDATE = color.new(color.red, 20)
var COLOR_LP_TEXT_NORMAL = color.new(color.gray, 20)
var LINE_THICKNESS_03PCT = 1
var LINE_THICKNESS_1PCT = 1

// Types
type liquidityHistogram
    string title
    array<float> pricesList
    array<float> lockedLinesList
    color lineColor
    int lineThickness


// Handy functions
draw_histogram_base(float hlimit, float llimit) =>
    // BG Box with Title
    var bt = box.new(bar_index + 3, hlimit, bar_index + 3 + WIDEST_BAR_WIDTH, llimit, xloc=xloc.bar_index, border_width = 0, bgcolor = COLOR_LP_DEFAULT_BG)
    box.set_text(bt, "Emibap's Uniswap V3 LP")
    box.set_text_color(bt, COLOR_LP_TEXT_NORMAL)
    box.set_text_size(bt, size.small)
    box.set_text_halign(bt, text.align_left)
    box.set_text_valign(bt, text.align_top)
    
    // BG Box with mode (Overlayed / Combined)
    var bt2 = box.new(bar_index + 3, hlimit, bar_index + 3 + WIDEST_BAR_WIDTH, llimit, xloc=xloc.bar_index, border_width = 0, bgcolor = COLOR_LP_DEFAULT_BG)
    box.set_text(bt2, "\n[OVERLAYED]")
    box.set_text_color(bt2, COLOR_LP_TEXT_NORMAL)
    box.set_text_size(bt2, size.small)
    box.set_text_halign(bt2, text.align_left)
    box.set_text_valign(bt2, text.align_top)
    
    // BG Box with last update
    var b = box.new(bar_index + 3, hlimit, bar_index + 3 + WIDEST_BAR_WIDTH, llimit, xloc=xloc.bar_index, border_width = 0, bgcolor = COLOR_LP_DEFAULT_BG)
    box.set_text(b, "Last update on 2023-06-02 16:13:31 UTC")
    box.set_text_color(b, COLOR_LP_TEXT_UPDATE)
    box.set_text_size(b, size.small)
    box.set_text_halign(b, text.align_right)
    box.set_text_valign(b, text.align_bottom)

draw_histogram_lines(liquidityHistogram h, float hlimit, float llimit, float widthRatio) =>
    // BG Box with fee%
    b2 = box.new(bar_index + 3, hlimit, bar_index + 3 + WIDEST_BAR_WIDTH, llimit, xloc=xloc.bar_index, border_width = 0, bgcolor = COLOR_LP_TRANSPARENT)
    box.set_text(b2, h.title)
    box.set_text_color(b2, h.lineColor)
    box.set_text_size(b2, size.small)
    box.set_text_halign(b2, text.align_right)
    box.set_text_valign(b2, text.align_top)

    ticksLen = array.size(h.pricesList)

    for i = 0 to ticksLen - 1 by 1
        currPr = array.get(h.pricesList, i)
        if llimit <= currPr and currPr <= hlimit
            lockedWidth = math.floor(array.get(h.lockedLinesList, i) * widthRatio)
            line.new(bar_index + 3, currPr, bar_index + 3 + lockedWidth, currPr, xloc=xloc.bar_index, color=h.lineColor, width=h.lineThickness)

unify_token_locked_values(immutable_locked_values, mutable_locked_values) =>
    for i = 0 to array.size(mutable_locked_values) - 1 by 1
        array.set(mutable_locked_values, i, array.get(mutable_locked_values, i) * close)
    array.concat(immutable_locked_values, mutable_locked_values)

// LP Histograms
if barstate.islast

    var drawable_histograms = array.new<liquidityHistogram>()

    // Upper and lower limit of the histogram relative to the current price
    var hlimit = close * (1 + upperBoundFromCurrentPricePct/100)
    var llimit = close * (1 - lowerBoundFromCurrentPricePct/100)

    // HEX/USDC 0.3%
    var lockedUSDCList_03pct = array.from(9.89, 9.92, 9.95, 9.98, 10.01, 10.04, 10.07, 10.10, 10.13, 10.16, 10.19, 10.22, 11.83, 11.86, 11.90, 11.93, 11.97, 12.01, 12.04, 12.08, 12.11, 12.15, 12.19, 12.22, 12.26, 12.30, 12.33, 12.37, 12.41, 12.45, 12.48, 12.52, 512.56, 12.60, 12.63, 12.67, 12.71, 12.75, 12.79, 12.82, 12.86, 12.90, 12.94, 12.98, 13.02, 13.06, 13.10, 13.14, 13.18, 13.22, 13.26, 13.30, 13.33, 13.38, 13.42, 13.46, 13.50, 13.54, 13.58, 13.62, 13.66, 13.70, 13.74, 13.78, 13.82, 13.87, 13.91, 13.95, 13.99, 14.03, 14.07, 14.12, 14.16, 14.20, 14.24, 14.29, 14.33, 14.37, 14.42, 14.46, 14.50, 14.55, 14.59, 14.63, 381.19, 382.34, 383.49, 384.64, 385.80, 386.95, 388.12, 389.28, 390.45, 391.63, 392.80, 393.98, 395.17, 396.35, 397.54, 398.74, 399.94, 401.14, 402.34, 403.55, 404.76, 405.98, 420.10, 423.63, 424.90, 426.18, 427.46, 428.74, 430.03, 431.32, 432.62, 433.92, 435.22, 436.53, 437.84, 439.15, 440.47, 441.80, 443.12, 444.46, 445.79, 447.13, 448.47, 449.82, 451.17, 452.53, 453.89, 455.25, 456.62, 457.99, 459.37, 460.75, 462.13, 463.52, 464.91, 466.31, 467.71, 469.11, 470.52, 485.35, 486.81, 488.27, 489.74, 518.34, 521.95, 637.61, 1139.53, 641.45, 643.38, 645.31, 647.25, 649.19, 651.15, 653.10, 655.06, 657.03, 659.01, 660.99, 675.19, 677.22, 679.25, 682.41, 684.46, 686.51, 688.58, 690.64, 2091.81, 2098.09, 2104.40, 2110.72, 2181.98, 2188.54, 2195.12, 2201.71, 2208.32, 2214.96, 2221.61, 2228.29, 2204.84, 2211.46, 2218.11, 2224.77, 2231.46, 2238.16, 2244.88, 2251.63, 2258.39, 2265.18, 4653.72, 4667.70, 4681.73, 4695.79, 4709.90, 4724.05, 4738.24, 4752.38)
    var lockedHEXList_03pct = array.from(349691.31, 348643.86, 347599.55, 346558.37, 345520.30, 344485.34, 343453.49, 337382.49, 336371.91, 335473.33, 334468.47, 333894.53, 332894.40, 331897.26, 330903.11, 329911.94, 328923.74, 326823.27, 325844.31, 324868.29, 323895.20, 322925.02, 321957.74, 320993.36, 320031.88, 319073.27, 318117.53, 317164.65, 316214.63, 315267.46, 314457.12, 316398.11, 315450.39, 314515.11, 313573.03, 312633.77, 311697.32, 312730.46, 311793.72, 310859.79, 309928.65, 309000.31, 308074.74, 307151.95, 304306.00, 303394.50, 302485.72, 301579.67, 300676.33, 299775.70, 298877.76, 297982.52, 297089.96, 296200.07, 295312.84, 294428.28, 293546.36, 292667.08, 291790.44, 290916.43, 290045.03, 289176.24, 288310.05, 287446.46, 299018.59, 297978.70, 297086.14, 296207.73, 295320.49, 294550.04, 294259.29, 293377.88, 292499.10, 291622.97, 200803.17, 200201.69, 199547.02, 198949.31, 198353.38, 197759.25, 197095.44, 196346.00, 195757.88, 195171.51, 194586.90, 194004.05, 193422.94, 192843.57, 192265.93, 191676.36, 191102.22, 190529.80, 189959.10, 189390.10, 188822.81, 188257.22, 186818.18, 186258.60, 185700.69, 185144.45, 184589.87, 184036.96, 177826.11, 177293.46, 176762.40, 176232.94, 175705.06, 175132.27, 174607.69, 174084.68, 173563.23, 173022.67, 172504.40, 171987.69, 171507.57, 174034.59, 173513.29, 172993.56, 172475.38, 172034.63, 172309.46, 171793.33, 171278.75, 170765.71, 170254.21, 169744.24, 169506.48, 168998.75, 168747.15, 166634.90, 166135.77, 165638.14, 165885.48, 165388.59, 164922.22, 164428.22, 163935.70, 162612.98, 162125.90, 161640.28, 161156.11, 161389.95, 174240.20, 32056.85, 29173.43, 852699.89, 850145.75, 847599.26, 844333.92, 841804.84, 839283.34, 842273.85, 839750.94, 839116.57, 836603.12, 834097.20, 831598.78, 829107.85, 827051.78, 824574.47, 822145.44, 819682.82, 815446.47, 813003.92, 810568.68, 808140.74, 805727.52, 803314.08, 800907.87, 798508.86, 795531.17, 793798.35, 791420.64, 789050.05, 786031.09, 783676.65, 781329.26, 779003.43, 777183.35, 774855.41, 771783.46, 769471.69, 767166.85, 764868.91, 762577.86, 760293.67, 758016.32, 1316762.38, 1312427.59, 1307663.90, 1303746.98, 734008.66, 731810.04, 729618.01, 727432.55, 725253.63, 723081.23, 720888.03, 718728.71)
    // Price Hex locked liquidity in USDC and concat into one
    unify_token_locked_values(lockedUSDCList_03pct, lockedHEXList_03pct)
    
    var pricesList_03pct = array.from(0.004093623959031289, 0.004118258300213204, 0.004143040884314239, 0.004167972603420888, 0.004193054354987987, 0.004218287041871012, 0.0042436715723585886, 0.004269208860205177, 0.004294899824663973, 0.004320745390519992, 0.00434674648812336, 0.004372904053422801, 0.004399219027999335, 0.00442569235910016, 0.004452324999672761, 0.004479117908399204, 0.004506072049730653, 0.004533188393922078, 0.004560467917067188, 0.004587911601133566, 0.0046155204339980134, 0.00464329540948211, 0.0046712375273879935, 0.004699347793534343, 0.004727627219792587, 0.004756076824123327, 0.004784697630612982, 0.004813490669510652, 0.0048424569772651995, 0.0048715975965625625, 0.004900913576363286, 0.0049304059719402805, 0.004960075844916808, 0.004989924263304698, 0.005019952301542791, 0.005050161040535614, 0.0050805515676922925, 0.005111124976965688, 0.005141882368891784, 0.005172824850629292, 0.0052039535359995155, 0.005235269545526434, 0.005266774006477045, 0.005298468052901939, 0.005330352825676121, 0.005362429472540081, 0.005394699148141102, 0.005427163014074831, 0.005459822238927089, 0.005492677998315932, 0.0055257314749339774, 0.005558983858590971, 0.005592436346256617, 0.005626090142103666, 0.00565994645755126, 0.005694006511308538, 0.00572827152941851, 0.005762742745302183, 0.005797421399802967, 0.005832308741231338, 0.005867406025409769, 0.005902714515717944, 0.005938235483138226, 0.0059739702063014155, 0.006009919971532771, 0.006046086072898313, 0.006082469812251414, 0.006119072499279647, 0.006155895451551941, 0.006192939994566003, 0.006230207461796033, 0.006267699194740726, 0.006305416542971558, 0.0063433608641813655, 0.006381533524233225, 0.006419935897209612, 0.006458569365461861, 0.006497435319659936, 0.006536535158842479, 0.0065758702904671765, 0.0066154421304614195, 0.006655252103273276, 0.006695301641922764, 0.006735592188053432, 0.00677612519198426, 0.006816902112761862, 0.006857924418213004, 0.006899193584997443, 0.006940711098661088, 0.006982478453689464, 0.007024497153561511, 0.007066768710803709, 0.007109294647044519, 0.00715207649306916, 0.007195115788874707, 0.007238414083725527, 0.007281972936209053, 0.007325793914291881, 0.00736987859537621, 0.007414228566356629, 0.0074588454236772395, 0.007503730773389115, 0.007548886231208119, 0.007594313422573064, 0.007640013982704224, 0.007685989556662187, 0.0077322417994070865, 0.007778772375858162, 0.007825582960953694, 0.0078726752397113, 0.00792005090728858, 0.007967711669044152, 0.008015659240599016, 0.008063895347898331, 0.008112421727273536, 0.008161240125504851, 0.00821035229988415, 0.008259760018278228, 0.008309465059192429, 0.008359469211834674, 0.008409774276179855, 0.008460382063034644, 0.008511294394102654, 0.008562513102050041, 0.008614040030571446, 0.008665877034456383, 0.008718025979655989, 0.008770488743350206, 0.008823267214015343, 0.008876363291492056, 0.008929778887053742, 0.008983515923475328, 0.009037576335102495, 0.009091962067921294, 0.009146675079628212, 0.00920171733970063, 0.009257090829467718, 0.009312797542181764, 0.009368839483089909, 0.00942521866950635, 0.009481937130884938, 0.009538996908892237, 0.009596400057481021, 0.009654148642964207, 0.009712244744089231, 0.009770690452112879, 0.009829487870876567, 0.009888639116882068, 0.009948146319367699, 0.010008011620384968, 0.01006823717487568, 0.010128825150749513, 0.010189777728962039, 0.010251097103593248, 0.010312785481926516, 0.01037484508452807, 0.010437278145326906, 0.01050008691169522, 0.01056327364452929, 0.010626840618330871, 0.010690790121289062, 0.01075512445536268, 0.010819845936363112, 0.01088495689403769, 0.010950459672153542, 0.011016356628581964, 0.011082650135383298, 0.011149342578892309, 0.011216436359804094, 0.011283933893260498, 0.011351837608937043, 0.011420149951130396, 0.011488873378846347, 0.011558010365888336, 0.01162756340094649, 0.011697534987687214, 0.011767927644843312, 0.011838743906304648, 0.011909986321209372, 0.011981657454035661, 0.012053759884694046, 0.012126296208620265, 0.012199269036868712, 0.012272680996206403, 0.012346534729207537, 0.012420832894348635, 0.012495578166104212, 0.012570773235043067, 0.01264642080792512, 0.012722523607798856, 0.012799084374099346, 0.012876105862746852, 0.012953590846246024, 0.01303154211378572, 0.013109962471339389, 0.013188854741766077, 0.013268221764912061, 0.013348066397713042, 0.013428391514297009, 0.013509200006087694, 0.013590494781908638, 0.013672278768087914, 0.013754554908563463, 0.013837326164989056, 0.013920595516840918, 0.014004365961524958, 0.014088640514484687, 0.014173422209309753, 0.014258714097845135, 0.014344519250301007, 0.014430840755363258, 0.014517681720304655, 0.014605045271096719, 0.014692934552522227, 0.014781352728288434, 0.014870302981140934, 0.014959788512978243, 0.015049812544967055, 0.015140378317658184, 0.015231489091103216, 0.01532314814497187, 0.015415358778670033, 0.015508124311458553, 0.015601448082572699, 0.015695333451342372, 0.015789783797313033, 0.015884802520367343, 0.015980393040847557, 0.016076558799678637, 0.016173303258492127, 0.01627062989975073, 0.016368542226873707, 0.016467043764362952, 0.016566138057929877, 0.016665828674623042, 0.016766119202956564, 0.016867013253039274, 0.01696851445670469, 0.017070626467641726, 0.017173352961526233, 0.01727669763615331, 0.017380664211570387, 0.017485256430211163, 0.017590478057030307, 0.017696332879638982, 0.017802824708441186, 0.017909957376770924, 0.01801773474103018, 0.01812616068082774, 0.01823523909911885, 0.018344973922345697, 0.01845536910057876, 0.01856642860765899, 0.01867815644134085, 0.018790556623436244, 0.01890363319995925, 0.019017390241271803, 0.01913183184223018, 0.01924696212233242, 0.019362785225866614, 0.019479305322060065, 0.019596526605229383, 0.019714453294931468, 0.019833089636115377, 0.01995243989927516, 0.02007250838060355, 0.020193299402146633, 0.020314817311959422, 0.020437066484262367, 0.020560051319598815, 0.020683776244993412, 0.020808245714111464, 0.020933464207419247, 0.021059436232345297, 0.021186166323442657, 0.021313659042552106, 0.021441918978966364, 0.021570950749595297, 0.02170075899913211, 0.02183134840022054, 0.021962723653623038, 0.022094889488390015, 0.022227850662030035, 0.022361611960681094, 0.022496178199282884, 0.022631554221750134, 0.02276774490114696, 0.022904755139862287, 0.023042589869786308, 0.02318125405248803, 0.023320752679393854, 0.023461090771967258, 0.02360227338188956, 0.02374430559124176, 0.02388719251268745, 0.02403093928965689, 0.02417555109653213, 0.02432103313883328, 0.024467390653405887, 0.02461462890860943, 0.024762753204506993, 0.024911768873056024, 0.025061681278300278, 0.025212495816562888, 0.025364217916640636, 0.025516853039999357, 0.02567040668097054, 0.025824884366949102, 0.025980291658592336, 0.026136634150020124, 0.026293917469016246, 0.026452147277231004, 0.026611329270385002, 0.026771469178474186, 0.026932572765976083, 0.027094645832057316, 0.027257694210782363, 0.02742172377132354, 0.027586740418172277, 0.027752750091351683, 0.02791975876663034, 0.028087772455737407, 0.02825679720657905, 0.028426839103456107, 0.028597904267283137, 0.028769998855808724, 0.028943129063837163, 0.029117301123451428, 0.0292925213042375, 0.02946879591351008, 0.02964613129653959, 0.02982453383678064, 0.030004009956101748, 0.030184566115016524, 0.030366208812916243, 0.0305489445883038, 0.03073278001902904, 0.03091772172252558, 0.031103776356048985, 0.03129095061691642, 0.03147925124274771, 0.03166868501170791, 0.03185925874275125, 0.03205097929586663, 0.032243853572324524, 0.03243788851492544, 0.03263309110824979, 0.03282946837890934, 0.03302702739580017, 0.03322577527035705, 0.03342571915680951, 0.033626866252439304, 0.03382922379783955, 0.03403279907717531, 0.034237599418445806, 0.034443632193748235, 0.034650904819543096, 0.0348594247569212, 0.035069199511872186, 0.03528023663555478, 0.035492543724568545, 0.03570612842122739, 0.0359209984138346, 0.03613716143695968, 0.03635462527171666, 0.03657339774604429, 0.03679348673498775, 0.03701490016098217, 0.03723764599413777, 0.03746173225252679, 0.037687167002472086, 0.03791395835883751, 0.038142114485320004, 0.038371643594743474, 0.03860255394935441, 0.038834853861119324, 0.039068551692023896, 0.03930365585437406, 0.039540174811098734, 0.03977811707605452, 0.040017491214332124, 0.040258305842564714, 0.04050056962923805, 0.04074429129500255, 0.04098947961298717, 0.04123614340911524, 0.04148429156242214, 0.04173393300537495, 0.04198507672419393, 0.042237731759176035, 0.04249190720502035, 0.04274761221115542, 0.04300485598206861, 0.04326364777763747, 0.043523996913463, 0.04378591276120506, 0.044049404748919614, 0.044314482361398205, 0.044581155140509296)

    var maxUSDCLockedInATick = array.max(lockedUSDCList_03pct)
    array.push(drawable_histograms, liquidityHistogram.new(title = "HEX/USDC 0.3%", pricesList = pricesList_03pct, lockedLinesList = lockedUSDCList_03pct, lineColor = COLOR_LP_HISTOGRAM_LINES_03pct, lineThickness = LINE_THICKNESS_03PCT))

    // HEX/USDC 1%
    if SHOW_POOL_HEXUSDC_1PCT
        var lockedUSDCList_1pct = array.from(4.78, 4.83, 4.88, 4.93, 4.98, 5.03, 5.08, 5.13, 5.18, 5.23, 5.29, 5.34, 5.39, 5.45, 5.50, 5.56, 5.61, 5.67, 5.73, 5.78, 5.84, 5.90, 5.96, 6.02, 6.08, 6.14, 6.20, 6.26, 6.33, 6.39, 6.46, 6.52, 6.59, 6.65, 6.72, 6.79, 6.85, 6.92, 6.99, 7.06, 7.13, 7.21, 7.28, 7.35, 7.43, 7.50, 7.58, 7.65, 7.73, 7.81, 7.88, 7.96, 8.04, 8.12, 8.21, 8.29, 8.37, 8.46, 8.54, 8.63, 8.71, 8.80, 8.89, 8.98, 9.07, 9.16, 9.25, 9.35, 9.44, 9.53, 9.63, 9.73, 9.82, 9.92, 10.02, 10.12, 10.23, 10.33, 10.43, 10.54, 10.64, 10.75, 10.86, 10.97, 11.08, 11.19, 11.30, 11.41, 11.53, 11.64, 11.76, 11.88, 12.00, 12.12, 12.24, 12.36, 12.49, 12.61, 12.74, 12.87, 13.00, 13.13, 13.26, 15.23, 15.38, 15.53, 15.69, 15.85, 16.01, 16.17, 16.33, 16.49, 16.66, 16.83, 17.00, 17.17, 17.34, 17.51, 17.69, 17.87, 18.05, 18.23, 18.41, 18.60, 18.78, 18.97, 19.16, 19.36, 19.55, 19.75, 19.94, 20.15, 20.35, 20.55, 20.76, 20.97, 21.18, 21.39, 21.61, 21.82, 22.04, 22.26, 22.49, 22.71, 22.94, 23.17, 23.41, 23.64, 23.88, 24.12, 24.36, 24.61, 24.85, 25.10, 25.35, 25.61, 25.87, 26.13, 26.39, 26.65, 26.92, 27.19, 27.47, 27.98, 28.26, 28.54, 28.83, 29.12, 29.41, 29.71, 30.01, 30.31, 30.61, 30.92, 31.23, 31.54, 31.86, 32.18, 32.50, 4.78, 4.83, 4.88, 4.93, 12.24, 12.36, 12.48, 12.61, 12.74, 12.86, 12.99, 13.12, 13.25, 13.39, 13.52, 13.66, 13.80, 13.93, 14.07, 14.22, 14.30)
        var lockedHEXList_1pct = array.from(1031.48, 1021.22, 1153.80, 1142.32, 1130.95, 1119.70, 1108.56, 1097.53, 1086.61, 1075.80, 1065.09, 1054.49, 1044.00, 1033.62, 1023.33, 1013.15, 1003.07, 993.09, 983.21, 973.43, 963.74, 954.15, 944.66, 935.26, 925.95, 916.74, 907.62, 898.59, 889.65, 7450.91, 7376.78, 7303.38, 7230.72, 7158.77, 7087.55, 7017.03, 35449.03, 6878.09, 6809.65, 6741.90, 6674.82, 6608.41, 6542.66, 6477.56, 6413.11, 6349.30, 6286.13, 6223.58, 6161.66, 6100.35, 6039.66, 5979.56, 5920.07, 5861.17, 5802.85, 5745.11, 5687.95, 5631.36, 5575.33, 639.10, 632.75, 626.45, 620.22, 614.05, 607.94, 601.89, 595.90, 589.97, 584.10, 601.38, 595.40, 589.48, 583.61, 577.80, 572.06, 566.36, 1608.83, 1592.83, 1576.98, 1561.29, 1545.75, 1530.37, 1515.15, 1500.07, 1485.15, 1470.37, 1455.74, 1537.98, 1522.68, 1724.65, 1707.49, 812.59, 804.50, 660.96, 654.38, 647.87, 5848.25, 6103.74, 5956.35, 5897.09, 5838.42, 5780.33, 5722.81, 5665.87, 5609.50, 5553.69, 5498.43, 495.42, 490.49, 485.61, 480.78, 475.99, 471.26, 466.57, 461.93, 457.33, 452.78, 448.27, 427.95, 423.69, 419.47, 415.30, 411.17, 407.08, 403.03, 399.02, 395.05, 391.12, 387.22, 383.37, 379.56, 233.12, 230.80, 228.50, 226.23, 223.98, 221.75, 219.55, 217.36, 215.20, 213.06, 210.94, 208.84, 206.76, 204.70, 202.67, 186.68, 184.83, 182.99, 181.17, 179.36, 177.58, 175.81, 174.06, 172.33, 170.62, 168.92, 550.81, 545.33, 539.90, 534.53, 529.21, 523.94, 518.73, 513.57, 508.46, 503.40, 498.39, 493.43, 488.52, 483.66, 478.85, 474.09, 469.37, 464.70, 460.08, 455.50, 450.97, 446.48, 442.04, 437.64, 433.28, 428.97, 424.70, 420.48, 416.30, 412.15, 408.05, 403.99, 399.97, 395.99, 119.04, 117.85, 116.68, 115.52, 114.37, 113.23, 112.11, 110.99)
        // Price Hex locked liquidity in USDC and concat into one
        unify_token_locked_values(lockedUSDCList_1pct, lockedHEXList_1pct)
    
        var pricesList_1pct = array.from(0.0002550155952225021, 0.000260166991823938, 0.00026542244828462353, 0.00027078406664700355, 0.0002762539914154528, 0.00028183441041402044, 0.00028752755566150134, 0.000293335704264184, 0.0002992611793266323, 0.0003053063508808656, 0.00031147363683430804, 0.00031776550393688746, 0.0003241844687676691, 0.00033073309874142036, 0.00033741401313550843, 0.00034422988413754105, 0.00035118343791417045, 0.0003582774557014875, 0.0003655147749174415, 0.0003728982902967324, 0.0003804309550486267, 0.0003881157820381629, 0.0003959558449912174, 0.0004039542797239121, 0.00041211428539685794, 0.00042043912579473356, 0.0004289321306317123, 0.0004375966968832586, 0.00044643629014482844, 0.0004554544460180142, 0.0004646547715246916, 0.0004740409465497322, 0.00048361672531285906, 0.0004933859378702346, 0.0005033524916463809, 0.0005135203729970455, 0.0005238936488036371, 0.0005344764680998697, 0.000545273063731266, 0.0005562877540481819, 0.000567524944633032, 0.0005789891300624053, 0.0005906848957047752, 0.0006026169195545255, 0.0006147899741030227, 0.0006272089282474859, 0.0006398787492384152, 0.0006528045046663602, 0.0006659913644888205, 0.0006794446030980909, 0.000693169601430878, 0.0007071718491205309, 0.0007214569466927489, 0.0007360306078056418, 0.000750898661535041, 0.0007660670547059742, 0.000781541854271237, 0.0007973292497380127, 0.0008134355556435092, 0.0008298672140806063, 0.0008466307972745206, 0.0008637330102115205, 0.000881180693320742, 0.0008989808252101777, 0.0009171405254579342, 0.0009356670574598733, 0.0009545678313347765, 0.0009738504068881958, 0.0009935224966361733, 0.0010135919688900419, 0.001034066850903541, 0.001054955332083503, 0.001076265767265399, 0.0010980066800550482, 0.0011201867662378343, 0.0011428148972567876, 0.0011659001237609256, 0.0011894516792252713, 0.0012134789836439962, 0.0012379916472981681, 0.001262999474599607, 0.0012885124680123868, 0.0013145408320535568, 0.001341094977374674, 0.0013681855249257876, 0.0013958233102035356, 0.0014240193875850542, 0.0014527850347494332, 0.0014821317571884886, 0.0015120712928086515, 0.0015426156166258175, 0.001573776945555034, 0.0016055677432969407, 0.001638000725322917, 0.0016710888639609326, 0.0017048453935841308, 0.0017392838159042264, 0.0017744179053718302, 0.0018102617146858618, 0.001846829580414254, 0.0018841361287281976, 0.0019221962812522217, 0.001961025261032443, 0.0020006385986253796, 0.00204105213830976, 0.002082282044423811, 0.0021243448078305622, 0.002167257252513753, 0.0022110365423069745, 0.0022557001877587485, 0.0023012660531362777, 0.0023477523635706764, 0.0023951777123465386, 0.0024435610683387547, 0.002492921783599556, 0.0025432796010988177, 0.0025946546626207257, 0.002647067516819946, 0.002700539127440545, 0.0027550908817009236, 0.0028107445988481373, 0.002867522538885011, 0.002925447411473548, 0.0029845423850181885, 0.0030448310959325544, 0.003106337658093383, 0.0031690866724854365, 0.003233103237041239, 0.003298412956679578, 0.0033650419535467954, 0.0034330168774649424, 0.003502364916591001, 0.0035731138082914235, 0.0036452918502363355, 0.0037189279117178526, 0.003794051445197025, 0.0038706924980840395, 0.0039488817247563795, 0.00402865039881976, 0.004110030425616735, 0.004193054354987987, 0.004277755394291388, 0.004364167421684067, 0.004452324999672761, 0.0045422633889379005, 0.004634018562436942, 0.004727627219792587, 0.004823126801971657, 0.004920555506260481, 0.005019952301542791, 0.0051213569438862344, 0.005224809992443746, 0.005330352825676121, 0.005438027657902303, 0.005547877556183979, 0.00565994645755126, 0.0057742791865763215, 0.005890921473302037, 0.006009919971532771, 0.006131322277494662, 0.006255176948872845, 0.006381533524233225, 0.006510442542836588, 0.00664195556485295, 0.00677612519198426, 0.006913005088503673, 0.007052650002719826, 0.007195115788874707, 0.007340459429483856, 0.007488739058127859, 0.007640013982704224, 0.007794344709148961, 0.007951792965637345, 0.008112421727273536, 0.008276295241278946, 0.008443479052689407, 0.008614040030571446, 0.008788046394768125, 0.008965567743185156, 0.009146675079628212, 0.009331440842202558, 0.009519938932286351, 0.009712244744089231, 0.009908435194807991, 0.010108588755391407, 0.010312785481926516, 0.010521107047658929, 0.01073363677565994, 0.010950459672153542, 0.011171662460516645, 0.011397333615966112, 0.01162756340094649, 0.011862443901232584, 0.012102069062761303, 0.012346534729207537, 0.01259593868031907, 0.012850380671025865, 0.013109962471339389, 0.013374787907057884, 0.013644962901293946, 0.013920595516840918, 0.014201795999395136, 0.01448867682165128, 0.014781352728288434, 0.015079940781864904, 0.015384560409640124, 0.015695333451342372, 0.01601238420790142, 0.01633583949116557, 0.016665828674623042, 0.01700248374514789, 0.017345939355791255, 0.017696332879638982, 0.018053804464757194, 0.018418497090247784, 0.018790556623436244, 0.019170131878214695, 0.019557374674563494, 0.01995243989927516, 0.020355485567904966, 0.020766672887972962, 0.021186166323442657, 0.021614133660502247, 0.022050746074674592, 0.022496178199282884, 0.02295060819529929, 0.023414217822604635, 0.02388719251268745, 0.02436972144281167, 0.02486199761168248, 0.025364217916640636, 0.02587658323241617, 0.026399298491472937, 0.026932572765976083, 0.027476619351415398, 0.028031655851917785, 0.028597904267283137, 0.029175591081778293, 0.02976494735472476, 0.030366208812916243, 0.030979615944903085, 0.03160541409718128, 0.032243853572324524, 0.032895189729098585, 0.033559683084597954, 0.034237599418445806, 0.03492920987909871, 0.035634791092298786, 0.03635462527171666, 0.03708900033182936, 0.03783821000307846, 0.03860255394935441, 0.03938233788785414, 0.04017787371135971, 0.04098947961298717, 0.04181748021345531, 0.042662206690925276, 0.043523996913463, 0.04440319557417746, 0.04530015432908867, 0.046215231937780744, 0.04714879440689617, 0.0481012151365287, 0.04907287506957341, 0.050064162844093756, 0.05107547494876635, 0.05210721588146593, 0.05315979831105372, 0.0542336432424339, 0.05532918018494444, 0.05644684732414932, 0.057587091697101064, 0.058750369371143696, 0.05993714562632746, 0.06114789514150846, 0.06238310218420753, 0.06364326080430437, 0.06492887503164424, 0.0662404590776366, 0.06757853754092576, 0.06894364561721654, 0.07033632931333818, 0.07175714566563256, 0.0732066629627538, 0.07468546097296869, 0.07619413117604842, 0.07773327699984481, 0.07930351406164529, 0.08090547041440345, 0.08253978679794345, 0.08420711689523884, 0.08590812759386839, 0.08764349925275323, 0.08941392597428242, 0.09122011588193528, 0.09306279140351191, 0.09494268956008511, 0.0968605622607891, 0.09881717660356314, 0.10081331518197029, 0.10284977639821385, 0.10492737478247714, 0.10704694131871367, 0.10920932377701864, 0.11141538705271439, 0.11366601351228546, 0.11596210334630162, 0.1183045749294701, 0.12069436518796102, 0.12313242997415288, 0.12561974444894794, 0.12815730347181067, 0.13074612199868493, 0.13338723548794942, 0.13608170031457323, 0.1388305941926378, 0.14163501660639372, 0.14449608925002522, 0.14741495647629785, 0.15039278575426912, 0.15343076813624493, 0.15653011873416875, 0.1596920772056341, 0.1629179082497144, 0.16620890211280887, 0.16956637510470682, 0.17299167012507632, 0.1764861572005884, 0.18005123403289106, 0.18368832655765266, 0.18739888951489828, 0.1911844070308668, 0.195046393211622, 0.19898639274865437, 0.20300598153671676, 0.2071067673041401, 0.2112903902558818, 0.21555852372956433, 0.21991287486476527, 0.22435518528582774, 0.22888723179846382, 0.23351082710042934, 0.23822782050655464, 0.2430400986884212, 0.2479495864289801, 0.25295824739241357, 0.2580680849095487, 0.26328114277913595, 0.2685995060853145, 0.2740253020315899, 0.2795607007916594, 0.28520791637742265, 0.2909692075245284, 0.2968468785958077, 0.30284328050295817, 0.3089608116468457, 0.31520191887680077, 0.3215690984692934, 0.3280648971263764, 0.334691912994299, 0.3414527967026959, 0.348350252424768, 0.3553870389588803, 0.3625659708320069, 0.3698899194254674, 0.37736181412340253, 0.3849846434844497, 0.392761456437087, 0.40069536349912266, 0.4087895380218203, 0.4170472174591537, 0.42547170466270273, 0.43406636920270586, 0.4428346487157981, 0.45178005027997414, 0.4609061518173263, 0.4702166035251174, 0.47971512933576294, 0.48940552840630425, 0.49929167663797036, 0.509377528226435, 0.5196671172433892, 0.5301645592500631, 0.5408740529433399, 0.5517998818351227, 0.562946415965626, 0.574318113651274, 0.5859195232679094, 0.5977552850700212, 0.6098301330467242, 0.622148896815227, 0.6347165035525514, 0.6475379799662709, 0.66061845430506, 0.6739631584098571, 0.6875774298064609, 0.7014667138403989, 0.7156365658549202, 0.7300926534129843)

        maxUSDCLockedInATick := math.max(maxUSDCLockedInATick, array.max(lockedUSDCList_1pct))

        array.push(drawable_histograms, liquidityHistogram.new(title = "\nHEX/USDC 1%", pricesList = pricesList_1pct, lockedLinesList = lockedUSDCList_1pct, lineColor = COLOR_LP_HISTOGRAM_LINES_1pct, lineThickness = LINE_THICKNESS_1PCT))
    
    var widthRatio = WIDEST_BAR_WIDTH / maxUSDCLockedInATick

    draw_histogram_base(hlimit = hlimit, llimit = llimit)

    for i = 0 to array.size(drawable_histograms) - 1 by 1
        draw_histogram_lines(array.get(drawable_histograms, i), widthRatio = widthRatio, hlimit = hlimit, llimit = llimit)
    