Data

Also called Data stream or Data series.

Data in Signals Framework is represented by data series upon which you can register actions which define your strategy behavior. More about data series setup and registering a new action can be found in the sections dedicated to Setup() method and RegisterActions() method.

Bars

This data series represents the most common format for working with historical price data. Each object in the series - a bar - consist of so called OHCL data - representing Open, High, Close and Low prices for the time period - and Volume.

Properties

Name

Type

Description

Open

IDataSeries<double>

Prices of the asset in the first trade of each bar.

High

IDataSeries<double>

The highest prices of the asset during the time period of each bar.

Close

IDataSeries<double>

Prices of the asset in the last trade of each bar.

Low

IDataSeries<double>

The lowest prices of the asset during the time period of each bar.

Volume

IDataSeries<double>

For each bar in the bars object, you can return the volume of all transactions in that particular bar.

Example

Let's say you properly define your Setup() method of your strategy and, using the RegisterActions() method, you define a one minute data series for the asset which you want to trade. Now, let's say your strategy needs to compare the current high with the high from one minute ago. To access those values, the code would read as follows:

Basic example
Complete example
// Acess properties on current or previous bars
OnUpdateOf(hourlyBars).Do(() =>
{
var currentHigh = hourlyBars.High[0];
var highBeforeOneHour = hourlyBars.High[1];
});
using Signals.DataSeries.Bars;
using Signals.Framework;
public class MyStrategy : SingleMarketStrategy
{
private Bars hourlyBars;
public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
{
hourlyBars = data.Bars(BarPeriodType.Hour, 1).WithOffset(25);
}
public override void RegisterActions()
{
OnUpdateOf(hourlyBars).Do(() =>
{
Log($"High value for the current hour: {hourlyBars.High[0]}.");
Log($"High value 5 hours ago: {hourlyBars.High[5]}.");
});
}
}

The most recent data are always under the index 0. Use a higher index to retrieve data from the past.

hourlyBars[0] - will get us bar at current hour hourlyBars[5] - will get us bar 5 hours ago