Docs

ta.ratio

Take the bar by bar ratio of two series to track relative strength.

itm
ta.ratio(a, b)

a / b, bar by bar, na when b is zero. The relative-strength twin of ta.spread, and the same clock rule: a declared series is joined as of each chart bar, completed bars only.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
aSeriesnumber--The series to read.
bSeriesnumber--The series to read.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
None.
Missing values
na when either series is na on this bar, and na when b is zero. Pointwise: no window, no warm-up.

Example

itm
ta.ratio(close, open)
itm
spy = series(symbol="SPY")
plot(ta.ratio(close, spy.close), "Relative strength")