Peter Lynch Value
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AntoineLeo

//@version=4
study("Peter Lynch Value", overlay=true)

EPS = financial(syminfo.tickerid, "EARNINGS_PER_SHARE", "TTM")

PERatio=input(30, title="P/E Ratio", step=1)

fairprice= EPS > 0 ? PERatio*EPS : na
plot(fairprice, color=color.green)

//FairPriceEstimate
earningestimate = financial(syminfo.tickerid, "EARNINGS_ESTIMATE", "FY")
fairpriceestimate= earningestimate > 0 ? PERatio*earningestimate : na 
plot(fairpriceestimate)
