RS_PriceExtension (Function)

image\trumpet2.gif Disclaimer

This function has been designed for use with intraday charts only, and *must* be called in conjunction with the RS_DailyDataArray function. The latter extracts daily data from intraday data and makes it available to subsequently called functions like this one that use that daily data.

This function identifies price extensions, or strong, multiple-day moves. It does this by looking for high values of Consolidation Index (True Price Channel / Average True Range). ConsolIndex values can range between 1 and Length. Low values indicate price consolidation, high values indicate price extension.

(Also see the Pennant function, which looks for low values of ConsolIndex.)

Usage

Value3 = RS_PriceExtension(NumDays, MinConsolIndex, FinalRangeFactor, PrevTrHighest, PrevTrLowest, PrevATR, DataArray, Index);

Returns

0: No extension found

1: Day following up extension

2: Day following down extension

Parameters (all inputs, no outputs)

Name

Type

Description

NumDays

Numeric

The number of days to be used in the function calculation. The most recent NumDays, not including the current day, will be used. NumDays should be <= MaxNumDays (see DataArray parameter below).

MinConsolIndex

Numeric

This input should be in the 1-to-NumDays range; the larger the number, the more extended the price.

FinalRangeFactor

Numeric

This factor ensures that the final day's move is good-sized - final day's TR will be >= oNumDaysATR * FinalRangeFactor.

PrevTrHighest

Numeric

The highest true-high of the previous NumDays (i.e., not including the current day.) Typically, this would be obtained from a prior call to the RS_TrueExtremes function.

PrevTrLowest

Numeric

The lowest true-low of the previous NumDays (i.e., not including the current day.) Typically, this would be obtained from a prior call to the RS_TrueExtremes function.

PrevATR

Numeric

The average true range for the previous NumDays (i.e., not including the current day.) Typically, this would be obtained from a prior call to the RS_TrueExtremes function.

DataArray

NumericArray

The array that contains the daily data to be used. This is an output of the RS_DailyDataArray function, and in input to the RS_PriceExtension function. (Note: The calling routine must declare the size of this array as 12-by-MaxNumDays, with MaxNumDays >= NumDays.)

Index

Numeric

The number of the DataArray column in which the data for the current day is being loaded. This is an output of the RS_DailyDataArray function, and an input to the RS_PriceExtension function.

 

Remarks

This approach is intended primarily for use with RadarScreen indicators, where only one datastream can be used; in charting, similar calculations can be performed more easily using a multi-data approach.

Example

inputs: NumDays( 3 ), MinConsolIndex( 2.25 ), FinalRangeFactor( 1 ) ;

variables: Index(0), PrevTrHighest(0), PrevTrLowest(0), PrevATR(0) ;

arrays: DataArray[ 12, 100 ] (0), SubArray[3] (0) ;

Value1 = RS_DailyDataArray(NumDays, DataArray, Index, SubArray) ;

if CurrentBar = 1 or Date <> Date[1] then

 begin

 Value2 = RS_TrueExtremes(NumDays, DataArray, Index, PrevTrHighest, PrevTrLowest, PrevATR) ;

Value3 = RS_PriceExtension(NumDays, MinConsolIndex, FinalRangeFactor, PrevTrHighest, PrevTrLowest, PrevATR, DataArray, Index) ;

 end ;

Plot1(Value3) ;