ExtremePriceRatio (Simple Function)

image\trumpet2.gif Disclaimer

The ExtremePriceRatio function calculates the ratio of the extreme prices for a specified number of trailing bars. The extreme prices used are the Highest High and Lowest Low over a specified number of bars.

Ratio = x/y, where x is the Highest High and y is the Lowest Low in the range of bars.

Syntax

ExtremePriceRatio(Length,UseLog)

Returns (Double)

A numeric value for the current bar.

Parameters

Name Type Description

Length

Number

A numeric value. The number of trailing bars to consider for the calculation range.

UseLog

Boolean

True/false expression. TRUE = Use a Log of the ratio calculation, FALSE = Use a simple ratio calculation.

Remarks

If the input parameter Length were set to 1, the ratio of the current bar’s High and Low would be returned.

The value for the Length should always be a whole number greater than 0.

The input parameter UseLog is a switch; it allows you to select the type of calculation to be performed. When TRUE a Log of the ratio of extreme prices is calculated. When FALSE a simply ratio of the extreme prices is calculated.

Example

Assigns to Value1 and plots the simple ratio of extreme prices for the trailing 10 bars:

Value1 = ExtremePriceRatio(10, FALSE);

Plot1(Value1, "EPR");

Assigns to Value1 and plots the logarithmic ratio of extreme prices for the trailing 10 bars:

Value1 = ExtremePriceRatio(10, TRUE);

Plot1(Value1, "LogEPR");