Data Series

Data series are interpreted as freely usable data storage containers for your programs. Additionally, they an integrated component of AgenaTrader that saves the price changes for individual bars. We will be focusing on the latter function here. In the following section, the concept of data series will be explained in detail and understandably. All price data for the individual bars are organized and saved within data series. The following are available:

Open

High

Low

Close

Median

Typical

Weighted

Time

TimeFrame

Volume

Open

Description

Open is a DataSeries of the type DataSeries, in which the historical opening prices are saved.

Parameter

BarsAgo Index Value (see Bars)

Usage

Open
Open[int barsAgo]

More Information

The returned value is dependent upon the property of CalculateOnClosedBar.

Example

// Opening price for the current period
Print(Time[0] + " " + Open[0]);
// Opening price for the bars of 5 periods ago
Print(Time[5] + " " + Open[5]);
// Current value for the SMA 14 that is based on the opening prices (rounded)
Print("SMA(14) calculated using the opening prices: " + Instrument.Round2TickSize(SMA(Open, 14)[0]));

Opens

Description

Opens is an array of data series that contains all open data series.

This array is only useful or meaningful for indicators or strategies that use multiple data from multiple timeframes. A new entry is entered into the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Opens[0] The open data series of the chart timeframe Opens[1] The open data series of all bars in a daily timeframe Opens[2] The open data series of all bars in a weekly timeframe

Opens[0][0] is equivalent to Open[0].

In addition, please see MultiBars for more information.

Parameter

barsAgo Index value for the individual bars within the data series (see Bars) barSeriesIndex Index value for the various timeframes

Usage

