'How to find the % increase of earnings quarter over quarter?
I want to change this part of the code so that it calculated the PE ratio increase from the same quarter but one year previously (e.g Q4 to Q4, etc.). How would you change the code do do that? Thanks to anyone who helps!!
fwdpeGrowth(sym) =>
quarterlyResult = request.financial(sym, "PRICE_EARNINGS_FORWARD", "FQ", gaps = barmerge.gaps_on, ignore_invalid_symbol = true)
var float lastQuarterlyResult = na
var float result = na
if not na(quarterlyResult)
result := nz((quarterlyResult - lastQuarterlyResult)/lastQuarterlyResult)
lastQuarterlyResult := quarterlyResult
result
plot(fwdpeGrowth(syminfo.tickerid))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
