Please clarify How specifically PE Ratio is calculated when using FundamentalRatio indicator with following parameters sumLastNItems set to 4 and overNMonths set to 12
PE = new FundamentalRatio(bars, "Close", "Earnings", 4, 12, 1.00)
Thanks, Feliks
PE = new FundamentalRatio(bars, "Close", "Earnings", 4, 12, 1.00)
Thanks, Feliks
Rename
I'm not sure if the "4" should be a "3" below. I would check the output with a calculator. I don't calculate P/E ratio using this call.
The declaration for peRatio is placed in the MyStrategy "parent" {block} so it automatically becomes visible in both the Initialize and Execute "child" blocks, as standard C# scoping rules require.
The declaration for peRatio is placed in the MyStrategy "parent" {block} so it automatically becomes visible in both the Initialize and Execute "child" blocks, as standard C# scoping rules require.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript4 { public class MyStrategy : UserStrategyBase { FundamentalRatio peRatio; public override void Initialize(BarHistory bars) { peRatio = new FundamentalRatio(bars,"Close","Earnings",4,12); PlotIndicator(peRatio); } public override void Execute(BarHistory bars, int idx) { } } }
The last 4 fundamental items that have dates within the last 12 months are added together and divided by a reverse-split adjusted Close series. Of course, to be correct this assumes that the fundamental event item is not split adjusted.
QUOTE:
The last 4 fundamental items that have dates within the last 12 months are added together ...
Sometimes there's an out-of-band dividend added so one really needs to add the last 5 fundamental items up to get the proper result in these cases. There is a question as to how the "bonus" dividend should be accounted for?
I have a special notation from two years ago (in my local library code) saying to use "3" instead of "4" when computing "Price/Cash Flow ratio". I'm not sure what was going on there.
CODE:
FundamentalRatio priceCashFlowRatio = new FundamentalRatio(bars, "Close", "free_cash_flow", 3, 12, sharesOutstanding); //sumLastNItems=3 yields an SMA(4) of the events (quarters)
Your Response
Post
Edit Post
Login is required