can you please help me code a simple strategy based on p/e for s&p p/e for .spx
Size:
Color:
What would its rules be?
Size:
Color:
ok,
plot s&p 500 p/e ratio, than use 200 period sma, and period day sma on the p/e chart. when the 200 crosses the 400 from below buy
.dji and when 200 crosses 400 from top sell .dji, thanks
Size:
Color:
I don't work with WLP and have no access to Fidelity data so bear with me if any error. My understanding is that P/E is price to earnings and S&P 500 is ".SPX". Try this on .DJI:
CODE:
Please log in to see this code.
Size:
Color:
That's not going to work. Indices and ETFs do not have associated fundamental data.
One way to do it with Fidelity-only data is to create an average p/e based on all the constituents in the index... processing intensive. Or, more straightforwardly divide the index value by the sum of the eps of the constituents. Likewise, an Index Definition could potentially be created for this, but in all cases historical significance would be lost due to the many changes of the S&P 500 over the years.
Size:
Color:
Good point Robert. No need in an IndexDefinition as S&P 500 P/E is calculated by YCharts economic data provider directly:
*
YCharts, item "[yc] sp_500_pe_ratio"
It's a drop-in replacement, right?
CODE:
Please log in to see this code.
And it can also be constructed from Multpl data and .SPX price:
*
Multpl, item name "[mu] s-p-500-earnings"
CODE:
Please log in to see this code.
P.S. An important thing to remember about economic (non-symbol) data providers is an
open issue preventing them from properly appearing on the chart
* (182124) Drag and drop doesn't function for non-symbol fundamental items (affects all Wealth-Lab versions from 6.7 and higher)
** Workaround: click "Push all indicators and fundamental items into the Strategy code"
Size:
Color:
That's the only realistic way to test a series like that one - use a provider that calculates it daily to account for all the replacements over time.
Size:
Color:
Re: post #6. Update:
QUOTE:
* YCharts, item "[yc] sp_500_pe_ratio"
Since then (2015) we removed this and some other items from YCharts provider as consuming too much quota. So YCharts isn't applicable for this task.
Size:
Color: