study("Plot earnings", overlay=true) t = "ESD:" + syminfo.prefix + "_" + ticker + "_EARNINGS" c = security(t, "D", close, true) o = security(t, "D", open, true) h = security(t, "D", high, true) u = security(t, "D", updatetime, true) plotshape(c) plotshape(o) plotshape(h) plotshape(u) // c - earning // o - estimate // h - date (in unix time) // u - period ending (in unix time)
Thanks very much for this code. I'm trying to divide the current quarter by the same quarter's earning in the year previous (so divide the current EPS by the EPS 4 quarters ago).
I can't figure out how to do this because when referencing c or c or c etc this fetches the previous period value, instead of the previous earnings value.
My programming skills aren't sharp enough to figure out how to do this - would you be able to help please?