ta.ratio
Take the bar by bar ratio of two series to track relative strength.
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.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
a | Series | number | - | - | The series to read. |
b | Series | number | - | - | The series to read. |
Output
| Name | Type |
|---|---|
value | number |
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
ta.ratio(close, open)spy = series(symbol="SPY")
plot(ta.ratio(close, spy.close), "Relative strength")