IndicatorsMarketplace
Object for accessing indicators from Indicators Marketplace.
To enable you to use various kinds of algorithms and indicators from Signals Indicators Marketplace, you need an object which allows you to access those algorithms inside your strategies. That is what the IndicatorsMarketplace object does in the Setup method of each strategy.
Select indicators from the Indicators Marketplace
Select indicators and their version (Signals Framework supports versioning of algorithms created by developers) from the Indicators dropdown in the sidebar. In the background, the framework will automatically reference the selected algorithm in your strategy and add a using statement into your code in the code editor.
Selected indicators will be accessible through the IndicatorsMarketplace indicators object in the Setup method and intellisense will automatically start suggesting all the indicators which you have selected via the dropdown.

Apply indicator on a data series
OnSeries Method
Definition of an indicator is not complete without defining which data series you want to use it on. The OnSeries method makes this definition easy. Some indicators need a stream of doubles, while others are processing Bars. That's why the OnSeries method input parameter varies, based on the type of indicator.
Parameters
Name
Type
Description
series
IDataSerires<TData>
Data series used as input for the indicator.
Example
// Apply SMA indicator on close values of a 24 hours bars data series
// with SMA period of 14.
sma = indicators.SMA(14).OnSeries(dailyBars.Close);using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.SMA;
public class MyStrategy : SingleMarketStrategy
{
private Bars dailyBars;
private SMA sma;
public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
{
dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(2);
sma = indicators.SMA(14).OnSeries(dailyBars.Close);
}
public override void RegisterActions()
{
OnUpdateOf(dailyBars).Do(() =>
{
// Prints the current SMA value
Log("The current SMA value is " + sma.Value.ToString());
});
}
}Keep Method
Very often in your strategy logic, you want to make your trading decision based not only on the current indicator value but also on its historical value. Using the Keep method, you can define how many historical values should be stored in an indicator. By default, indicators only store a value for the current bar.
Parameters
Name
Type
Description
requiredCount
int
The number of historical values the indicator should keep.
Example
Suppose you need to know what the value of an SMA indicator was 10 bars in the past, you can simply set up an indicator using the Keepmethod with a parameter value of 10.
// Apply SMA indicator on close values of a 24 hours bars data series
// with SMA period of 14 and keep a retrospective overview of 10 bars
// into the past.
sma = indicators.SMA(14).Keep(10).OnSeries(dailyBars.Close);using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.SMA;
public class MyStrategy : SingleMarketStrategy
{
private Bars dailyBars;
private SMA sma;
public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
{
dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(50);
sma = indicators.SMA(14).Keep(10).OnSeries(dailyBars.Close);
}
public override void RegisterActions()
{
OnUpdateOf(dailyBars).Do(() =>
{
// Prints the current SMA value
Log("The current SMA value is " + sma.Value.ToString());
// Prints the previous SMA value
Log("The previous SMA value is " + sma.Values[1].ToString());
});
}
}
Last updated