# Technical Studies Reference

### Ratio (Bar)

This study calculates the ratios of corresponding variables of two charts. This is useful for comparing the relative strength of one chart to another. Refer to the Multiple Chart Studies description for instructions to use this study.

Let $$X_t^{(1)}$$ and $$X_t^{(2)}$$ denote the value of any chart variable (listed below) at Index $$t$$ of Chart 1 and Chart 2, respectively. Chart 1 (aka the Source Chart) is always the chart to which the Ratio (Bar) study is applied, and Chart 2 (aka the Destination Chart) is the chart specified by the Chart 2 Number Input. $$X_t^{(1)}$$ and $$X_t^{(2)}$$ can represent any of the following variables.

• Open
• High
• Low
• Last
• Volume
• Number of Trades / Open Interest
• OHLC Avg
• HLC Avg
• HL Avg

Let $$v_1$$ and $$v_2$$ denote the Inputs Chart 1 Multiplier and Chart 2 Multiplier, respectively. Then the Ratio (Bar) study calculates the following ratios.

$$\displaystyle{\frac{v_1 \cdot X_t^{(1)}}{v_2 \cdot X_t^{(2)}}}$$

If $$X_t^{(1)} = 0$$ or $$X_t^{(2)} = 0$$, then a value of $$0$$ is used for the ratio.

The ratios are displayed only for Open, High, Low, and Close. These are displayed in the form of OHLC Bars by default, and the price graph draw type can be changed through the Graph Draw Type setting in the Study Settings window for the study.

If the Zero Output When Non Exact Date Match Input is set to Yes, then a value of zero is used for the ratios when two corresponding bars are not an exact match in their DateTimeIndexes. If this Input is set to No, then the study uses the sc.GetNearestMatchForDateTimeIndex() to find a match.

If the Use Latest Source Data For Last Bar Input is set to Yes, and a replay is not running and at the last bar in the Destination Chart, then the study uses the data from the very latest bar in the Source Chart. If this Input is set to No, then this is not done.

#### Inputs

• Chart 2 Number: Determines which chart is to be used in the divisors of the calculated ratios.
• Chart 1 Multiplier
• Chart 2 Multiplier
• Zero Output When Non Exact Date Match: Determines whether a zero value is to be used for the ratios if two corresponding bars do not exactly match in their DateTimeIndexes.
• Use Latest Source Data For Last Bar: Determines whether the data from the last bar in the Source Chart is to be used.