How to calculate Price to Earnings Growth rate?
Author: mikesblack
Creation Date: 7/20/2016 2:48 PM
profile picture

mikesblack

#1
How might I create an indicator for peg? Thanks Mike
profile picture

Eugene

#2
An example in pseudocode is found on this page: YCharts Fundamental Data for Securities and Economic Data

P/EG Ratio = (Close / "[yc] eps") / "[yc] eps_growth"

To get the PEG, you divide a price DataSeries (e.g. Bars.Close) by a EPS FundamentalDataSeries and then by an annualized EPS Growth FundamentalDataSeries. The items for YCharts are shown above; I don't know what they are for the Fidelity data. Assuming that you're a YCharts subscriber and have updated the fundamental data as per the User Guide, something like this should do (on-the-fly coding):

CODE:
Please log in to see this code.


Note that the PEG Ratio uses annualized EPS growth series. I'm not sure if the respective YCharts item is annual or quarterly but in the latter case you can annualize it with this overloaded call:
CODE:
Please log in to see this code.

i.e. instead take "FundamentalDataSeries("[yc] eps_growth", 4, 0)" to aggregate the last 4 quarters (and not to offset).
profile picture

mikesblack

#3
Thank you.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).