graham's formula
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © crovisgrind

//@version=5
indicator(title="graham's formula", overlay=true)
symbol = syminfo.tickerid
EPS = request.financial(symbol, "EARNINGS_PER_SHARE_BASIC", "TTM")
BVPS = request.financial(symbol, "BOOK_VALUE_PER_SHARE", "FQ")
formula = math.sqrt(22.5 * EPS * BVPS)

plot(formula)
p= plot(close)
p2 = plot(formula)
fill(p,p2, color=color.lime)

var tabela = table.new(position = position.middle_left, columns = 2, rows = 2, bgcolor = color.rgb(211, 154, 47), border_width = 1, border_color= color.black, frame_color=color.black)
table.set_frame_color(tabela, frame_color= color.black)
EPSA=EPS
BVPSA=BVPS
if barstate.islast
    table.cell(table_id = tabela, column = 0, row = 0, text = "EPS",bgcolor=color.rgb(89, 218, 205))
    table.cell(table_id = tabela, column = 0, row = 1, text = "BVPS " , bgcolor=color.rgb(89, 218, 205))
    table.cell(table_id = tabela, column = 1, row = 0, text=str.tostring(EPSA))
    table.cell(table_id = tabela, column = 1, row = 1, text=str.tostring(BVPSA))