Opens[int barSeriesIndex]
Opens[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property of CalculateOnClosedBar.

Example

See example: Multibars.

High

Description

High is a Data Series of the type Data Series, in which the historical high prices are saved.

Parameter

barsAgo IndexValue (see Bars)

Usage

High
High[int barsAgo]

More Information

The returned value is dependent upon the property of CalculateOnClosedBar.

Example

// High values of the current period
Print(Time[0] + " " + High[0]);
// High values of the bar from 5 periods ago
Print(Time[5] + " " + High[5]);
// the current value for the SMA 14 calculated on the basis of the high prices
Print("SMA(14) Calculated using the high prices: " + Instrument.Round2TickSize(SMA(High, 14)[0]));

Highs

Description

Highs is an array of [DataSeries][1] that contains all high data series.

This array is only of value for indicators or strategies that use data from multiple timeframes.

A new entry is added to the array whenever a new time unit is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Highs[0] the high data series of the chart timeframe Highs[1] the high data series of all bars in a daily timeframe Highs[2] the high data series of all bars in a weekly timeframe

Highs[0][0] is equivalent to High[0].

See MultiBars.

Parameter

barsAgo Index value for the individual bars within the data series (see Bars) barSeriesIndex Index value for the various timeframes

Usage

Highs[int barSeriesIndex]
Highs[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property of CalculateOnClosedBar.

Example

Please see examples under Multibars.

Low

Description

Low is a DataSeries of the type DataSeries, in which the historical low prices are saved.

Parameter

barsAgo IndexValue (see Bars)

Usage

Low
Low[int barsAgo]

More Information

The returned value is dependent upon the property of CalculateOnClosedBar.

Example

// Lowest value of the current period
Print(Time[0] + " " + Low[0]);
// Lowest value of the bar from 5 periods ago
Print(Time[5] + " " + Low[5]);
// The current value for the SMA 14 calculated on the basis of the low prices (smoothed)
Print("SMA(14) calculated using the high prices: " + Instrument.Round2TickSize(SMA(Low, 14)[0]));

Lows

Description

Lows is an array of [DataSeries][1] that contains all Low data series.

This array is only of value to indicators or strategies that use data from multiple time units.

A new entry is added whenever a new time unit is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Lows[0] the low data series for the chart timeframe Lows[1] the low data series for all bars in a daily timeframe Lows[2] the low data series for all bars in a weekly timeframe

Lows[0][0] is equivalent to Low[0].

See MultiBars.

Parameter

barsAgo Index value for the individual bars within the data series barSeriesIndex Index value for the various timeframes

Usage

Lows[int barSeriesIndex]
Lows[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example Multibars.

Close

Description

Close is a DataSeries of the type DataSeries, in which the historical closing prices are saved.

Parameter

barsAgo Index value (see Bars)

Usage

Close
Close[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Indicators are usually calculated using the closing prices.

Example

// Closing price of the current period
Print(Time[0] + " " + Close[0]);
// Closing price of the bar from 5 periods ago
Print(Time[5] + " " + Close[5]);
// Current value for the SMA 14 based on the closing prices
Print("SMA(14) calculated using the closing prices: " + Instrument.Round2TickSize(SMA(Close, 14)[0]));
// Close does not need to be mentioned since it is used by default
Print("SMA(14) calculated using the closing prices: " + Instrument.Round2TickSize(SMA(14)[0]));

Closes

Description

Closes is an array of [DataSeries][1] that contains all Low data series.

This array is only of importance to indicators or strategies that use data from multiple time units.

A new entry is added to the array whenever a timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Closes[0] the close data series of the chart timeframe Closes[1] the close data series of all bars in a daily timeframe Closes[2] the close data series of all bars in a weekly timeframe

Closes[0][0] is equivalent to Close[0].

See MultiBars.

Parameter

barsAgo Index value of the individual bars within the data series barSeriesIndex Index value for the various timeframes

Usage

Closes[int barSeriesIndex]
Closes[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example Multibars.

Median

Description

Median is a DataSeries of the type DataSeries, in which the historical median values are saved.

The median price of a bar is calculated using (high + low) / 2

See Typical & Weighted.

Parameter

barsAgo Index value (see Bars)

Usage

Median
Median[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Further information about median, typical und weighted: http://blog.nobletrading.com/2009/12/median-price-typical-price-weighted.html

Example

// Median price for the current period
Print(Time[0] + " " + Median[0]);
// Median price of the bar from 5 periods ago
Print(Time[5] + " " + Median[5]);
// Current value for the SMA 14 calculated using the median prices
Print("SMA(14) calculated using the median prices: " + Instrument.Round2TickSize(SMA(Median, 14)[0]));

Medians

Description

Medians is an array of [DataSeries][1] that contains all Median data series.

This array is only of value to indicators or strategies that use data from multiple timeframes.

A new entry is added to the array whenever a new time frame is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Medians[0] the median data series of the chart timeframe Medians[1] the median data series of all bars in a daily timeframe Medians[2] the median data series of all bars in a weekly timeframe

Medians[0][0] is equivalent to Medians[0].

See MultiBars.

Parameter

barsAgo Index value for the individual bars within a data series barSeriesIndex Index value for the various timeframes

Usage

Medians[int barSeriesIndex]
Medians[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Further information on median: http://www.investopedia.com/terms/m/median.asp

Example

See example in Multibars.

Typical

Description

Typical is a DataSeries of the type DataSeries, in which the historical typical values are saved.

The typical price of a bar is calculated using (high + low + close) / 3.

See Median and Weighted.

Parameter

barsAgo Index value (see Bars)

Usage

Typical
Typical[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Further information on typical: https://technicianapp.com/resources/typical-price/

Example

// Typical price for the current period
Print(Time[0] + " " + Typical[0]);
// Typical price of the bar from 5 periods ago
Print(Time[5] + " " + Typical[5]);
// Current value for the SMA 14 calculated using the typical price
Print("SMA(14) calculated using the typical price: " + Instrument.Round2TickSize(SMA(Typical, 14)[0]));

Typicals

Description

Typicals is an array of DataSeries that contains all Typical data series.

This array is only of value to indicators and strategies that make use of multiple timeframes.

A new entry is added to the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Typicals[0] the typical data series of the chart timeframe Typicals[1] the typical data series of all bars in a daily timeframe Typicals[2] the typical data series of all bars in a weekly timeframe

Typicals[0][0] is equivalent to Typicals[0].

See MultiBars.

Parameter

barsAgo Index value of the individual bars within a data series barSeriesIndex Index value of the various timeframes

Usage

Typicals[int barSeriesIndex]
Typicals[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example Multibars.

Weighted

Description

Weighted is a DataSeries of the type DataSeries, in which the historical weighted values are saved.

The weighted price of a bar is calculated using the formula (high + low + 2*close) / 4 and then weighted on the closing price.

See also Median and Typical.

Parameter

barsAgo Index value (see Bars)

Usage

Weighted

Weighted[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Information regarding weighted: http://www.stock-trading-infocentre.com/pivot-points.html

Example

// Weighted price for the current period
Print(Time[0] + " " + Weighted[0]);
// Weighted price of the bar from 5 periods ago
Print(Time[5] + " " + Weighted[5]);
// Current value for the SMA 14 using the weighted price
Print("SMA(14) calculated using the weighted price: " + Instrument.Round2TickSize(SMA(Weighted, 14)[0]));

Weighteds

Description

Weighteds is an array of [DataSeries][1] that contains all Weighted data series.

The array is only of value for indicators and strategies that use data from multiple timeframes.

A new entry is added to the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Weighteds[0] the weighted data series of the chart timeframe Weighteds[1] the weighted data series of all bars in a daily timeframe Weighteds[2] the weighted data series of all bars in a weekly timeframe

Weighteds[0][0] is equivalent to Weighteds[0].

See MultiBars.

Parameter

barsAgo Index value of the individual bars within a data series barSeriesIndex Index value for the various timeframes

Usage

Weighteds[int barSeriesIndex]
Weighteds[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example under Multibars.

Time

Description

Time is a DataSeries of the type DateTimeSeries, in which the timestamps of the individual bars are saved.

Parameter

barsAgo Index value (see Bars)

Usage

Time
Time[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

// Timestamp of the current period
Print(Time[0]);
// Timestamp of the bar from 5 periods ago
Print(Time[5]);

Times

Description

Times is an array of DataSeries that contains all Time data series.

This array is only of value to indicators and strategies that make use of multiple timeframes. A new entry is added to the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Times[0] the time data series of the chart timeframe Times[1] the time data series of all bars in a daily timeframe Times[2] the time data series of all bars in a weekly timeframe

Times[0][0] is equivalent to Times[0].

See MultiBars.

Parameter

barsAgo Index value for the individual bars within a data series barSeriesIndex Index value for the various timeframes

Usage

Times[int barSeriesIndex]
Times[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example Multibars.

Volume

Description

Volume is a DataSeries of the type DataSeries, in which the historical volume information is saved.

Parameter

barsAgo Index value (see Bars)

Usage

Volume

Volume[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

The value returned by the VOL() indicator is identical with the volume described here; for example, Vol()[3] will have the same value as Volume[3].

Example

// Volume for the current period
Print(Time[0] + " " + Volume[0]);
// Volume of the bar from 5 periods ago
Print(Time[5] + " " + Volume[5]);
// Current value for the SMA 14 calculated using the volume
Print("SMA(14) calculated using the volume: " + Instrument.Round2TickSize(SMA(Volume, 14)[0]));

Volumes

Description

Volumes is an array of DataSeries that contains all Volume data series.

This array is only of value for indicators or strategies that use data from multiple timeframes.

A new entry is added to the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

Volumes[0] the volume data series of the chart timeframe Volumes[1] the volume data series of all bars in the daily timeframe Volumes[2] the volume data series of all bars in the weekly timeframe

Volumes[0][0] is equivalent to Volumes[0].

See MultiBars.

Parameter

barsAgo Index value of the individual bars within a data series

barSeriesIndex Index value of the various timeframes

Usage

Volumes[int barSeriesIndex]
Volumes[int barSeriesIndex][int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

See example Multibars.

TimeFrame

Description

TimeFrame is a timeframe object. This property is used to read the current TimeFrame and not to set it.

Usage

TimeFrame

TimeFrames

Description

TimeFrames is an array of timeframe objects that contains a timeframe object for each individual bar object.

This array is only of value for indicators or strategies that use data from multiple timeframes.

A new entry is added to the array whenever a new timeframe is added to an indicator or strategy.

With [TimeFrameRequirements(("1 Day"), ("1 Week"))] the array will contain 3 entries:

TimeFrames [0] Timeframe of the primary data series (chart timeframe) TimeFrames [1] Print(TimeFrames[1]); // returns "1 Day" TimeFrames [2] Print(TimeFrames[2]); // returns "1 Week"

TimeFrames [0] is equivalent to TimeFrame.

See MultiBars.

Parameter

barSeriesIndex Index value for the various timeframes

Usage

TimeFrames [int barSeriesIndex]

Example

if (ProcessingBarSeriesIndex == 0 && ProcessingBarIndex == 0)
for (int i = BarsArray.Count-1; i >= 0; i--)
Print("The Indicator " + this.Name + " uses Bars of the Timeframe " + TimeFrames[i]);

Last updated