Trade Signal Based Upon SMA of P/E Ratio
Author: rmpwealth
Creation Date: 3/20/2017 4:48 PM
profile picture


I would like to explore and back-test trading strategies based upon analyses of a Symbol's P/E ratio instead of its Price.

For example: Buy SPY when the P/E Ratio of SPY crosses above the 30-Day SMA of the the SPY P/E Ratio; Sell SPY when the P/E Ratio of SPY crosses below the 30-Day SMA of SPY's P/E Ratio.

I have not been able to create Rules (or Code) that apply Indicators to P/E Ratios. Can someone please help?

Thank you.
profile picture


P/E Ratio is earnings per share divided by price (e.g. close), optionally multiplied by adjustment factor.

You're right on that currently it won't be possible to apply indicators to P/E Ratio. However, several examples exist on the forum (#1, #2) that are helpful enough to start with strategy code. For instance, here's one. Make sure that the Fidelity fundamental data is up to date before running this code:

Please log in to see this code.
profile picture