0

I want to find out how quarterly revenue grow up or down.

Here is a script looks:

a = b / c,

where
a - ratio of grow up or down;
b - TOTAL_REVENUE by current reporting period;
c - TOTAL_REVENUE by past quarter report.

I don't find how I can get the TOTAL_REVENUE from the past quarter report.

Damir K
  • 13
  • 2

2 Answers2

1

The values available with the request.financial() function are available here.

This code is an example using "TOTAL_REVENUE":

//@version=5
indicator("")

revenueGrowth(sym) =>
    quarterlyRevenue = request.financial(sym, "TOTAL_REVENUE", "FQ", gaps = barmerge.gaps_on, ignore_invalid_symbol = true)
    var float lastQuarterlyRevenue = na
    var float result = na
    if not na(quarterlyRevenue)
        result := nz(quarterlyRevenue / lastQuarterlyRevenue)
        lastQuarterlyRevenue := quarterlyRevenue
    result

plot(revenueGrowth(syminfo.tickerid))

enter image description here

PineCoders-LucF
  • 8,288
  • 2
  • 12
  • 21
  • Hey PineCoders, could you help me out on my question? https://stackoverflow.com/questions/70594051/calculate-replicate-rsi-from-tradingviews-pine-script – Allart Jan 11 '22 at 07:18
0

I don’t think there is a simple way. You can create a var array and keep pushing the values from financials whiner they change. So, to look at history, you just need to refer the elements of array at certain index.