Simple Hashmap
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ramihoteit321

//@version=4
study("Simple Hashmap")

create_dict() => 
    indices  = array.new_int(0)
    elements = array.new_float(0)
    
    [indices, elements]

add_key (key, i, e) =>
    // check if key exists
    if array.indexof(i,key) == -1
        array.push(i, key)
        array.push(e, key)
    
get_value (key, i, e) =>
    array.get(e, array.indexof(i,key))

change_value (key, i, e, value) =>
    array.set(e, array.indexof(i,key), value)

[ind, el] = create_dict()
add_key(20, ind, el)
change_value(20, ind, el, 70.3)

if barstate.islast
    label.new(bar_index, low, tostring(get_value(20, ind, el)) )


    
plot(close)
