PriceRatio

Description

The Price Ratio study demonstrates the relationship between prices of two specified symbols. This relationship is expressed as the ratio of the first symbol's price (by default, close) to the price of the second symbol (also close by default). The ratio can be modified if you add multipliers to the prices (by default, these are both set as equal to 1.0). Price types, symbols, and multipliers can be modified using input parameters. When the ratio grows, the plot is displayed in green (or your custom uptick color), otherwise it is painted red (or custom downtick color). 

In addition to its main plot, the study also displays two moving averages of the ratio: a fast and a slow one. By default, these are simple moving averages that have lengths of 4 and 40 bars, correspondingly. The type and the lengths of the averages can be customized, however, the length of the fast average cannot be greater than that of the slow one. 

Input Parameters

price1 Defines the price type of the first symbol.
price2 Defines the price type of the second symbol.
symbol1 Defines the first symbol.
symbol2 Defines the second symbol. Its price will be used as ratio consequent.
multiplier1 Defines the multiplier for the price of the first symbol.
multiplier2 Defines the multiplier for the price of the second symbol.
fast length Defines the length of the fast moving average; it must be less than the slow moving average length.
slow length Defines the length of the slow moving average; it must be greater than the fast moving average length.
average type The type of moving average to be used in calculations: simple, exponential, weighted, Wilder's, or Hull.

Plots

Ratio The Price Ratio study plot.
FastAvg The fast moving average plot.
SlowAvg The slow moving average plot.

Example*

*For illustrative purposes only. Not a recommendation of a specific security or investment strategy.