RS_Extremes (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_Extremes that use that daily data.
This function outputs the highest high/lowest low prices and relative day numbers of the most recent NumDays, not including the current day.
Usage
Value2 = RS_Extremes(NumDays, DataArray, Index, oPrevHighest, oPrevHighestDay,
oPrevLowest, oPrevLowestDay);
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_Extremes 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_Extremes function. |
|
oPrevHighest |
NumericArray |
(Output) 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_Average function. (Note: The calling routine must declare the size of this array as 12-by-MaxNumDays, with MaxNumDays >= NumDays + Max Offset.) |
|
oPrevHighestDay |
Numeric |
(Output) 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_Average function. |
|
oPrevLowest |
Numeric |
(Output) The lowest low of the previous NumDays (i.e., not including the current day.) |
|
oPrevLowestDay |
Numeric |
(Output) The relative day number of the lowest low of the previous NumDays. If the LL was on the previous day (the most recent day included), this output is 0; if the LL was on the second previous day, this output is 1; and so on. |
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), oPrevHighest(0), oPrevHighestDay(0), oPrevLowest(0), oPrevLowestDay(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_Extremes(NumDays, DataArray, Index, oPrevHighest, oPrevHighestDay, oPrevLowest, oPrevLowestDay ) ;
Plot1(oPrevHighest) ;
Plot2(oPrevLowest) ;