Fed Projected Interest Rates
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © triccomane

//@version=5
indicator("Fed Projected Interest Rates", overlay = true)

cur_input =input('CBOT:ZQJ2023',title = 'current zq')
cur_zq = 100-request.security(cur_input, timeframe.period, close)
cur_name = input("current interest",title = 'current zq')

jun_input =input('CBOT:ZQM2023',title = 'June zq')
next1_zq = 100-request.security(jun_input, timeframe.period, close)
next1_name = input("June interest",title = 'next1 zq')

sep_input =input('CBOT:ZQU2023',title = 'September zq')
next2_zq = 100-request.security(sep_input, timeframe.period, close)
next2_name = input("September interest",title = 'next2 zq')

dec_input =input('CBOT:ZQZ2023',title = 'December zq')
next3_zq = 100-request.security(dec_input, timeframe.period, close)
next3_name = input("December interest",title = 'next3 zq')


pos = input.string(title="Position", options=["Top Left", "Top Right", "Bottom Left", "Bottom Right"], defval="Top Right")
position = pos=="Top Left" ? position.top_left : pos=="Top Right" ? position.top_right : pos=="Bottom Left" ? position.bottom_left : position.bottom_right

//Table
var t = table.new(position, 5, 5, color.black)
if barstate.islast
    
    table.cell(t, 0, 1, cur_name, text_color=color.white)
    table.cell(t, 1, 1, str.tostring(cur_zq), text_color=color.white, bgcolor = #f2ff009b)

    table.cell(t, 0, 2, next1_name, text_color=color.white)
    table.cell(t, 1, 2, str.tostring(next1_zq), text_color=color.white, bgcolor = #f2ff009b)

    table.cell(t, 0, 3, next2_name, text_color=color.white)
    table.cell(t, 1, 3, str.tostring(next2_zq), text_color=color.white, bgcolor = #f2ff009b)

    table.cell(t, 0, 4, next3_name, text_color=color.white)
    table.cell(t, 1, 4, str.tostring(next3_zq), text_color=color.white, bgcolor = #f2ff009b)

    