RS_DailyDataArray (Series Function)

image\trumpet2.gif Disclaimer

The RS_DailyDataArray series function has been designed for use with intraday charts only. It extracts daily data from intraday data and makes it available to subsequently called functions like RS_Average and RS_Extremes that use this daily data.

Syntax

RS_DailyDataArray(NumDays, oDataArray, oIndex, oSubArray)

Returns (Integer)

The oDataArray, oIndex, and oSubArray output parameters return the data items listed in the parameters table.  The function itself returns a value of 1.

Parameters

Name

Type

Description

NumDays

Numeric

Number of days of daily data required. This is used to determine the initial look-back period, so that NumDays worth of data is available to CurrentBar = 1.

oDataArray

Numeric

Output array (2 dimensional) returns 12 daily data items for each of the preceding NumDays, and may contain data for additional days. (Note: The calling routine must declare the size of this array as 12-by-MaxNumDays, with MaxNumDays >= NumDays.) At least NumDays worth of data will be available at CurrentBar = 1. After that, additional days of data will continue to accumulate in the array until the array is filled up. The array is implemented as a circular buffer, and loads backwards starting from column MaxNumDays down to column 0. Each time a loading pass is completed, the array starts re-loading from column MaxNumDays again.

 

The 12 daily data items are as follows:

1 – Day open

2 – Day high

3 – Day low

4 – Day close (not available for current day)

5 – Day volume

6 – Day midrange (not available for current day)

7 – Day true high (not available for current day)

8 – Day true low (not available for current day)

9 – Day true range (not available for current day)

10 – Day high bar number

11 – Day low bar number

12 – Day number

 

oIndex

Numeric

Output variable returns the number of the oDataArray column in which the data for the current day is being loaded.

oSubArray

Numeric

Output array returns 3 pieces of data – the Day high (1), Day low (2), and Day number (3) of the final partial day in the MaxBarsBack buffer, at the bar preceding CurrentBar = 1. (Note: The calling routine must declare the size of this array to be 3; element 0 is not used.)

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.

This function will raise a run time error if it is applied to any chart other than intraday (minute bars).

Example

inputs: NumDays( 3 ), RowToAvg( 6 ), Offset( 0 ) ;

variables: NumDaysPlusOffset( NumDays + Offset ), Index( 0 ) ;

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

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

Value2 = RS_Average( RowToAvg, NumDays, Offset, DataArray, Index ) ;

Plot1( Value2 ) ;