RS_TrueExtremes (Function)
This function has been designed for use with intraday charts only, and *must* be called in conjunction with the RS_DailyDataArray function. The RS_DailyDataArray function extracts daily data from intraday data and makes it available to subsequently called functions like RS_TrueExtremes that use that daily data.
This function outputs the highest true-high/lowest true-low prices as well as the average true range of the most recent NumDays, not including the current day.
Usage
Value2 = RS_TrueExtremes(NumDays, DataArray, Index, oPrevTrHighest, oPrevTrLowest, oPrevATR);
Returns (Integer)
This function has a dummy return of 1. All the useful information is passed back to the caller via the output parameters. For more information see Multiple Output Functions.
Parameters
|
Name |
Type |
Description |
|
NumDays |
Numeric |
(Input) 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). |
|
DataArray |
NumericArray |
(Input) 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_TrueExtremes function. (Note: The calling routine must declare the size of this array as 12-by-MaxNumDays, with MaxNumDays >= NumDays.) |
|
Index |
Numeric |
(Input) 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_TrueExtremes function. |
|
oPrevTrHighest |
Numeric |
(Output) The highest true-high of the previous NumDays (i.e., not including the current day.) |
|
oPrevTrLowest |
Numeric |
(Output) The lowest true-low of the previous NumDays (i.e., not including the current day.) |
|
oPrevATR |
Numeric |
(Output) The average true range for the previous NumDays (i.e., not including the current day.) |
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 ) ;
variables: Index( 0 ), oPrevTrHighest( 0 ), oPrevTrLowest( 0 ), oPrevATR( 0 ) ;
arrays: DataArray[ 12, 100 ]( 0 ), SubArray[3]( 0 ) ;
Value1 = RS_DailyDataArray( NumDays, DataArray, Index, SubArray ) ;
if CurrentBar = 1 or Date <> Date[1] then
Value2 = RS_TrueExtremes( NumDays, DataArray, Index, oPrevTrHighest,
oPrevTrLowest, oPrevATR ) ;
Plot1( oPrevTrHighest ) ;
Plot2( oPrevTrLowest ) ;